Modal types -- types that are derived from proof systems of modal logic -- have been studied as theoretical foundations of metaprogramming, where program code is manipulated as first-class values. In modal type systems, modality corresponds to a type constructor for code types and controls free variables and their types in code values. Nanevski et al. have proposed contextual modal type theory, which has modal types with fine-grained information on free variables: modal types are explicitly indexed by contexts -- the types of all free variables in code values. This paper presents $\lambda_{\forall[]}$, a novel extension of contextual modal type theory with parametric polymorphism over contexts. Such an extension has been studied in the literature but unlike earlier proposals, $\lambda_{\forall[]}$ is more general in that multiple parts of a single context can be abstracted. We formalize \lamfb with its type system and operational semantics given by $\beta$-reduction and prove its basic properties including subject reduction, strong normalization, and confluence. Moreover, to demonstrate the expressive power of polymorphic contexts, we show a type-preserving embedding from a two-level fragment of Davies' $\lambda_{\bigcirc}$, which is based on linear-time temporal logic, to $\lambda_{\forall[]}$.
翻译:模式类型 -- -- 源自模型逻辑的证明系统的类型 -- -- 已经作为元程序法的理论基础进行了研究,其中程序代码被作为头等值加以操纵。在模式类型系统中,模式相当于代码类型和控制自由变量的类型构建器,以及代码值中的类型。 Nanevski 等人提出了背景模式类型理论,该模式类型具有关于自由变量的细微区分信息模式类型:模式类型由背景明确编制索引 -- -- 代码值中所有自由变量的类别。本文展示了$\lambdaforall[] 的模型类型理论的新扩展,该模式代码代码代码代码以一等值值值来操作。在模型类型系统中,该模式类型与先前的建议不同, $\lambdafor[] 美元是比较一般的。我们正式化了\lamfb及其类型系统和业务语义,由 $\betata$\ 降值提供,并证明了其基本特性,包括主题的减少,强度正常化, 和连动。此外,这种扩展是在文献中进行了研究,但不同于先前的提议, 美元- climbalmaimal- brimeal- brialb) 范围背景中,我们展示了一个基于 级的磁值的磁值。