skip to main content
research-article
Open Access
Artifacts Available
Artifacts Evaluated & Reusable

Parametric quantifiers for dependent type theory

Published:29 August 2017Publication History
Skip Abstract Section

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.

Skip Supplemental Material Section

Supplemental Material

References

  1. Martín Abadi, Luca Cardelli, and Pierre-Louis Curien. 1993. Formal parametric polymorphism. Theoretical Computer Science 121, 1 (1993), 9 – 58. DOI: Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Andreas Abel. 2006. A Polymorphic Lambda-Calculus with Sized Higher-Order Types. Ph.D. Dissertation. Ludwig-MaximiliansUniversität München.Google ScholarGoogle Scholar
  3. Andreas Abel. 2008. Polarised subtyping for sized types. Mathematical Structures in Computer Science 18, 5 (2008), 797–822. DOI: Google ScholarGoogle ScholarCross RefCross Ref
  4. 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 ScholarGoogle ScholarCross RefCross Ref
  5. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  6. 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 ScholarGoogle Scholar
  7. Thorsten Altenkirch, Neil Ghani, Peter Hancock, Conor McBride, and Peter Morris. 2006. Indexed Containers. Manuscript, available online. (February 2006).Google ScholarGoogle Scholar
  8. 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 ScholarGoogle ScholarCross RefCross Ref
  9. Robert Atkey, Neil Ghani, and Patricia Johann. 2014. A Relationally Parametric Model of Dependent Type Theory. In Principles of Programming Languages. DOI: Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. 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 ScholarGoogle ScholarCross RefCross Ref
  11. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  12. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  13. 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 ScholarGoogle ScholarCross RefCross Ref
  14. 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 ScholarGoogle Scholar
  15. Peter Dybjer. 1996. Internal type theory. Springer Berlin Heidelberg, Berlin, Heidelberg, 120–134. DOI: Google ScholarGoogle ScholarCross RefCross Ref
  16. Ryu Hasegawa. 1994. Relational limits in general polymorphism. Publications of the Research Institute for Mathematical Sciences 30 (1994), 535–576.Google ScholarGoogle Scholar
  17. Martin Hofmann. 1997. Syntax and semantics of dependent types. Springer London, London, Chapter 4, 13–54. DOI: Google ScholarGoogle ScholarCross RefCross Ref
  18. Martin Hofmann and Thomas Streicher. 1997. Lifting Grothendieck Universes. Unpublished note. (1997).Google ScholarGoogle Scholar
  19. 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 ScholarGoogle ScholarCross RefCross Ref
  20. Daniel Leivant. 1991. Finitely stratified polymorphism. Information and Computation 93, 1 (1991), 93 – 113. DOI: Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Daniel R. Licata and Robert Harper. 2011. 2-Dimensional Directed Type Theory. Electronic Notes in Theoretical Computer Science 276 (2011), 263 – 289. DOI: Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Daniel R. Licata and Michael Shulman. 2016. Adjoint Logic with a 2-Category of Modes. Springer International Publishing, 219–235. DOI: Google ScholarGoogle ScholarCross RefCross Ref
  23. 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 ScholarGoogle ScholarCross RefCross Ref
  24. Alexandre Miquel. 2001b. Le Calcul des Constructions Implicite: Syntaxe et Sémantique. Ph.D. Dissertation. Université Paris 7.Google ScholarGoogle Scholar
  25. Nathan Mishra-Linger and Tim Sheard. 2008. Erasure and Polymorphism in Pure Type Systems. Springer Berlin Heidelberg, Berlin, Heidelberg, 350–364. DOI: Google ScholarGoogle ScholarCross RefCross Ref
  26. 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 ScholarGoogle Scholar
  27. 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 ScholarGoogle ScholarCross RefCross Ref
  28. Frank Pfenning and Rowan Davies. 2001. A judgmental reconstruction of modal logic. Mathematical Structures in Computer Science 11, 4 (2001), 511–540. DOI: Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Benjamin C. Pierce. 2002. Types and programming languages. MIT Press.Google ScholarGoogle Scholar
  30. Gordon Plotkin and Martín Abadi. 1993. A logic for parametric polymorphism. Springer Berlin Heidelberg, Berlin, Heidelberg, 361–375. DOI: Google ScholarGoogle ScholarCross RefCross Ref
  31. 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 ScholarGoogle ScholarCross RefCross Ref
  32. John C. Reynolds. 1983. Types, Abstraction and Parametric Polymorphism.. In IFIP Congress. 513–523.Google ScholarGoogle Scholar
  33. John C. Reynolds. 1984. Polymorphism is not set-theoretic. Research Report RR-0296. INRIA. https://hal.inria.fr/inria- 00076261Google ScholarGoogle Scholar
  34. 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 ScholarGoogle ScholarCross RefCross Ref
  35. Izumi Takeuti. 2001. The Theory of Parametricity in Lambda Cube. Technical Report 1217. Kyoto University.Google ScholarGoogle Scholar
  36. Vladimir Voevodsky. 2013. A simple type system with two identity types. (2013). https://ncatlab.org/homotopytypetheory/ files/HTS.pdf unpublished note.Google ScholarGoogle Scholar
  37. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  38. Philip Wadler. 2007. The Girard-Reynolds isomorphism (second edition). Theoretical Computer Science 375, 1 (2007), 201 – 226. DOI: Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Parametric quantifiers for dependent type theory

              Recommendations

              Comments

              Login options

              Check if you have access through your login credentials or your institution to get full access on this article.

              Sign in

              Full Access

              PDF Format

              View or Download as a PDF file.

              PDF

              eReader

              View online with eReader.

              eReader
              About Cookies On This Site

              We use cookies to ensure that we give you the best experience on our website.

              Learn more

              Got it!