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

A reasonably gradual type theory

Published: 31 August 2022 Publication History
  • Get Citation Alerts
  • Abstract

    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 admits three variants, each sacrificing one of these properties. For devising a gradual proof assistant based on CIC, normalization and conservativity with respect to CIC are key, but the tension with graduality needs to be addressed. Additionally, several challenges remain: (1) The presence of two wildcard terms at any type---the error and unknown terms---enables trivial proofs of any theorem, jeopardizing the use of a gradual type theory in a proof assistant; (2) Supporting general indexed inductive families, most prominently equality, is an open problem; (3) Theoretical accounts of gradual typing and graduality so far do not support handling type mismatches detected during reduction; (4) Precision and graduality are external notions not amenable to reasoning within a gradual type theory. All these issues manifest primally in CastCIC, the cast calculus used to define GCIC. In this work, we present an extension of CastCIC called GRIP. GRIP is a reasonably gradual type theory that addresses the issues above, featuring internal precision and general exception handling. By adopting a novel interpretation of the unknown term that carefully accounts for universe levels, GRIP satisfies graduality for a large and well-defined class of terms, in addition to being normalizing and a conservative extension of CIC. Internal precision supports reasoning about graduality within GRIP itself, for instance to characterize gradual exception-handling terms, and supports gradual subset types. We develop the metatheory of GRIP using a model formalized in Coq, and provide a prototype implementation of GRIP in Agda.

    References

    [1]
    Andreas Abel and Gabriel Scherer. 2012. On Irrelevance and Algorithmic Equality in Predicative Type Theory. Logical Methods in Computer Science, Volume 8, Issue 1 (2012), 3, https://doi.org/10.2168/LMCS-8(1:29)2012
    [2]
    Thorsten Altenkirch, Neil Ghani, Peter G. Hancock, Conor McBride, and Peter Morris. 2015. Indexed containers. J. Funct. Program., 25 (2015), https://doi.org/10.1017/S095679681500009X
    [3]
    Thorsten Altenkirch, Conor McBride, and Wouter Swierstra. 2007. Observational equality, now!. In Proceedings of the Workshop on Programming Languages meets Program Verification (PLPV 2007). 57–68. https://doi.org/10.1145/1292597.1292608
    [4]
    Jean-Philippe Bernardy, Patrik Jansson, and Ross Paterson. 2012. Proofs for free: Parametricity for dependent types. Journal of Functional Programming, 22, 2 (2012), March, 107–152. https://doi.org/10.1017/S0956796812000056
    [5]
    2016. Proceedings of the 43rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2016), Rastislav Bodík and Rupak Majumdar (Eds.). ACM Press, St Petersburg, FL, USA. isbn:978-1-4503-3549-2 https://doi.org/10.1145/2837614
    [6]
    Simon Boulier, Pierre-Marie Pédrot, and Nicolas Tabareau. 2017. The next 700 syntactical models of type theory. In Proceedings of the 6th ACM SIGPLAN Conference on Certified Programs and Proofs, CPP 2017, Paris, France, January 16-17, 2017. 182–194. https://doi.org/10.1145/3018610.3018620
    [7]
    Chris Casinghino, Vilhelm Sjöberg, and Stephanie Weirich. 2014. Combining proofs and programs in a dependently typed language. In Proceedings of the 41st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2014). ACM Press, San Diego, CA, USA. 671–684. isbn:978-1-4503-2544-8 https://doi.org/10.1145/2535838.2535883
    [8]
    Cyril Cohen, Thierry Coquand, Simon Huber, and Anders Mörtberg. 2017. Cubical Type Theory: A Constructive Interpretation of the Univalence Axiom. FLAP, 4, 10 (2017), 3127–3170. http://collegepublications.co.uk/ifcolog/?00019
    [9]
    Pierre-Évariste Dagand, Nicolas Tabareau, and Éric Tanter. 2018. Foundations of Dependent Interoperability. Journal of Functional Programming, 28 (2018), 9:1–9:44. https://doi.org/10.1017/S0956796818000011
    [10]
    Richard A. Eisenberg. 2016. Dependent Types in Haskell: Theory and Practice. arxiv:1610.07978.
    [11]
    Joseph Eremondi, Ronald Garcia, and Éric Tanter. 2022. Propositional Equality for Gradual Dependently-Typed Programming. Proceedings of the ACM on Programming Languages, 6, ICFP (2022), Sept., https://doi.org/10.1145/3547627
    [12]
    Joseph Eremondi, Éric Tanter, and Ronald Garcia. 2019. Approximate Normalization for Gradual Dependent Types. 88:1–88:30. https://doi.org/10.1145/3341692
    [13]
    Ronald Garcia, Alison M. Clark, and Éric Tanter. 2016. Abstracting Gradual Typing. 429–442. isbn:978-1-4503-3549-2 https://doi.org/10.1145/2837614 See erratum: https://www.cs.ubc.ca/ rxg/agt-erratum.pdf.
    [14]
    Gaëtan Gilbert, Jesper Cockx, Matthieu Sozeau, and Nicolas Tabareau. 2019. Definitional Proof-Irrelevance without K. Proceedings of the ACM on Programming Languages, 3, POPL (2019), Jan., 1–28. https://doi.org/10.1145/3290316
    [15]
    2020. LICS ’20: 35th Annual ACM/IEEE Symposium on Logic in Computer Science, Saarbrücken, Germany, July 8-11, 2020, Holger Hermanns, Lijun Zhang, Naoki Kobayashi, and Dale Miller (Eds.). ACM Press. isbn:978-1-4503-7104-9 https://doi.org/10.1145/3373718
    [16]
    Jasper Hugunin. 2020. Why Not W? In 26th International Conference on Types for Proofs and Programs, TYPES 2020, March 2-5, 2020, University of Turin, Italy, Ugo de’Liguoro, Stefano Berardi, and Thorsten Altenkirch (Eds.) (LIPIcs, Vol. 188). Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 8:1–8:9. isbn:978-3-95977-182-5 https://doi.org/10.4230/LIPIcs.TYPES.2020.8
    [17]
    2019. Proceedings of the 24th ACM SIGPLAN Conference on Functional Programming (ICFP 2019). 3, ACM Press.
    [18]
    Garrin Kimmell, Aaron Stump, Harley D. Eades III, Peng Fu, Tim Sheard, Stephanie Weirich, Chris Casinghino, Vilhelm Sjöberg, Nathan Collins, and Ki Yung Ahn. 2012. Equational reasoning about programs with general recursion and call-by-value semantics. In Proceedings of the 6th workshop on Programming Languages Meets Program Verification (PLPV 2012). ACM Press, 15–26. https://doi.org/10.1145/2103776.2103780
    [19]
    Kenneth Knowles and Cormac Flanagan. 2010. Hybrid type checking. ACM Transactions on Programming Languages and Systems, 32, 2 (2010), Jan., Article n.6. https://doi.org/10.1145/1111037.1111059
    [20]
    Bill Lawvere. 1970. Equality in hyperdoctrines and comprehension schema as an adjoint functor. In Proceedings of the AMS Symposium on Pure Mathematics XVII. 1–14.
    [21]
    Nico Lehmann and Éric Tanter. 2017. Gradual Refinement Types. In Proceedings of the 44th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2017). ACM Press, Paris, France. 775–788. https://doi.org/10.1145/3009837.3009856
    [22]
    Meven Lennon-Bertrand, Kenji Maillard, Nicolas Tabareau, and Éric Tanter. 2022. Gradualizing the Calculus of Inductive Constructions. ACM Transactions on Programming Languages and Systems, 44, 2 (2022), June, https://doi.org/10.1145/3495528
    [23]
    Per Martin-Löf. 1971. An Intuitionistic Theory of Types. Unpublished manuscript.
    [24]
    Max S. New and Amal Ahmed. 2018. Graduality from Embedding-Projection Pairs. In Proceedings of the 23rd ACM SIGPLAN Conference on Functional Programming (ICFP 2018). Proceedings of the ACM on Programming Languages, 2, 73:1–73:30. https://doi.org/10.1145/3236768
    [25]
    Peter-Michael Osera, Vilhelm Sjöberg, and Steve Zdancewic. 2012. Dependent Interoperability. In Proceedings of the 6th workshop on Programming Languages Meets Program Verification (PLPV 2012). ACM Press, 3–14. https://doi.org/10.1145/2103776.2103779
    [26]
    Xinming Ou, Gang Tan, Yitzhak Mandelbaum, and David Walker. 2004. Dynamic Typing with Dependent Types. In Proceedings of the IFIP International Conference on Theoretical Computer Science. 437–450. https://doi.org/10.1007/1-4020-8141-3_34
    [27]
    Pierre-Marie Pédrot and Nicolas Tabareau. 2017. An effectful way to eliminate addiction to dependence. In 32nd Annual ACM/IEEE Symposium on Logic in Computer Science, LICS 2017, Reykjavik, Iceland, June 20-23, 2017. IEEE Computer Society, 1–12. https://doi.org/10.1109/LICS.2017.8005113
    [28]
    Pierre-Marie Pédrot and Nicolas Tabareau. 2018. Failure is Not an Option - An Exceptional Type Theory. In Proceedings of the 27th European Symposium on Programming Languages and Systems (ESOP 2018), Amal Ahmed (Ed.) (Lecture Notes in Computer Science, Vol. 10801). Springer-Verlag, Thessaloniki, Greece. 245–271. https://doi.org/10.1007/978-3-319-89884-1_9
    [29]
    Pierre-Marie Pédrot and Nicolas Tabareau. 2020. The fire triangle: how to mix substitution, dependent elimination, and effects. Proceedings of the ACM on Programming Languages, 4, POPL (2020), Jan., 58:1–58:28. https://doi.org/10.1145/3371126
    [30]
    Pierre-Marie Pédrot, Nicolas Tabareau, Hans Fehrmann, and Éric Tanter. 2019. A Reasonably Exceptional Type Theory. 108:1–108:29. https://doi.org/10.1145/3341712
    [31]
    Loïc Pujet and Nicolas Tabareau. 2022. Observational Equality: Now For Good. Proceedings of the ACM on Programming Languages, 6, POPL (2022), Jan., https://doi.org/10.1145/3498693
    [32]
    Emily Riehl and Michael Shulman. 2017. A type theory for synthetic ∞-categories. Higher Structures, 1 (2017), 147–223 (78). issn:2209-0606
    [33]
    Patrick Maxim Rondon, Ming Kawaguchi, and Ranjit Jhala. 2008. Liquid types. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2008), Rajiv Gupta and Saman P. Amarasinghe (Eds.). ACM Press, 159–169. https://doi.org/10.1145/1375581.1375602
    [34]
    Christian Sattler and Andrea Vezzosi. 2020. Partial Univalence in n-truncated Type Theory. 807–819. isbn:978-1-4503-7104-9 https://doi.org/10.1145/3373718.3394759
    [35]
    Jeremy Siek and Walid Taha. 2006. Gradual Typing for Functional Languages. In Proceedings of the Scheme and Functional Programming Workshop. 81–92.
    [36]
    Jeremy 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 2010). ACM Press, Madrid, Spain. 365–376. https://doi.org/10.1145/1706299.1706342
    [37]
    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) (Leibniz International Proceedings in Informatics (LIPIcs), Vol. 32). Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik, Asilomar, California, USA. 274–293. https://doi.org/10.4230/LIPIcs.SNAPL.2015.274
    [38]
    Aaron Stump, Vilhelm Sjöberg, and Stephanie Weirich. 2010. Termination Casts: A Flexible Approach to Termination with General Recursion. In Proceedings Workshop on Partiality and Recursion in Interactive Theorem Provers (PAR 2010). 76–93. https://doi.org/10.29007/3w36
    [39]
    Nikhil Swamy, Catalin Hritcu, Chantal Keller, Aseem Rastogi, Antoine Delignat-Lavaud, Simon Forest, Karthikeyan Bhargavan, Cédric Fournet, Pierre-Yves Strub, Markulf Kohlweiss, Jean Karim Zinzindohoue, and Santiago Zanella Béguelin. 2016. Dependent types and multi-effects in F^⋆. 256–270. isbn:978-1-4503-3549-2 https://doi.org/10.1145/2837614
    [40]
    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
    [41]
    Éric Tanter and Nicolas Tabareau. 2015. Gradual Certified Programming in Coq. In Proceedings of the 11th ACM Dynamic Languages Symposium (DLS 2015). ACM Press, Pittsburgh, PA, USA. 26–40. https://doi.org/10.1145/2816707.2816710
    [42]
    The Coq Development Team. 2020. The Coq proof assistant reference manual. https://coq.inria.fr/refman/ Version 8.12.
    [43]
    Andrea Vezzosi, Anders Mörtberg, and Andreas Abel. 2019. Cubical Agda: A Dependently Typed Programming Language with Univalence and Higher Inductive Types. Proc. ACM Program. Lang., 3, ICFP (2019), Article 87, July, 29 pages. https://doi.org/10.1145/3341691
    [44]
    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 (ESOP 2009), Giuseppe Castagna (Ed.) (Lecture Notes in Computer Science, Vol. 5502). Springer-Verlag, York, UK. 1–16. https://doi.org/10.1007/978-3-642-00590-9_1
    [45]
    Matthew Z. Weaver and Daniel R. Licata. 2020. A Constructive Model of Directed Univalence in Bicubical Sets. 915–928. isbn:978-1-4503-7104-9 https://doi.org/10.1145/3373718.3394794
    [46]
    Hongwei Xi and Frank Pfenning. 1998. Eliminating array bound checking through dependent types. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI ’98). ACM Press, 249–257. https://doi.org/10.1145/277650.277732

    Cited By

    View all
    • (2024)Gradual Indexed Inductive TypesProceedings of the ACM on Programming Languages10.1145/36746448:ICFP(544-572)Online publication date: 15-Aug-2024
    • (2023)Live Pattern Matching with Typed HolesProceedings of the ACM on Programming Languages10.1145/35860487:OOPSLA1(609-635)Online publication date: 6-Apr-2023
    • (2022)Propositional equality for gradual dependently typed programmingProceedings of the ACM on Programming Languages10.1145/35476276:ICFP(165-193)Online publication date: 31-Aug-2022

    Recommendations

    Comments

    Information & Contributors

    Information

    Published In

    cover image Proceedings of the ACM on Programming Languages
    Proceedings of the ACM on Programming Languages  Volume 6, Issue ICFP
    August 2022
    959 pages
    EISSN:2475-1421
    DOI:10.1145/3554306
    Issue’s Table of Contents
    This work is licensed under a Creative Commons Attribution 4.0 International License.

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 31 August 2022
    Published in PACMPL Volume 6, Issue ICFP

    Permissions

    Request permissions for this article.

    Check for updates

    Badges

    Author Tags

    1. Gradual typing
    2. dependent types
    3. proof assistants

    Qualifiers

    • Research-article

    Funding Sources

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)117
    • Downloads (Last 6 weeks)31
    Reflects downloads up to 11 Aug 2024

    Other Metrics

    Citations

    Cited By

    View all
    • (2024)Gradual Indexed Inductive TypesProceedings of the ACM on Programming Languages10.1145/36746448:ICFP(544-572)Online publication date: 15-Aug-2024
    • (2023)Live Pattern Matching with Typed HolesProceedings of the ACM on Programming Languages10.1145/35860487:OOPSLA1(609-635)Online publication date: 6-Apr-2023
    • (2022)Propositional equality for gradual dependently typed programmingProceedings of the ACM on Programming Languages10.1145/35476276:ICFP(165-193)Online publication date: 31-Aug-2022

    View Options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Get Access

    Login options

    Full Access

    Media

    Figures

    Other

    Tables

    Share

    Share

    Share this Publication link

    Share on social media