Abstract
Polymorphic type systems such as System F enjoy the parametricity property: polymorphic functions cannot inspect their type argument and will therefore apply the same algorithm to any type they are instantiated on. This idea is formalized mathematically in Reynolds's theory of relational parametricity, which allows the metatheoretical derivation of parametricity theorems about all values of a given type. Although predicative System F embeds into dependent type systems such as Martin-Löf Type Theory (MLTT), parametricity does not carry over as easily. The identity extension lemma, which is crucial if we want to prove theorems involving equality, has only been shown to hold for small types, excluding the universe.
We attribute this to the fact that MLTT uses a single type former Π to generalize both the parametric quantifier ∀ and the type former → which is non-parametric in the sense that its elements may use their argument as a value. We equip MLTT with parametric quantifiers ∀ and ∃ alongside the existing Π and Σ, and provide relation type formers for proving parametricity theorems internally. We show internally the existence of initial algebras and final co-algebras of indexed functors both by Church encoding and, for a large class of functors, by using sized types.
We prove soundness of our type system by enhancing existing iterated reflexive graph (cubical set) models of dependently typed parametricity by distinguishing between edges that express relatedness of objects (bridges) and edges that express equality (paths). The parametric functions are those that map bridges to paths.
We implement an extension to the Agda proof assistant that type-checks proofs in our type system.
Supplemental Material
Available for Download
The artifact consists of mechanized proofs corresponding to the theorems found in the paper.
- Martín Abadi, Luca Cardelli, and Pierre-Louis Curien. 1993. Formal parametric polymorphism. Theoretical Computer Science 121, 1 (1993), 9 – 58. DOI: Google Scholar
Digital Library
- Andreas Abel. 2006. A Polymorphic Lambda-Calculus with Sized Higher-Order Types. Ph.D. Dissertation. Ludwig-MaximiliansUniversität München.Google Scholar
- Andreas Abel. 2008. Polarised subtyping for sized types. Mathematical Structures in Computer Science 18, 5 (2008), 797–822. DOI: Google Scholar
Cross Ref
- Andreas Abel and Gabriel Scherer. 2012. On Irrelevance and Algorithmic Equality in Predicative Type Theory. Logical Methods in Computer Science 8, 1 (2012), 1–36. DOI: Google Scholar
Cross Ref
- Andreas M. Abel and Brigitte Pientka. 2013. Wellfounded Recursion with Copatterns: A Unified Approach to Termination and Productivity. In Proceedings of the 18th ACM SIGPLAN International Conference on Functional Programming (ICFP ’13). ACM, New York, NY, USA, 185–196. DOI: Google Scholar
Digital Library
- Thorsten Altenkirch, Paolo Capriotti, and Nicolai Kraus. 2016. Extending Homotopy Type Theory with Strict Equality. CoRR abs/1604.03799 (2016). http://arxiv.org/abs/1604.03799Google Scholar
- Thorsten Altenkirch, Neil Ghani, Peter Hancock, Conor McBride, and Peter Morris. 2006. Indexed Containers. Manuscript, available online. (February 2006).Google Scholar
- Robert Atkey. 2012. Relational Parametricity for Higher Kinds. In Computer Science Logic (CSL’12) - 26th International Workshop/21st Annual Conference of the EACSL (Leibniz International Proceedings in Informatics (LIPIcs)), Vol. 16. 46–61. DOI: Google Scholar
Cross Ref
- Robert Atkey, Neil Ghani, and Patricia Johann. 2014. A Relationally Parametric Model of Dependent Type Theory. In Principles of Programming Languages. DOI: Google Scholar
Digital Library
- Bruno Barras and Bruno Bernardo. 2008. The Implicit Calculus of Constructions as a Programming Language with Dependent Types. Springer Berlin Heidelberg, Berlin, Heidelberg, 365–379. DOI: Google Scholar
Cross Ref
- Jean-Philippe Bernardy, Thierry Coquand, and Guilhem Moulin. 2015. A Presheaf Model of Parametric Type Theory. Electron. Notes in Theor. Comput. Sci. 319 (2015), 67 – 82. DOI: Google Scholar
Digital Library
- Jean-Philippe Bernardy, Patrik Jansson, and Ross Paterson. 2012. Proofs for Free — Parametricity for Dependent Types. Journal of Functional Programming 22, 02 (2012), 107–152. DOI: Google Scholar
Digital Library
- Marc Bezem, Thierry Coquand, and Simon Huber. 2014. A Model of Type Theory in Cubical Sets. In 19th International Conference on Types for Proofs and Programs (TYPES 2013) (Leibniz International Proceedings in Informatics (LIPIcs)), Vol. 26. Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik, Dagstuhl, Germany, 107–128. DOI: Google Scholar
Cross Ref
- Cyril Cohen, Thierry Coquand, Simon Huber, and Anders Mörtberg. 2016. Cubical Type Theory: a constructive interpretation of the univalence axiom. CoRR abs/1611.02108 (2016). http://arxiv.org/abs/1611.02108Google Scholar
- Peter Dybjer. 1996. Internal type theory. Springer Berlin Heidelberg, Berlin, Heidelberg, 120–134. DOI: Google Scholar
Cross Ref
- Ryu Hasegawa. 1994. Relational limits in general polymorphism. Publications of the Research Institute for Mathematical Sciences 30 (1994), 535–576.Google Scholar
- Martin Hofmann. 1997. Syntax and semantics of dependent types. Springer London, London, Chapter 4, 13–54. DOI: Google Scholar
Cross Ref
- Martin Hofmann and Thomas Streicher. 1997. Lifting Grothendieck Universes. Unpublished note. (1997).Google Scholar
- Neelakantan R. Krishnaswami and Derek Dreyer. 2013. Internalizing Relational Parametricity in the Extensional Calculus of Constructions. In Computer Science Logic 2013 (CSL 2013) (Leibniz International Proceedings in Informatics (LIPIcs)), Vol. 23. Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik, Dagstuhl, Germany, 432–451. DOI: Google Scholar
Cross Ref
- Daniel Leivant. 1991. Finitely stratified polymorphism. Information and Computation 93, 1 (1991), 93 – 113. DOI: Google Scholar
Digital Library
- Daniel R. Licata and Robert Harper. 2011. 2-Dimensional Directed Type Theory. Electronic Notes in Theoretical Computer Science 276 (2011), 263 – 289. DOI: Google Scholar
Digital Library
- Daniel R. Licata and Michael Shulman. 2016. Adjoint Logic with a 2-Category of Modes. Springer International Publishing, 219–235. DOI: Google Scholar
Cross Ref
- Alexandre Miquel. 2001a. The Implicit Calculus of Constructions: Extending Pure Type Systems with an Intersection Type Binder and Subtyping. In Proceedings of the 5th International Conference on Typed Lambda Calculi and Applications (TLCA’01). Springer-Verlag, Berlin, Heidelberg, 344–359. http://dl.acm.org/citation.cfm?id=1754621.1754650 Google Scholar
Cross Ref
- Alexandre Miquel. 2001b. Le Calcul des Constructions Implicite: Syntaxe et Sémantique. Ph.D. Dissertation. Université Paris 7.Google Scholar
- Nathan Mishra-Linger and Tim Sheard. 2008. Erasure and Polymorphism in Pure Type Systems. Springer Berlin Heidelberg, Berlin, Heidelberg, 350–364. DOI: Google Scholar
Cross Ref
- Andreas Nuyts. 2017. A Model of Parametric Dependent Type Theory in Bridge/Path Cubical Sets. Technical Report. KU Leuven, Belgium. https://arxiv.org/abs/1706.04383Google Scholar
- Frank Pfenning. 2001. Intensionality, extensionality, and proof irrelevance in modal type theory. In Proceedings 16th Annual IEEE Symposium on Logic in Computer Science. 221–230. DOI: Google Scholar
Cross Ref
- Frank Pfenning and Rowan Davies. 2001. A judgmental reconstruction of modal logic. Mathematical Structures in Computer Science 11, 4 (2001), 511–540. DOI: Google Scholar
Digital Library
- Benjamin C. Pierce. 2002. Types and programming languages. MIT Press.Google Scholar
- Gordon Plotkin and Martín Abadi. 1993. A logic for parametric polymorphism. Springer Berlin Heidelberg, Berlin, Heidelberg, 361–375. DOI: Google Scholar
Cross Ref
- Jason Reed. 2003. Extending Higher-Order Unification to Support Proof Irrelevance. In Theorem Proving in Higher Order Logics: 16th International Conference, TPHOLs 2003, Rome, Italy, September 8-12, 2003. Proceedings, David Basin and Burkhart Wolff (Eds.). Springer Berlin Heidelberg, Berlin, Heidelberg, 238–252. DOI: Google Scholar
Cross Ref
- John C. Reynolds. 1983. Types, Abstraction and Parametric Polymorphism.. In IFIP Congress. 513–523.Google Scholar
- John C. Reynolds. 1984. Polymorphism is not set-theoretic. Research Report RR-0296. INRIA. https://hal.inria.fr/inria- 00076261Google Scholar
- Edmund P. Robinson and Giuseppe Rosolini. 1994. Reflexive graphs and parametric polymorphism. In Proceedings Ninth Annual IEEE Symposium on Logic in Computer Science. 364–371. DOI: Google Scholar
Cross Ref
- Izumi Takeuti. 2001. The Theory of Parametricity in Lambda Cube. Technical Report 1217. Kyoto University.Google Scholar
- Vladimir Voevodsky. 2013. A simple type system with two identity types. (2013). https://ncatlab.org/homotopytypetheory/ files/HTS.pdf unpublished note.Google Scholar
- Philip Wadler. 1989. Theorems for Free!. In Proceedings of the Fourth International Conference on Functional Programming Languages and Computer Architecture (FPCA ’89). ACM, New York, NY, USA, 347–359. DOI: Google Scholar
Digital Library
- Philip Wadler. 2007. The Girard-Reynolds isomorphism (second edition). Theoretical Computer Science 375, 1 (2007), 201 – 226. DOI: Google Scholar
Digital Library
Index Terms
Parametric quantifiers for dependent type theory
Recommendations
Degrees of Relatedness: A Unified Framework for Parametricity, Irrelevance, Ad Hoc Polymorphism, Intersections, Unions and Algebra in Dependent Type Theory
LICS '18: Proceedings of the 33rd Annual ACM/IEEE Symposium on Logic in Computer ScienceDependent type theory allows us to write programs and to prove properties about those programs in the same language. However, some properties do not require much proof, as they are evident from a program's implementation, e.g. if a polymorphic program ...
Decidability of conversion for type theory in type theory
Type theory should be able to handle its own meta-theory, both to justify its foundational claims and to obtain a verified implementation. At the core of a type checker for intensional type theory lies an algorithm to check equality of types, or in ...
A Presheaf Model of Parametric Type Theory
We extend Martin-Löf's Logical Framework with special constructions and typing rules providing internalized parametricity. Compared to previous similar proposals, this version comes with a denotational semantics which is a refinement of the standard ...






Comments