参数性的再认识:归纳与命题的一致性
Revisiting Parametricity: Inductives and Uniformity of Propositions
摘要:
Albertold的参数性理论捕捉了参数多态函数行为一致的性质:它们在相关的实例上产生相关的结果。在依赖类型的程序设计语言中,这种关系和一致性证明可以在内部表达,并作为程序翻译生成。我们提出了一个新的参数翻译的一个重要的片段辅酶Q。以前的参数多态命题的翻译允许非一致性。例如,在相关的实例化上,函数可能返回逻辑上不等价的命题(例如True和False)。我们表明,多态命题的一致性是不可能实现的一般。然而,我们的翻译产生的证据表明,这两个命题是逻辑上等价的,而且这些命题的任何两个证明是相关的。这是以可能需要对实例化进行更多假设为代价的,要求它们在最坏的情况下是同构的。我们的翻译增强了前一个Coq进行和成分建设额外的参数关系的证明。通过转换归纳类型和模式匹配的新方法使其变得更容易。新的方法建立在并概括了以前的依赖类型的程序设计语言的翻译。使用具体化和反射,我们已经实现了我们的翻译为Coq程序。我们得到几个更强的免费定理适用于正在进行的编译器正确性项目。以前,这些定理的证明需要几个小时才能完成。
英文摘要:
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.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。