Skip to main content
QUICK REVIEW

[论文解读] Revisiting Parametricity: Inductives and Uniformity of Propositions

Abhishek Anand, Greg Morrisett|arXiv (Cornell University)|May 2, 2017
Logic, programming, and type systems参考文献 17被引用 8
一句话总结

本文提出了一种新的 Coq 参数性翻译机制,确保在同构实例化下,多态命题在逻辑上保持一致相关,生成逻辑等价的命题和相关证明。与以往工作不同,该方法通过要求同构假设来强制实现一致性,从而在编译器正确性验证和依赖类型程序验证中支持更强的自由定理。

ABSTRACT

Reynold's parametricity theory captures the property that parametrically polymorphic functions behave uniformly: they produce related results on related instantiations. In dependently-typed programming languages, such relations and uniformity proofs can be expressed internally, and generated as a program translation. We present a new parametricity translation for a significant fragment of Coq. Previous translations of parametrically polymorphic propositions allowed non-uniformity. For example, on related instantiations, a function may return propositions that are logically inequivalent (e.g. True and False). We show that uniformity of polymorphic propositions is not achievable in general. Nevertheless, our translation produces proofs that the two propositions are logically equivalent and also that any two proofs of those propositions are related. This is achieved at the cost of potentially requiring more assumptions on the instantiations, requiring them to be isomorphic in the worst case. Our translation augments the previous one for Coq by carrying and compositionally building extra proofs about parametricity relations. It is made easier by a new method for translating inductive types and pattern matching. The new method builds upon and generalizes previous such translations for dependently-typed programming languages. Using reification and reflection, we have implemented our translation as Coq programs. We obtain several stronger free theorems applicable to an ongoing compiler-correctness project. Previously, proofs of some of these theorems took several hours to finish.

研究动机与目标

  • 解决现有参数性翻译中多态命题可能非一致相关的问题(例如,映射到逻辑不等价的命题,如 True 和 False)。
  • 开发一种原生 Coq 的参数性翻译机制,确保在同构实例化下,命题逻辑等价且证明相关。
  • 扩展先前的翻译机制,以支持依赖类型程序中的归纳类型和模式匹配结构。
  • 通过确保参数性定理保持有意义且可用,支持对不可判定关系(如观测等价性)的验证。
  • 提供一个实用的开源实现,自动生成完整的 Coq 证明以用于自由定理,从而减少手动证明的工作量。

提出的方法

  • 在现有参数性翻译(Keller 和 Lasson,2012)的基础上,增加关于同构实例化下命题之间逻辑等价性和证明关系的组合式证明。
  • 引入两种翻译方式:一种弱版本(\llbracket \rrbracket_{iso}),要求同构假设;一种强版本(\llbracket \rrbracket_{sIso}),在可能时放宽这些假设。
  • 提出一种新颖的归纳类型和模式匹配翻译方法,该方法推广了先前的方法并支持完整的组合性。
  • 使用重语义化(reification)和反射(reflection)将翻译实现为可执行的 Coq 程序,从而实现自动证明生成。
  • 在参数性关系上强制实施 Total 和 OneToOne 性质,以确保在相关实例化之间行为的一致性。
  • 利用 Coq 的依赖类型系统在内部表示和验证参数性关系,避免依赖外部元理论。

实验结果

研究问题

  • RQ1Coq 中的参数性翻译能否确保多态命题不仅相关,而且在同构实例化下逻辑等价?
  • RQ2在 Coq 等依赖类型语言中,为强制多态命题的一致性,需要哪些假设?
  • RQ3如何翻译归纳类型和模式匹配,以保持参数性并支持组合式推理?
  • RQ4该翻译能否实现为可执行的 Coq 代码,以自动生成功能完整的证明?
  • RQ5翻译中同构假设的引入在多大程度上限制了其适用性,同时仍能支持对验证有用的自由定理?

主要发现

  • 所提出的翻译确保了参数性相关的命题在逻辑上等价,解决了先前翻译中允许非一致结果的关键缺陷。
  • 该翻译生成的 Coq 证明不仅关联了命题,还关联了这些命题的任意两个证明,从而增强了类型安全性和验证能力。
  • 对于观测等价性等不可判定关系,该翻译生成了有意义且可用的自由定理,而此前的方法无法实现这一点。
  • 实现代码托管于 https://github.com/aa755/paramcoq-iff,可自动生成功能完整的证明,此前这些证明需数小时手动编写。
  • 强翻译(\llbracket \rrbracket_{sIso})在某些情况下减少了对同构假设的需求,表明无需在所有实例中强制同构即可实现一致性。
  • 该方法在编译器正确性项目中实现了显著的自动化,将手动编写的证明替换为经过验证的机器生成版本。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。