We investigate a simply typed modal $\lambda$-calculus, $\lambda^{\to\square}$, due to Pfenning, Wong and Davies, where we define a well-typed term with respect to a context stack that captures the possible world semantics in a syntactic way. It provides logical foundation for multi-staged meta-programming. Our main contribution in this paper is a normalization by evaluation (NbE) algorithm for $\lambda^{\to\square}$ which we prove sound and complete. The NbE algorithm is a moderate extension to the standard presheaf model of simply typed $\lambda$-calculus. However, central to the model construction and the NbE algorithm is the observation of Kripke-style substitutions on context stacks which brings together two previously separate concepts, structural modal transformations on context stacks and substitutions for individual assumptions. Moreover, Kripke-style substitutions allow us to give a formulation for contextual types, which can represent open code in a meta-programming setting. Our work lays the foundation for extending the logical foundation by Pfenning, Wong, and Davies towards building a practical, dependently typed foundation for meta-programming.
翻译:由于Pfenning、Wong和Davies等原因,我们调查了一个简单的模型 $ lambda $- calculus, $lambda ⁇ to\ quare}$ 。 在Pfenning、 Wong 和 Davies 中,我们定义了一个非常典型的词组, 这个词组以综合方式捕捉可能的世界语义。 它为多级元程序制作提供了逻辑基础。 我们在本文件中的主要贡献是通过评估(NbE) 算法来将$ lambda ⁇ to\ square} 值正常化。 NbE 算法是简单键入 $\ lambda$- calculus 的标准预示af 模型的中度扩展。 然而, 模型构建和 NbE 算法组的核心是观察背景堆堆中Kripke 式的替代。 它集了两个以前分开的概念, 上的背景堆和个人假设的替代结构模式转换。 此外, Kripkeke 风格替代让我们为背景类型设计一种配制, 它可以代表着开放的代码, 基础基础, 扩展了一个基础。