Abstract
Reasoning modulo equivalences is natural for everyone, including mathematicians. Unfortunately, in proof assistants based on type theory, which are frequently used to mechanize mathematical results and carry out program verification efforts, equality is appallingly syntactic, and as a result, exploiting equivalences is cumbersome at best. Parametricity and univalence are two major concepts that have been explored in the literature to transport programs and proofs across type equivalences, but they fall short of achieving seamless, automatic transport. This work first clarifies the limitations of these two concepts when considered in isolation and then devises a fruitful marriage between both. The resulting concept, called univalent parametricity, is an extension of parametricity strengthened with univalence that fully realizes programming and proving modulo equivalences. Our approach handles both type and term dependency, as well as type-level computation. In addition to the theory of univalent parametricity, we present a lightweight framework implemented in the Coq proof assistant that allows the user to transparently transfer definitions and theorems for a type to an equivalent one, as if they were equal. For instance, this makes it possible to conveniently switch between an easy-to-reason-about representation and a computationally efficient representation as soon as they are proven equivalent. The combination of parametricity and univalence supports transport à la carte: basic univalent transport, which stems from a type equivalence, can be complemented with additional proofs of equivalences between functions over these types, in order to be able to transport more programs and proofs, as well as to yield more efficient terms. We illustrate the use of univalent parametricity on several examples, including a recent integration of native integers in Coq. This work paves the way to easier-to-use proof assistants by supporting seamless programming and proving modulo equivalences.
- Thorsten Altenkirch and Ambrus Kaposi. 2015. Towards a cubical type theory without an interval. In 21st International Conference on Types for Proofs and Programs (TYPES’15), Tarmo Uustalu (Ed.), Vol. 69. LIPICS.Google Scholar
- Thorsten Altenkirch, Conor McBride, and Wouter Swierstra. 2007. Observational equality, now! In Proceedings of the Workshop on Programming Languages meets Program Verification (PLPV’07). 57--68.Google Scholar
- Abhishek Anand and Greg Morrisett. 2017. Revisiting parametricity: Inductives and uniformity of propositions. CoRR abs/1705.01163 (2017).Google Scholar
- Carlo Angiuli, Kuen-Bang Hou, and Robert Harper. 2018. Cartesian cubical computational type theory: Constructive reasoning with paths and equalities. In 27th EACSL Annual Conference on Computer Science Logic (CSL’18). 6:1--6:17.Google Scholar
- Robert Atkey, Neil Ghani, and Patricia Johann. 2014. A relationally parametric model of dependent type theory. In Proceedings of the 41st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL’14). Association for Computing Machinery, New York, NY, 503--515.Google ScholarDigital Library
- Andrej Bauer, Jason Gross, Peter LeFanu Lumsdaine, Michael Shulman, Matthieu Sozeau, and Bas Spitters. 2017. The HoTT library: A formalization of homotopy type theory in Coq. In Proceedings of the 6th ACM SIGPLAN Conference on Certified Programs and Proofs (CPP’17). ACM, New York, NY, 164--172.Google ScholarDigital Library
- Jean-Philippe Bernardy, Thierry Coquand, and Guilhem Moulin. 2015. A presheaf model of parametric type theory. Electronic Notes in Theoretical Computer Science 319 (2015), 67--82.Google ScholarDigital Library
- Jean-Philippe Bernardy, Patrik Jansson, and Ross Paterson. 2012. Proofs for free: Parametricity for dependent types. Journal of Functional Programming 22, 2 (March 2012), 107--152.Google ScholarDigital Library
- Simon Boulier, Pierre-Marie Pédrot, and Nicolas Tabareau. 2017. The next 700 syntactical models of type theory. In Certified Programs and Proofs (CPP’17). 182--194.Google Scholar
- Evan Cavallo and Robert Harper. 2020. Internal parametricity for Cubical Type Theory. In 28th EACSL Annual Conference on Computer Science Logic (CSL'20). 13:1--13:17 pages.Google Scholar
- Cyril Cohen, Thierry Coquand, Simon Huber, and Anders Mörtberg. 2015. Cubical Type Theory: A constructive interpretation of the univalence axiom. In Proceedings of the 21st International Conference on Types for Proofs and Programs (TYPES'15). 5:1--5:34 pages.Google Scholar
- Cyril Cohen, Maxime Dénès, and Anders Mörtberg. 2013. Refinements for free! In Proceedings of the International Conference on Certified Programming and Proofs (CPP’13) (Lecture Notes in Computer Science), G. Gonthier and M. Norrish (Eds.), Vol. 8307. Springer-Verlag, 147--162.Google Scholar
- Coq Development Team. 2020. The Coq Proof Assistant. https://doi.org/10.5281/zenodo.1003420.Google Scholar
- Thierry Coquand and Gérard Huet. 1988. The calculus of constructions. Information and Computation 76, 2--3 (Feb. 1988), 95--120.Google ScholarDigital Library
- Pierre-Évariste Dagand and Conor McBride. 2014. Transporting functions across ornaments. Journal of Functional Programming 24, 2--3 (2014), 316--383.Google ScholarCross Ref
- Nicola Gambino and Martin Hyland. 2004. Wellfounded trees and dependent polynomial functors. In Proceedings of Types for Proofs and Programs (TYPES’03) (Lecture Notes in Computer Science), Vol. 3085. Springer-Verlag, 210--225.Google ScholarCross Ref
- Healfdene Goguen, Conor McBride, and James McKinna. 2006. Eliminating Dependent Pattern Matching. Springer Berlin Heidelberg, Berlin,521--540.Google Scholar
- Florian Haftmann, Alexander Krauss, Ondřej Kunčar, and Tobias Nipkow. 2013. Data refinement in Isabelle/HOL. In Proceedings of the 4th International Conference on Interactive Theorem Proving (ITP’13) (Lecture Notes in Computer Science), S. Blazy, C. Paulin-Mohring, and D. Pichardie (Eds.), Vol. 7998. Springer-Verlag, 100--115.Google ScholarDigital Library
- Michael Hedberg. 1998. A coherence theorem for Martin-Löf’s type theory. Journal of Functional Programming 8, 4 (July 1998), 413--436.Google ScholarDigital Library
- Brian Huffman and Ondřej Kunčar. 2013. Lifting and transfer: A modular design for quotients in Isabelle/HOL. In Proceedings of the 3rd International Conference on Certified Programs and Proofs (CPP’13). Springer-Verlag, Melbourne, Australia, 131--146.Google ScholarDigital Library
- Chris Kapulkin and Peter LeFanu Lumsdaine. 2018. Homotopical inverse diagrams in categories with attributes. arXiv preprint arXiv:1808.01816 (2018).Google Scholar
- Neelakantan R. Krishnaswami and Derek Dreyer. 2013. Internalizing relational parametricity in the extensional calculus of constructions. In Proceedings of the Conference for Computer Science Logic (CSL’13). 432--451.Google Scholar
- Peter Lammich. 2013. Automatic data refinement. In Proceedings of the 4th international conference on interactive theorem proving (ITP’13) (Lecture Notes in Computer Science), S. Blazy, C. Paulin-Mohring, and D. Pichardie (Eds.), Vol. 7998. Springer-Verlag, 84--99.Google ScholarDigital Library
- Nicolas Magaud. 2003. Changing data representation within the Coq system. In International Conference on Theorem Proving in Higher Order Logics (TPHOLs’03) (Lecture Notes in Computer Science), D. Basin and B. Wolff (Eds.), Vol. 2758. Springer-Verlag.Google ScholarCross Ref
- Nicolas Magaud and Yves Bertot. 2000. Changing data structures in type theory: A study of natural numbers. In International Workshop on Types for Proofs and Programs (TYPES’00) (Lecture Notes in Computer Science), P. Callaghan, Z. Luo, J. McKinna, and R. Pollack (Eds.), Vol. 2277. Springer-Verlag, 181--196.Google Scholar
- Per Martin-Löf. 1975. An intuitionistic theory of types: Predicative part. In Logic Colloquium’73, H. E. Rose and J. C. Shepherdson (Eds.). Studies in Logic and the Foundations of Mathematics, Vol. 80. Elsevier, 73--118.Google Scholar
- Ulf Norell. 2009. Dependently typed programming in Agda. In Proceedings of the 4th International Workshop on Types in Language Design and Implementation (TLDI’09). ACM, 1--2.Google ScholarCross Ref
- Andreas Nuyts, Andrea Vezzosi, and Dominique Devriese. 2017. Parametric quantifiers for dependent type theory. Proceedings of the ACM on Programming Languages 1, ICFP, Article Article 32 (Aug. 2017), 29 pages.Google ScholarDigital Library
- Christine Paulin-Mohring. 2015. Introduction to the calculus of inductive constructions. In All About Proofs, Proofs for All, Bruno Woltzenlogel Paleo and David Delahaye (Eds.). Studies in Logic (Mathematical Logic and Foundations), Vol. 55.Google Scholar
- Simon Peyton Jones, Dimitrios Vytiniotis, Stephanie Weirich, and Geoffrey Washburn. 2006. Simple unification-based type inference for GADTs. In Proceedings of the 11th ACM SIGPLAN Conference on Functional Programming (ICFP’06). ACM Press, Portland, Oregon, 50--61.Google Scholar
- John C. Reynolds. 1983. Types, abstraction and parametric polymorphism. In IFIP Congress. 513--523.Google Scholar
- Talia Ringer, Nathaniel Yazdani, John Leo, and Dan Grossman. 2019. Ornaments for proof reuse in Coq. In 10th International Conference on Interactive Theorem Proving (ITP’19) (Leibniz International Proceedings in Informatics (LIPIcs)), John Harrison, John O’Leary, and Andrew Tolmach (Eds.), Vol. 141. Schloss Dagstuhl--Leibniz-Zentrum fuer Informatik, Dagstuhl, Germany, 26:1--26:19.Google Scholar
- Edmund Robinson. 1994. Parametricity as isomorphism. Theoretical Computer Science 136, 1 (1994), 163--181.Google ScholarDigital Library
- Michael Shulman. 2015. Univalence for inverse diagrams and homotopy canonicity. Mathematical Structures in Computer Science 25, 5 (2015), 1203--1277.Google ScholarCross Ref
- Matthieu Sozeau, Abhishek Anand, Simon Boulier, Cyril Cohen, Yannick Forster, Fabian Kunze, Gregory Malecha, Nicolas Tabareau, and Théo Winterhalter. 2020a. Coq Coq correct! Verification of type checking and erasure for Coq, in Coq. Proceedings of the ACM on Programming Languages 4, POPL (Jan. 2020), 8:1--8:28.Google ScholarDigital Library
- Matthieu Sozeau, Abhishek Anand, Simon Boulier, Cyril Cohen, Yannick Forster, Fabian Kunze, Gregory Malecha, Nicolas Tabareau, and Théo Winterhalter. 2020b. The MetaCoq project. Journal of Automated Reasoning 64 (Feb. 2020), 947--999.Google ScholarCross Ref
- Nicolas Tabareau, Éric Tanter, and Matthieu Sozeau. 2018. Equivalences for free: Univalent parametricity for effective transport. Proceedings of the ACM on Programming Languages 2, ICFP (Sept. 2018), 92:1--92:29.Google ScholarDigital Library
- Univalent Foundations Program. 2013. Homotopy Type Theory: Univalent Foundations of Mathematics. Institute for Advanced Study.Google Scholar
- Andrea Vezzosi, Anders Mörtberg, and Andreas Abel. 2019. Cubical Agda: A dependently typed programming language with univalence and higher inductive types. Proceedings of the ACM on Programming Languages 3, ICFP (Aug. 2019), 87:1--87:29.Google ScholarDigital Library
- Vladimir Voevodsky. 2010. The Equivalence Axiom and Univalent Models of Type Theory. arXiv:1402.5556.Google Scholar
- Philip Wadler. 1989. Theorems for free! In Functional Programming Languages and Computer Architecture. ACM Press, 347--359.Google Scholar
- Theo Zimmermann and Hugo Herbelin. 2015. Automatic and Transparent Transfer of Theorems along Isomorphisms in the Coq Proof Assistant. arXiv:1505.05028v4.Google Scholar
Index Terms
- The Marriage of Univalence and Parametricity
Recommendations
Equivalences for free: univalent parametricity for effective transport
Homotopy Type Theory promises a unification of the concepts of equality and equivalence in Type Theory, through the introduction of the univalence principle. However, existing proof assistants based on type theory treat this principle as an axiom, and ...
Internalizing representation independence with univalence
In their usual form, representation independence metatheorems provide an external guarantee that two implementations of an abstract interface are interchangeable when they are related by an operation-preserving correspondence. If our programming ...
Cubical agda: a dependently typed programming language with univalence and higher inductive types
Proof assistants based on dependent type theory provide expressive languages for both programming and proving within the same system. However, all of the major implementations lack powerful extensionality principles for reasoning about equality, such as ...
Comments