论文标题

逐步依赖类型编程的命题平等

Propositional Equality for Gradual Dependently Typed Programming

论文作者

Eremondi, Joseph, Garcia, Ronald, Tanter, Éric

论文摘要

逐渐依赖的类型可以通过为不精确的类型和证据提供原则性的语义来帮助逐步采用相关的代码,并在某些部分被省略。但是,逐渐依赖类型的当前理论缺乏类型理论的核心特征:命题平等。 Lennon-Bertrand等。证明,当反身证明$ \ sathit {refl} $是平等类型的唯一闭合值时,用命题平等的CIC逐渐扩展会违反静态观察等价。扩展等效的函数在运行时不可区分,但是平等和类型不精确的组合允许区分扩展等于但句法差异的函数的上下文。 这项工作提出了一种支持命题平等的语言。我们通过设计平等类型来避免上述问题,其中$ \ mathit {refl} $并不是唯一的关闭居民。取而代之的是,每个平等证明都带有一个至少与等同术语一样精确的术语,是其合理平等的见证。这些目击者会跟踪部分类型的信息作为程序运行,当该信息表明两个等同的术语不可否认地不一致时会引起错误。类型信息的组成被内部化为语言的构造,并将其延迟到被变量阻止的功能体。通过延期,我们确保在不误差的情况下构成扩展相等的功能,从而防止上下文区分它们。我们描述了为该系统设计一致性和精确关系的挑战,以及针对这些挑战的解决方案。最后,我们证明了重要的元心态:CIC,规范性的类型安全,保守的嵌入以及Siek等人的逐步保证。

Gradual dependent types can help with the incremental adoption of dependently typed code by providing a principled semantics for imprecise types and proofs, where some parts have been omitted. Current theories of gradual dependent types, though, lack a central feature of type theory: propositional equality. Lennon-Bertrand et al. show that, when the reflexive proof $\mathit{refl}$ is the only closed value of an equality type, a gradual extension of CIC with propositional equality violates static observational equivalences. Extensionally-equal functions should be indistinguishable at run time, but the combination of equality and type imprecision allows for contexts that distinguish extensionally-equal but syntactically-different functions. This work presents a gradually typed language that supports propositional equality. We avoid the above issues by devising an equality type where $\mathit{refl}$ is not the only closed inhabitant. Instead, each equality proof carries a term that is at least as precise as the equated terms, acting as a witness of their plausible equality. These witnesses track partial type information as a program runs, raising errors when that information shows that two equated terms are undeniably inconsistent. Composition of type information is internalized as a construct of the language, and is deferred for function bodies whose evaluation is blocked by variables. By deferring, we ensure that extensionally equal functions compose without error, thereby preventing contexts from distinguishing them. We describe the challenges of designing consistency and precision relations for this system, along with solutions to these challenges. Finally, we prove important metatheory: type-safety, conservative embedding of CIC, canonicity, and the gradual guarantees of Siek et al.

扫码加入交流群

加入微信交流群

微信交流群二维码

扫码加入学术交流群,获取更多资源