We describe the categorical semantics for a simply typed variant and a simplified dependently typed variant of Cocon, a contextual modal type theory where the box modality mediates between the weak function space that is used to represent higher-order abstract syntax (HOAS) trees and the strong function space that describes (recursive) computations about them. What makes Cocon different from standard type theories is the presence of first-class contexts and contextual objects to describe syntax trees that are closed with respect to a given context of assumptions. Following M. Hofmann's work, we use a presheaf model to characterise HOAS trees. Surprisingly, this model already provides the necessary structure to also model Cocon. In particular, we can capture the contextual objects of Cocon using a comonad $\flat$ that restricts presheaves to their closed elements. This gives a simple semantic characterisation of the invariants of contextual types (e.g. substitution invariance) and identifies Cocon as a type-theoretic syntax of presheaf models. We further extend this characterisation to dependent types using categories with families and show that we can model a fragment of Cocon without recursor in the Fitch-style dependent modal type theory presented by Birkedal et. al..
翻译:我们描述简单打印变体的绝对语义和简化自定义变体Cocon(Cocon)的简化自定义变体的简化自定义变体,这是一种背景模式理论,其中框式模式在用来代表更高阶抽象语法(HOAS)树的弱功能空间与用来描述这些变体的强功能空间(recursive)之间进行介质。我们描述 Cocon 与标准类型理论不同的是一等背景和背景对象的存在,以描述在特定假设背景下封闭的同系物树。在M.Hofmann的工作完成后,我们使用前希法模式的预语法模型来描述HOAS树的特征。令人惊讶的是,这种模式已经为也提供了模型Cocon(HOAS)树和描述(recocon)的强功能空间之间的必要结构。特别是,我们可以使用将前希亚值限制其封闭元素元素的comonad $\ freadital 来捕捉摸Cocon(例如,变异性替代) 确定Cocon 和前变体模式的型合成合成合成合成合成合成。我们将这种特性进一步扩展的特性扩展到了Biraldaldal 的分类。