带擦除的类型论
Type Theory With Erasure
AI总结:
本文提出一种带擦除的类型论结构,通过第二阶广义代数理论(SOGAT)形式化,实现运行时相关与无关数据的区分,提供了一种更清晰的实现指南,并通过模型理论研究了其语义。
摘要:
擦除增强了类型论,使能够区分运行时相关和不相关的数据,允许编译步骤安全地擦除后者。这种功能的多个版本由许多系统实现,包括Agda、Idris和Rocq。我们提出了一种结构化的类型论擦除版本,以第二阶广义代数理论(SOGAT)的形式化。擦除被编码为运行时和擦除项之间的阶段区分,以命题的形式出现在上下文中。这种形式化有几个优势:它基于具有族的范畴有模型,与其他结构特性如分阶段兼容,并提供更好的实现指南。通过SOGAT的模型理论,我们研究了擦除类型论在族的集合中的语义,这可以推广到任何带有小命题的Grothendieck上台。我们建立了对Martin-Löf类型论(MLTT)的保守性,两个阶段均如此。对于代码提取,我们构建了一个预层模型,产生无类型的lambda演算程序,并通过粘贴证明其正确性。我们的结果在Agda中形式化,并提供了一个玩具解释器实现。
英文摘要:
Erasure enriches type theory with a distinction between runtime relevant and irrelevant data, allowing the compilation step to safely erase the latter. Versions of this feature are implemented by many systems, including Agda, Idris, and Rocq. We present a structural version of type theory with erasure, formulated as a second-order generalised algebraic theory (SOGAT). Erasure is encoded as a phase distinction between runtime and erased terms, in the form of a proposition that can appear in a context. This formulation has several advantages: it has models based on categories with families, is compatible with other structural features such as staging, and provides a better guideline for implementation. Through the model theory of SOGATs, we study the semantics of type theory with erasure in families of sets, which generalises to any Grothendieck topos equipped with a tiny proposition. We establish conservativity over Martin-Löf type theory (MLTT) in both phases. For code extraction, we construct a presheaf model that produces untyped lambda calculus programs and prove its correctness through gluing. Our results are formalised in Agda and we provide a toy elaborator implementation.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。