Skip to main content
QUICK REVIEW

[Paper Review] Revisiting Parametricity: Inductives and Uniformity of Propositions

Abhishek Anand, Greg Morrisett|arXiv (Cornell University)|May 2, 2017
Logic, programming, and type systemsComputer Science17 references8 citations
TL;DR

This paper presents a new parametricity translation for Coq that ensures polymorphic propositions are uniformly related across isomorphic instantiations, producing logically equivalent propositions and related proofs. Unlike prior work, it enforces uniformity by requiring isomorphism assumptions, enabling stronger free theorems for compiler correctness and dependently typed verification.

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.

Motivation & Objective

  • To address the limitation in existing parametricity translations where polymorphic propositions could be non-uniformly related (e.g., mapping to logically inequivalent propositions like True and False).
  • To develop a Coq-native parametricity translation that ensures logically equivalent propositions and related proofs on isomorphic instantiations.
  • To extend prior translations to handle inductive types and pattern-matching constructs in dependently typed programs.
  • To support the verification of undecidable relations—such as observational equivalence—by ensuring parametricity theorems remain meaningful and usable.
  • To provide a practical, open-source implementation that generates fully elaborated Coq proofs for free theorems, reducing manual proof effort.

Proposed method

  • Augment the existing parametricity translation (Keller and Lasson, 2012) with compositional proofs of logical equivalence and proof relation between propositions on isomorphic instantiations.
  • Introduce two translations: a weak version (\llbracket \rrbracket_{iso}) requiring isomorphism assumptions, and a strong version (\llbracket \rrbracket_{sIso}) that relaxes these when possible.
  • Develop a novel method for translating inductive types and pattern matching that generalizes prior approaches and supports full compositionality.
  • Use reification and reflection to implement the translation as executable Coq programs, enabling automated proof generation.
  • Enforce the Total and OneToOne properties on parametricity relations to ensure uniform behavior across related instantiations.
  • Leverage Coq’s dependent type system to internally represent and verify parametricity relations, avoiding reliance on external meta-theory.

Experimental results

Research questions

  • RQ1Can parametricity translations in Coq ensure that polymorphic propositions are not only related but also logically equivalent across isomorphic instantiations?
  • RQ2What assumptions are necessary to enforce uniformity of polymorphic propositions in dependently typed languages like Coq?
  • RQ3How can inductive types and pattern matching be translated in a way that preserves parametricity and supports compositional reasoning?
  • RQ4Can the translation be implemented as executable Coq code to generate fully elaborated proofs automatically?
  • RQ5To what extent do isomorphism assumptions in the translation limit its applicability while still enabling useful free theorems for verification?

Key findings

  • The proposed translation ensures that parametrically related propositions are logically equivalent, resolving a key limitation of prior translations that allowed non-uniform results.
  • The translation generates Coq proofs that not only relate the propositions but also relate any two proofs of those propositions, enhancing type safety and verification power.
  • For undecidable relations such as observational equivalence, the translation produces meaningful and usable free theorems, which were previously unattainable with earlier approaches.
  • The implementation, available at https://github.com/aa755/paramcoq-iff, automates the generation of proofs that previously took several hours to write manually.
  • The strong translation (\llbracket \rrbracket_{sIso}) reduces the need for isomorphism assumptions in some cases, showing that uniformity can be achieved without requiring isomorphism in all instances.
  • The method enables significant automation in a compiler correctness project, replacing manually written proofs with verified, machine-generated counterparts.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.