Abstract
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 language is dependently-typed, however, we would like to appeal to such invariance results within the language itself, in order to obtain correctness theorems for complex implementations by transferring them from simpler, related implementations. Recent work in proof assistants has shown that Voevodsky's univalence principle allows transferring theorems between isomorphic types, but many instances of representation independence in programming involve non-isomorphic representations.
In this paper, we develop techniques for establishing internal relational representation independence results in dependent type theory, by using higher inductive types to simultaneously quotient two related implementation types by a heterogeneous correspondence between them. The correspondence becomes an isomorphism between the quotiented types, thereby allowing us to obtain an equality of implementations by univalence. We illustrate our techniques by considering applications to matrices, queues, and finite multisets. Our results are all formalized in Cubical Agda, a recent extension of Agda which supports univalence and higher inductive types in a computationally well-behaved way.
- Andreas Abel, Jesper Cockx, Dominique Devriese, Amin Timany, and Philip Wadler. 2020. Leibniz equality is isomorphic to Martin-Löf identity, parametricaJloluyr.nal of Functional Programming 30 ( 2020 ), e17. https://doi.org/10.1017/ S0956796820000155 Google Scholar
Cross Ref
- Benedikt Ahrens and Peter LeFanu Lumsdaine. 2017. Displayed Categorie2sn.dInInternational Conference on Formal Structures for Computation and Deduction (FSCD 2017 ) (Leibniz International Proceedings in Informatics (LIPIcs), Vol. 84 ), (Eds.). Springer International Publishing, Cham, 160-17h6t.tps://doi.org/10.1007/978-3-319-08970-6_11Google Scholar
- Cyril Cohen, Thierry Coquand, Simon Huber, and Anders Mörtberg. 2018. Cubical Type Theory: A Constructive Interpretation of the Univalence Axiom2. 1Inst International Conference on Types for Proofs and Programs (TYPES 2015 ) (Leibniz International Proceedings in Informatics (LIPIcs), Vol. 69 ), Tarmo Uustalu (Ed.). Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik, Dagstuhl, Germany, 5 : 1-5 :34h.ttps://doi.org/10.4230/LIPIcs.TYPES. 2015.5Google Scholar
- Cyril Cohen, Maxime Dénès, and Anders Mörtberg. 2013. Refinements for Free!. ICnertified Programs and Proofs (CPP 2013 ), Georges Gonthier and Michael Norrish (Eds.). Springer International Publishing, Cham, 147-h1t6t2p. s://doi. org/10.1007/978-3-319-03545-1_10Google Scholar
- hTierry Coquand and Nils Anders Danielsson. 2013. Isomorphism is equalityI. ndagationes Mathematicae 24, 4 ( 2013 ), 1105-1120. https://doi.org/10.1016/j.indag. 2013. 09. 00I2n memory of N.G. ( Dick) de Bruijn ( 1918-2012 ). Google Scholar
Cross Ref
- hTierry Coquand, Simon Huber, and Anders Mörtberg. 2018. On Higher Inductive Types in Cubical Type Theory. In Proceedings of the 33rd Annual ACM/IEEE Symposium on Logic in Computer Science (Oxford, United Kingdom()LICS 2018 ). ACM, New York, NY, USA, 255-264. https://doi.org/10.1145/3209108.3209197 Google Scholar
Digital Library
- Karl Crary. 2017. Modules, Abstraction, and Parametric PolymorphisPmr. oIcneedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages (Paris, France)(POPL 2017 ). ACM, New York, NY, USA, 100-113. https://doi. org/10.1145/3009837.3009892 Google Scholar
Digital Library
- Nils Anders Danielsson. 2012. Bag Equivalence via a Proof-Relevant Membership RelatIinotne.raInctive Theorem Proving (Princeton, NJ, USA)( ITP 2012), Lennart Beringer and Amy Felty (Eds.). Springer Berlin Heidelberg, Berlin, Heidelberg, 149-165. https://doi.org/10.1007/978-3-642-32347-8_11 Google Scholar
Cross Ref
- Leonardo de Moura, Soonho Kong, Jeremy Avigad, Floris van Doorn, and Jakob von Raumer. 2015. The Lean Theorem Prover (System Description). InAutomated Deduction-CADE-25 (Berlin, Germany), Amy P. Felty and Aart Middeldorp (Eds.). Springer International Publishing, Cham, 378-38h8t.tps://doi.org/10.1007/978-3-319-21401-6_26Google Scholar
- Benjamin Delaware, Clément Pit-Claudel, Jason Gross, and Adam Chlipala. 2015. Fiat: Deductive Synthesis of Abstract Data Types in a Proof Assistant. PIrnoceedings of the 42nd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (Mumbai, India)(POPL 2015 ). Association for Computing Machinery, New York, NY, USA, 689-700. https://doi.org/10.1145/2676726.2677006 Google Scholar
Digital Library
- Edsger W. Dijkstra. 1974. On the role of scientific thought. (August 1974h)t.tps://www.cs.utexas.edu/users/EWD/ transcriptions/EWD04xx/EWD447.htmlGoogle Scholar
- Martín Hötzel Escardó. 2019. Introduction to univalent foundations of mathematics wihtthtApsg:d//aw. ww.cs.bham.ac. uk/~mhe/ HoTT-UF-in-Agda-Lecture-Notes/index.htmlGoogle Scholar
- Fredrik Nordvall Forsberg, Chuangjie Xu, and Neil Ghani. 2020. Three Equivalent Ordinal Notation Systems in Cubical Agda. InProceedings of the 9th ACM SIGPLAN International Conference on Certified Programs and Proofs (New Orleans, LA, USA) ( CPP 2020 ). Association for Computing Machinery, New York, NY, USA, 172-185h. ttps://doi.org/10.1145/ 3372885.3373835Google Scholar
- Dan Frumin, Herman Geuvers, Léon Gondelman, and Niels van der Weide. 2018. Finite Sets in Homotopy Type Theory. In Proceedings of the 7th ACM SIGPLAN International Conference on Certified Programs and Proofs (Los Angeles, CA, USA) ( CPP 2018 ). Association for Computing Machinery, New York, NY, USA, 201-21h4.ttps://doi.org/10.1145/3167085Google Scholar
- Emil Gjørup and Simon Friis Vindum. 2019. Case Study: BatchedQueue. https://github.com/limemloh/CubicalAgdaBatchedQueueGoogle Scholar
- Håkon Robbestad Gylterud. 2020. Multisets in type thMeoartyh. ematical Proceedings of the Cambridge Philosophical Society 169, 1 ( 2020 ), 1-18. https://doi.org/10.1017/S0305004119000045 Google Scholar
Cross Ref
- Florian Haftmann, Alexander Krauss, Ondřej Kunčar, and Tobias Nipkow. 2013. Data Refinement in Isabelle/HOL. In Interactive Theorem Proving (Rennes, France)(ITP 2013 ), Sandrine Blazy, Christine Paulin-Mohring, and David Pichardie (Eds.). Springer Berlin Heidelberg, Berlin, Heidelberg, 100-115h.ttps://doi.org/10.1007/978-3-642-39634-2_10Google Scholar
- Michael Hedberg. 1998. A coherence theorem for Martin-Löf's type thJeoourryn. al of Functional Programming 8, 4 ( 1998 ), 413-436. https://doi.org/10.1017/S0956796898003153 Google Scholar
Digital Library
- Stefan Kahrs, Donald Sannella, and Andrzej Tarlecki. 1997. The definition of Extended ML: A gentle introdTheuocrtetioicna. l Computer Science 173, 2 ( 1997 ), 445-484. https://doi.org/10.1016/S0304-3975 ( 96 ) 00163-6 Google Scholar
Digital Library
- Chris Kapulkin and Peter LeFanu Lumsdaine. 2020. The law of excluded middle in the simplicial model of type tThehoreyory. and Applications of Categories 35, 40 ( September 2020 ), 1546-1548. http://www.tac.mta.ca/tac/volumes/35/40/35-40.pdfGoogle Scholar
- Chantal Keller and Marc Lasson. 2012. Parametricity in an Impredicative S2o1rsttE. IAnCSL Annual Conference on Computer Science Logic (CSL 2012 ) (Leibniz International Proceedings in Informatics (LIPIcs), Vol. 16 ), Patrick Cégielski and Arnaud Durand (Eds.). Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik, Dagstuhl, Germany, 381-h3t9t5p.s://doi.org/10. 4230/LIPIcs.CSL. 2012.381Google Scholar
- Nicolai Kraus, Martín Escardó, Thierry Coquand, and Thorsten Altenkirch. 2017. Notions of Anonymous Existence in Martin-Löf Type Theory. Logical Methods in Computer Science 13, 1 ( 2017 ). https://doi.org/10.23638/LMCS-13 ( 1 :15) 2017 Google Scholar
Cross Ref
- Neelakantan R. Krishnaswami and Derek Dreyer. 2013. Internalizing Relational Parametricity in the Extensional Calculus of Constructions. ICnomputer Science Logic 2013 (CSL 2013 ) (Leibniz International Proceedings in Informatics (LIPIcs), Vol. 23 ), Simona Ronchi Della Rocca (Ed.). Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik, Dagstuhl, Germany, 432-451. https://doi.org/10.4230/LIPIcs.CSL. 2013.432 Google Scholar
Cross Ref
- Peter Lammich. 2013. Automatic Data Refinement. IInnteractive Theorem Proving (Rennes, France)(ITP 2013 ), Sandrine Blazy, Christine Paulin-Mohring, and David Pichardie (Eds.). Springer Berlin Heidelberg, Berlin, Heidelberg, 84-99. https://doi.org/10.1007/978-3-642-39634-2_9 Google Scholar
Digital Library
- Xavier Leroy. 1995. Applicative Functors and Fully Transparent Higher-Order ModulPeros. ceIendings of the 22nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (San Francisco, California(P)OPL 1995 ). ACM, New York, NY, USA, 142-153. https://doi.org/10.1145/199448.199476 Google Scholar
Digital Library
- Dan Licata. 2016. Weak univalence with “beta” implies full univalence. https://groups.google.com/d/msg/ homotopytypetheory/j2KBIvDw53s/ YTDK4D0NFQAEJmail to Homotopy Type Theory mailing list.Google Scholar
- Peter LeFanu Lumsdaine and Michael Shulman. 2019. Semantics of higher inductive tMyaptehse. matical Proceedings of the Cambridge Philosophical Society ( 2019 ). https://doi.org/10.1017/S030500411900015X Google Scholar
Cross Ref
- Nicolas Magaud. 2003. Changing Data Representation within the Coq SystTheeomre.mInProving in Higher Order Logics (Rome, Italy)( TPHOLs 2003 ), David Basin and Burkhart Wolf (Eds.). Springer Berlin Heidelberg, Berlin, Heidelberg, 87-102. https://doi.org/10.1007/10930755_6 Google Scholar
Cross Ref
- Nicolas Magaud and Yves Bertot. 2002. Changing Data Structures in Type Theory: A Study of Natural NumbTeyrps.esIn for Proofs and Programs (TYPES 2000 ) (Lecture Notes in Computer Science, Vol. 2277 ), Paul Callaghan, Zhaohui Luo, James McKinna, and Robert Pollack (Eds.). Springer Berlin Heidelberg, Berlin, Heidelberg, 181-h1t9t6p.s://doi.org/10.1007/3-540-45842-5_12Google Scholar
- Per Martin-Löf. 1975. An Intuitionistic Theory of Types: Predicative Part. LIongic Colloquium '73, H. E. Rose and J. C. Shepherdson (Eds.). Studies in Logic and the Foundations of Mathematics, Vol. 80. North-Hollandh, 7t3t-p1s1:/8/.doi. org/10.1016/ S0049-237X( 08 ) 71945-1Google Scholar
- John C. Mitchell. 1986. Representation Independence and Data AbstractPioronc.eeIdnings of the 13th ACM SIGACTSIGPLAN Symposium on Principles of Programming Languages (St. Petersburg Beach, Florid(aP)OPL '86). Association for Computing Machinery, New York, NY, USA, 263-276.https://doi.org/10.1145/512644.512669 Google Scholar
Digital Library
- Andreas Nuyts and Dominique Devriese. 2018. Degrees of Relatedness: A Unified Framework for Parametricity, Irrelevance, Ad Hoc Polymorphism, Intersections, Unions and Algebra in Dependent Type Theory. PIrnoceedings of the 33rd Annual ACM/IEEE Symposium on Logic in Computer Science (Oxford, United Kingdom()LICS 2018 ). ACM, New York, NY, USA, 779-788. https://doi.org/10.1145/3209108.3209119 Google Scholar
Digital Library
- Andreas Nuyts, Andrea Vezzosi, and Dominique Devriese. 2017. Parametric Quantifiers for Dependent Type Theory. Proceedings of the ACM on Programming Languages 1, ICFP, Article 32 ( January 2017 ), 29 pages.https://doi.org/10.1145/ 3110276 Google Scholar
Digital Library
- Chris Okasaki. 1999. Purely functional data structures. Cambridge University Press. https://doi.org/10.1017/ CBO9780511530104 Google Scholar
Cross Ref
- John C. Reynolds. 1983. Types, Abstraction and Parametric PolymorphismIn. fIonrmation Processing '83: Proceedings of the IFIP 9th World Computer Congress, R. E. A. Mason (Ed.). North-Holland, 513-523.Google Scholar
- Egbert Rijke. 2012. Homotopy Type Theory. Master's thesis. University of Ljubljanhat.tp://hottheory.files.wordpress.com/ 2012 /08/hott2.pdfGoogle Scholar
- Talia Ringer, Nathaniel Yazdani, John Leo, and Dan Grossman. 2019. Ornaments for Proof Reuse in1C0othq. InInternational Conference on Interactive Theorem Proving (ITP 2019 ) (Leibniz International Proceedings in Informatics (LIPIcs), Vol. 141 ), John Harrison, John O'Leary, and Andrew Tolmach (Eds.). Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik, Dagstuhl, Germany, 26 : 1-26 : 19. https://doi.org/10.4230/LIPIcs.ITP. 2019.26 Google Scholar
Cross Ref
- Edmund Robinson. 1994. Parametricity as isomorphism. Theoretical Computer Science 136, 1 ( 1994 ), 163-181. https: //doi.org/10.1016/ 0304-3975 ( 94 ) 00126-4 Google Scholar
Digital Library
- Donald Sannella and Andrzej Tarlecki. 1987. On observational equivalence and algebraic specJific. aCtomiopnu. t. System Sci. 34, 2 ( 1987 ), 150-178. https://doi.org/10.1016/ 0022-0000 ( 87 ) 90023-7 Google Scholar
Digital Library
- hTomas Streicher. 1993. Investigations Into Intensional Type Theory. Habilitation thesis. Ludwig-Maximilians-Universität München. https://www2.mathematik.tu-darmstadt.de/~streicher/HabilStreicher.pdfGoogle Scholar
- Nicolas Tabareau, Éric Tanter, and Mathieu Sozeau. 2018. Equivalences for Free: Univalent Parametricity for Efective Transport. Proceedings of the ACM on Programming Languages 2, ICFP ( September 2018 ), 92 : 1-92 : 29. https://doi.org/ 10.1145/3236787 Google Scholar
Digital Library
- Nicolas Tabareau, Éric Tanter, and Mathieu Sozeau. 2019. The Marriage of Univalence and Parametricity. arXiv: 1909. 05027 [cs.PL] https://arxiv.org/abs/ 1909.05027Preprint.Google Scholar
- hTe Agda Development Team. 2020. The Agda Programming Language. http://wiki.portal.chalmers.se/agda/pmwiki.phpGoogle Scholar
- hTe Coq Development Team. 2020. The Coq Proof Assistant. https://www.coq.inria.frGoogle Scholar
- hTe Mathematical Components Team. 2020. The Mathematical Components libraryh.ttps://github.com/math-comp/mathcompGoogle Scholar
- D. A. Turner. 1985. Miranda: A non-strict functional language with polymorphic tyFpuensc. tiIonnal Programming Languages and Computer Architecture (FPCA 1985 ), Jean-Pierre Jouannaud (Ed.). Springer Berlin Heidelberg, Berlin, Heidelberg, 1-16.Google Scholar
- hTe Univalent Foundations Program. 2013. Homotopy Type Theory: Univalent Foundations of Mathematics. Self-published. https://homotopytypetheory.org/book/Google Scholar
- Floris van Doorn, Jakob von Raumer, and Ulrik Buchholtz. 2017. Homotopy Type Theory in Lean.InInteractive Theorem Proving (Brasília, Brazil( ) ITP 2017 ), Mauricio Ayala-Rincón and César A. Muñoz (Eds.). Springer, Cham, 479-49h5.ttps: //doi.org/10.1007/978-3-319-66107-0_30Google Scholar
- Andrea Vezzosi, Anders Mörtberg, and Andreas Abel. 2019. Cubical Agda: A Dependently Typed Programming Language with Univalence and Higher Inductive TypePsr.oceedings of the ACM on Programming Languages 3, ICFP, Article 87 ( August 2019 ), 29 pages. https://doi.org/10.1145/3341691 Google Scholar
Digital Library
- Vladimir Voevodsky. 2010a. The equivalence axiom and univalent models of type theoryh. ttp://www.math.ias.edu/ vladimir/files/CMU_talk. pdNfotes from a talk at Carnegie Mellon University.Google Scholar
- Vladimir Voevodsky. 2010b. Univalent Foundationhst.tps://www.math.ias.edu/vladimir/sites/math.ias.edu.vladimir/files/ Bonn_talk. pdNfotes from a talk in Bonn.Google Scholar
- Vladimir Voevodsky. 2015. An experimental library of formalized Mathematics based on the univalent fouMndaatht-ions. ematical Structures in Computer Science 25, 5 ( 2015 ), 1278-1294. https://doi.org/10.1017/S0960129514000577 Google Scholar
Cross Ref
- Vladimir Voevodsky, Benedikt Ahrens, Daniel Grayson, et al. 2020. UniMath-a computer-checked library of univalent mathematics. https://github.com/UniMath/UniMathGoogle Scholar
- Philip Wadler. 1989. Theorems for Free!. In Proceedings of the Fourth International Conference on Functional Programming Languages and Computer Architecture (Imperial College, London, United Kingdo(mFP)CA ' 89 ). Association for Computing Machinery, New York, NY, USA, 347-359. https://doi.org/10.1145/99370.99404 Google Scholar
Digital Library
- James Wood. 2019. Vectors and Matrices in Agda. Blog poshttattps://personal.cis.strath.ac.uk/james.wood.100/blog/html/ VecMat.htm.lGoogle Scholar
Index Terms
Internalizing representation independence with univalence
Recommendations
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 ...
Partial Univalence in n-truncated Type Theory
LICS '20: Proceedings of the 35th Annual ACM/IEEE Symposium on Logic in Computer ScienceIt is well known that univalence is incompatible with uniqueness of identity proofs (UIP), the axiom that all types are h-sets. This is due to finite h-sets having non-trivial automorphisms as soon as they are not h-propositions.
A natural question is ...
The Marriage of Univalence and Parametricity
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 ...






Comments