一句话:为 MLTT 引入参数化量词 ∀ 与 ∃,使参数化定理可在类型系统内部证明,并在 Agda 中实现。
多态类型系统(如 System F)具有参数化性质,但该性质不易迁移到依赖类型理论:MLTT 用单一的 Π 同时泛化参数化量词 ∀ 与非参数化的函数类型 →,导致关键的 identity extension 引理仅对小类型成立,无法推广到 universe。本文为 MLTT 引入参数化量词 ∀ 与 ∃,与既有的 Π、Σ 并存,并提供关系类型构造子以在系统内部证明参数化定理;同时借助 Church 编码与 sized types 内部证明索引函子的初始代数与终余代数。作者通过扩展现有的迭代自反图(cubical set)模型证明该系统可靠,其中区分表示对象相关性的 bridges 与表示相等的 paths,参数化函数即把 bridge 映为 path 的函数。最后在 Agda 证明助手中实现该扩展以检查证明。
Polymorphic type systems such as System F enjoy the parametricity property: polymorphic functions cannot inspect their type argument and will therefore apply the same algorithm to any type they are instantiated on. This idea is formalized mathematically in Reynolds's theory of relational parametricity, which allows the metatheoretical derivation of parametricity theorems about all values of a given type. Although predicative System F embeds into dependent type systems such as Martin-Löf Type Theory (MLTT), parametricity does not carry over as easily. The identity extension lemma, which is crucial if we want to prove theorems involving equality, has only been shown to hold for small types, excluding the universe. We attribute this to the fact that MLTT uses a single type former Π to generalize both the parametric quantifier ∀ and the type former → which is non-parametric in the sense that its elements may use their argument as a value. We equip MLTT with parametric quantifiers ∀ and ∃ alongside the existing Π and Σ, and provide relation type formers for proving parametricity theorems internally. We show internally the existence of initial algebras and final co-algebras of indexed functors both by Church encoding and, for a large class of functors, by using sized types. We prove soundness of our type system by enhancing existing iterated reflexive graph (cubical set) models of dependently typed parametricity by distinguishing between edges that express relatedness of objects (bridges) and edges that express equality (paths). The parametric functions are those that map bridges to paths. We implement an extension to the Agda proof assistant that type-checks proofs in our type system.
@article{NuytsVD17,
title = {Parametric quantifiers for dependent type theory},
author = {Andreas Nuyts and Andrea Vezzosi and Dominique Devriese},
journal = {Proceedings of the ACM on Programming Languages},
volume = {1},
number = {ICFP},
year = {2017},
doi = {10.1145/3110276}
}