Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
research-article
Open access

Parametric quantifiers for dependent type theory

Published: 29 August 2017 Publication History

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.

Supplementary Material

Auxiliary Archive (icfp17-main41-s.zip)
The artifact consists of mechanized proofs corresponding to the theorems found in the paper.

References

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

Cited By

View all
  • (2025)BiSikkel: A Multimode Logical Framework in AgdaProceedings of the ACM on Programming Languages10.1145/37048449:POPL(210-240)Online publication date: 9-Jan-2025
  • (2024)Internal Parametricity, without an IntervalProceedings of the ACM on Programming Languages10.1145/36329208:POPL(2340-2369)Online publication date: 5-Jan-2024
  • (2024)Internal and Observational Parametricity for Cubical AgdaProceedings of the ACM on Programming Languages10.1145/36328508:POPL(209-240)Online publication date: 5-Jan-2024
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image Proceedings of the ACM on Programming Languages
Proceedings of the ACM on Programming Languages  Volume 1, Issue ICFP
September 2017
1173 pages
EISSN:2475-1421
DOI:10.1145/3136534
Issue’s Table of Contents
This work is licensed under a Creative Commons Attribution-NoDerivs International 4.0 License.

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 29 August 2017
Published in PACMPL Volume 1, Issue ICFP

Permissions

Request permissions for this article.

Check for updates

Badges

Author Tags

  1. Agda
  2. Parametricity
  3. cubical type theory
  4. presheaf semantics
  5. sized types

Qualifiers

  • Research-article

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)136
  • Downloads (Last 6 weeks)19
Reflects downloads up to 18 Feb 2025

Other Metrics

Citations

Cited By

View all
  • (2025)BiSikkel: A Multimode Logical Framework in AgdaProceedings of the ACM on Programming Languages10.1145/37048449:POPL(210-240)Online publication date: 9-Jan-2025
  • (2024)Internal Parametricity, without an IntervalProceedings of the ACM on Programming Languages10.1145/36329208:POPL(2340-2369)Online publication date: 5-Jan-2024
  • (2024)Internal and Observational Parametricity for Cubical AgdaProceedings of the ACM on Programming Languages10.1145/36328508:POPL(209-240)Online publication date: 5-Jan-2024
  • (2021)Logical Relations as Types: Proof-Relevant Parametricity for Program ModulesJournal of the ACM10.1145/347483468:6(1-47)Online publication date: 5-Oct-2021
  • (2021)Internalizing representation independence with univalenceProceedings of the ACM on Programming Languages10.1145/34342935:POPL(1-30)Online publication date: 4-Jan-2021
  • (2021)The Marriage of Univalence and ParametricityJournal of the ACM10.1145/342997968:1(1-44)Online publication date: 15-Jan-2021
  • (2021)Graded Modal Dependent Type TheoryProgramming Languages and Systems10.1007/978-3-030-72019-3_17(462-490)Online publication date: 23-Mar-2021
  • (2020)Multimodal Dependent Type TheoryProceedings of the 35th Annual ACM/IEEE Symposium on Logic in Computer Science10.1145/3373718.3394736(492-506)Online publication date: 8-Jul-2020
  • (2020)Leibniz equality is isomorphic to Martin-Löf identity, parametricallyJournal of Functional Programming10.1017/S095679682000015530Online publication date: 17-Jun-2020
  • (2019)A role for dependent types in HaskellProceedings of the ACM on Programming Languages10.1145/33417053:ICFP(1-29)Online publication date: 26-Jul-2019
  • Show More Cited By

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Login options

Full Access

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media