Abstract
Gradual dependent types can help with the incremental adoption of dependently typed code by providing a principled semantics for imprecise types and proofs, where some parts have been omitted. Current theories of gradual dependent types, though, lack a central feature of type theory: propositional equality. Lennon-Bertrand et al. show that, when the reflexive proof refl is the only closed value of an equality type, a gradual extension of the Calculus of Inductive Constructions (CIC) with propositional equality violates static observational equivalences. Extensionally-equal functions should be indistinguishable at run time, but they can be distinguished using a combination of equality and type imprecision.
This work presents a gradual dependently typed language that supports propositional equality. We avoid the above issues by devising an equality type of which refl is not the only closed inhabitant. Instead, each equality proof is accompanied by a term that is at least as precise as the equated terms, acting as a witness of their plausible equality. These witnesses track partial type information as a program runs, raising errors when that information shows that two equated terms are undeniably inconsistent. Composition of type information is internalized as a construct of the language, and is deferred for function bodies whose evaluation is blocked by variables. We thus ensure that extensionally-equal functions compose without error, thereby preventing contexts from distinguishing them. We describe the challenges of designing consistency and precision relations for this system, along with solutions to these challenges. Finally, we prove important metatheory: type safety, conservative embedding of CIC, weak canonicity, and the gradual guarantees of Siek et al., which ensure that reducing a program’s precision introduces no new static or dynamic errors.
- Thorsten Altenkirch, Conor McBride, and Wouter Swierstra. 2007. Observational Equality, Now!. In Proceedings of the 2007 Workshop on Programming Languages Meets Program Verification (PLPV ’07). ACM, New York, NY, USA. 57–68. isbn:978-1-59593-677-6 https://doi.org/10.1145/1292597.1292608
Google Scholar
Digital Library
- Felipe Bañados Schwerter, Alison M. Clark, Khurram A. Jafery, and Ronald Garcia. 2021. Abstracting Gradual Typing Moving Forward: Precise and Space-Efficient. Proc. ACM Program. Lang., 5, POPL (2021), Article 61, Jan., 28 pages. https://doi.org/10.1145/3434342
Google Scholar
Digital Library
- Edwin Brady. 2017. Type-driven development with Idris. Manning. isbn:9781617293023 https://www.manning.com/books/type-driven-development-with-idris
Google Scholar
- Pierre-Évariste Dagand, Nicolas Tabareau, and Éric Tanter. 2016. Partial Type Equivalences for Verified Dependent Interoperability. In Proceedings of the 21st ACM SIGPLAN Conference on Functional Programming (ICFP 2016). ACM Press, Nara, Japan. 298–310. https://doi.org/10.1145/2951913.2951933
Google Scholar
Digital Library
- Pierre-Évariste Dagand, Nicolas Tabareau, and Éric Tanter. 2018. Foundations of dependent interoperability. Journal of Functional Programming, 28 (2018), e9. https://doi.org/10.1017/S0956796818000011
Google Scholar
Cross Ref
- Joseph Eremondi, Ronald Garcia, and Éric Tanter. 2022. Propositional Equality for Gradual Dependently Typed Programming (Extended Technical Report). https://doi.org/10.48550/ARXIV.2205.01241
Google Scholar
- Joseph Eremondi, Éric Tanter, and Ronald Garcia. 2019. Approximate Normalization for Gradual Dependent Types. Proc. ACM Program. Lang., 3, ICFP (2019), Article 88, July, 30 pages. issn:2475-1421 https://doi.org/10.1145/3341692
Google Scholar
Digital Library
- Robert Bruce Findler and Matthias Felleisen. 2002. Contracts for Higher-order Functions. In Proceedings of the Seventh ACM SIGPLAN International Conference on Functional Programming (ICFP ’02). ACM, New York, NY, USA. 48–59. isbn:1-58113-487-8 https://doi.org/10.1145/581478.581484
Google Scholar
Digital Library
- Ronald Garcia, Alison M. Clark, and Éric Tanter. 2016. Abstracting Gradual Typing. In Proceedings of the 43rd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’16). ACM, New York, NY, USA. 429–442. isbn:978-1-4503-3549-2 https://doi.org/10.1145/2837614.2837670
Google Scholar
Digital Library
- Healfdene Goguen, Conor McBride, and James McKinna. 2006. Eliminating Dependent Pattern Matching. Springer Berlin Heidelberg, Berlin, Heidelberg. 521–540. isbn:978-3-540-35464-2 https://doi.org/10.1007/11780274_27
Google Scholar
Cross Ref
- Martin Hofmann and Thomas Streicher. 1998. The groupoid interpretation of type theory. Twenty-five years of constructive type theory (Venice, 1995), 36 (1998), 83–111. https://doi.org/10.1093/oso/9780198501275.003.0008
Google Scholar
Cross Ref
- Koen Jacobs, Amin Timany, and Dominique Devriese. 2021. Fully Abstract from Static to Gradual. Proc. ACM Program. Lang., 5, POPL (2021), Article 7, Jan., 30 pages. https://doi.org/10.1145/3434288
Google Scholar
Digital Library
- Nico Lehmann and Éric Tanter. 2017. Gradual Refinement Types. In Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages (POPL 2017). ACM, New York, NY, USA. 775–788. isbn:978-1-4503-4660-3 https://doi.org/10.1145/3009837.3009856
Google Scholar
Digital Library
- Mark Lemay. 2022. A Dependently Typed Programming Language With Dynamic Equality. Ph. D. Dissertation. Boston University. https://github.com/marklemay/thesis
Google Scholar
- Meven Lennon-Bertrand. 2021. Complete Bidirectional Typing for the Calculus of Inductive Constructions. In 12th International Conference on Interactive Theorem Proving (ITP 2021), Liron Cohen and Cezary Kaliszyk (Eds.) (Leibniz International Proceedings in Informatics (LIPIcs), Vol. 193). Schloss Dagstuhl – Leibniz-Zentrum für Informatik. isbn:978-3-95977-188-7 issn:1868-8969 https://doi.org/10.4230/LIPIcs.ITP.2021.24
Google Scholar
Cross Ref
- Meven Lennon-Bertrand, Kenji Maillard, Nicolas Tabareau, and Éric Tanter. 2022. Gradualizing the Calculus of Inductive Constructions. ACM Trans. Program. Lang. Syst., 44, 2 (2022), Article 7, apr, 82 pages. issn:0164-0925 https://doi.org/10.1145/3495528
Google Scholar
Digital Library
- Kenji Maillard, Meven Lennon-Bertrand, Nicolas Tabareau, and Éric Tanter. 2022. A Reasonably Gradual Type Theory. Proc. ACM Program. Lang., 6, ICFP (2022), https://doi.org/10.1145/3547655 Preprint:
Google Scholar
Digital Library
- Per Martin-Löf. 1975. About Models for Intuitionistic Type Theories and the Notion of Definitional Equality. In Proceedings of the Third Scandinavian Logic Symposium, Stig Kanger (Ed.) (Studies in Logic and the Foundations of Mathematics, Vol. 82). Elsevier, 81 – 109. issn:0049-237X https://doi.org/10.1016/S0049-237X(08)70727-4
Google Scholar
Cross Ref
- Per Martin-Löf. 1982. Constructive Mathematics and Computer Programming. In Logic, Methodology and Philosophy of Science VI, L. Jonathan Cohen, Jerzy Łoś, Helmut Pfeiffer, and Klaus-Peter Podewski (Eds.) (Studies in Logic and the Foundations of Mathematics, Vol. 104). Elsevier, 153–175. issn:0049-237X https://doi.org/10.1016/S0049-237X(09)70189-2
Google Scholar
Cross Ref
- Conor McBride. 2000. Dependently typed functional programs and their proofs. Ph. D. Dissertation. University of Edinburgh, UK. http://hdl.handle.net/1842/374
Google Scholar
- Conor McBride. 2002. Elimination with a Motive. In Types for Proofs and Programs, Paul Callaghan, Zhaohui Luo, James McKinna, Robert Pollack, and Robert Pollack (Eds.) (Lecture Notes in Computer Science). Springer, 197–216. isbn:9783540458425 https://doi.org/10.1007/3-540-45842-5_13
Google Scholar
Cross Ref
- Max S. New and Amal Ahmed. 2018. Graduality from Embedding-Projection Pairs. Proc. ACM Program. Lang., 2, ICFP (2018), Article 73, July, 30 pages. https://doi.org/10.1145/3236768
Google Scholar
Digital Library
- Peter-Michael Osera, Vilhelm Sjöberg, and Steve Zdancewic. 2012. Dependent Interoperability. In Proceedings of the Sixth Workshop on Programming Languages Meets Program Verification (PLPV ’12). ACM, New York, NY, USA. 3–14. isbn:978-1-4503-1125-0 https://doi.org/10.1145/2103776.2103779
Google Scholar
Digital Library
- Xinming Ou, Gang Tan, Yitzhak Mandelbaum, and David Walker. 2004. Dynamic Typing with Dependent Types. In Exploring New Frontiers of Theoretical Informatics, Jean-Jacques Levy, Ernst W. Mayr, and John C. Mitchell (Eds.). Springer US, Boston, MA. 437–450. isbn:978-1-4020-8141-5 https://doi.org/10.1007/1-4020-8141-3_34
Google Scholar
Cross Ref
- Loïc Pujet and Nicolas Tabareau. 2022. Observational Equality: Now for Good. Proc. ACM Program. Lang., 6, POPL (2022), Article 32, jan, 27 pages. https://doi.org/10.1145/3498693
Google Scholar
Digital Library
- Jeremy Siek, Peter Thiemann, and Philip Wadler. 2015. Blame and Coercion: Together Again for the First Time. In Proceedings of the 36th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI ’15). Association for Computing Machinery, New York, NY, USA. 425–435. isbn:9781450334686 https://doi.org/10.1145/2737924.2737968
Google Scholar
Digital Library
- Jeremy G. Siek and Tianyu Chen. 2021. Parameterized cast calculi and reusable meta-theory for gradually typed lambda calculi. Journal of Functional Programming, 31 (2021), e30. https://doi.org/10.1017/S0956796821000241
Google Scholar
Cross Ref
- Jeremy G. Siek and Walid Taha. 2006. Gradual Typing for Functional Languages. In Scheme and Functional Programming Workshop. 81–92. http://scheme2006.cs.uchicago.edu/scheme2006.pdf
Google Scholar
- Jeremy G. Siek, Michael M. Vitousek, Matteo Cimini, and John Tang Boyland. 2015. Refined Criteria for Gradual Typing. In 1st Summit on Advances in Programming Languages (SNAPL 2015), Thomas Ball, Rastislav Bodik, Shriram Krishnamurthi, Benjamin S. Lerner, and Greg Morrisett (Eds.) (Leibniz International Proceedings in Informatics (LIPIcs), Vol. 32). Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik, Dagstuhl, Germany. 274–293. isbn:978-3-939897-80-4 issn:1868-8969 https://doi.org/10.4230/LIPIcs.SNAPL.2015.274
Google Scholar
Cross Ref
- Jeremy G. Siek and Philip Wadler. 2010. Threesomes, with and Without Blame. In Proceedings of the 37th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’10). ACM, New York, NY, USA. 365–376. isbn:978-1-60558-479-9 https://doi.org/10.1145/1706299.1706342
Google Scholar
Digital Library
- Thomas Streicher. 1993. Investigations into intensional type theory. Ph. D. Dissertation. Ludwig Maximilian Universität. https://www2.mathematik.tu-darmstadt.de/~streicher/HabilStreicher.pdf Habilitation thesis
Google Scholar
- M. Takahashi. 1995. Parallel Reductions in λ -Calculus. Information and Computation, 118, 1 (1995), 120–127. issn:0890-5401 https://doi.org/10.1006/inco.1995.1057
Google Scholar
Digital Library
- Éric Tanter and Nicolas Tabareau. 2015. Gradual Certified Programming in Coq. In Proceedings of the 11th Symposium on Dynamic Languages (DLS 2015). ACM, New York, NY, USA. 26–40. isbn:978-1-4503-3690-1 https://doi.org/10.1145/2816707.2816710
Google Scholar
Digital Library
- Philip Wadler and Robert Bruce Findler. 2009. Well-Typed Programs Can’t Be Blamed. In Proceedings of the 18th European Symposium on Programming Languages and Systems: Held as Part of the Joint European Conferences on Theory and Practice of Software, ETAPS 2009 (ESOP ’09). Springer-Verlag, Berlin, Heidelberg. 1–16. isbn:9783642005893 https://doi.org/10.1007/978-3-642-00590-9_1
Google Scholar
Digital Library
- A.K. Wright and M. Felleisen. 1994. A Syntactic Approach to Type Soundness. Information and Computation, 115, 1 (1994), 38–94. issn:0890-5401 https://doi.org/10.1006/inco.1994.1093
Google Scholar
Digital Library
- Jakub Zalewski, James McKinna, J. Garrett Morris, and Philip Wadler. 2020. λ dB: Blame tracking at higher fidelity. https://wgt20.irif.fr/wgt20-final98-acmpaginated.pdf First ACM SIGPLAN Workshop on Gradual Typing 2020, WGT 2020 ; Conference date: 19-01-2020 Through 25-01-2020
Google Scholar
Index Terms
Propositional equality for gradual dependently typed programming
Recommendations
A reasonably gradual type theory
Gradualizing the Calculus of Inductive Constructions (CIC) involves dealing with subtle tensions between normalization, graduality, and conservativity with respect to CIC. Recently, GCIC has been proposed as a parametrized gradual type theory that ...
Dependently typed programming in Agda
TLDI '09: Proceedings of the 4th international workshop on Types in language design and implementationDependently typed languages have for a long time been used to describe proofs about programs. Traditionally, dependent types are used mostly for stating and proving the properties of the programs and not in defining the programs themselves. An ...
Approximate normalization for gradual dependent types
Dependent types help programmers write highly reliable code. However, this reliability comes at a cost: it can be challenging to write new prototypes in (or migrate old code to) dependently-typed programming languages. Gradual typing makes static type ...






Comments