skip to main content

Label dependent lambda calculus and gradual typing

Published:15 October 2021Publication History
Skip Abstract Section

Abstract

Dependently-typed programming languages are gaining importance, because they can guarantee a wide range of properties at compile time. Their use in practice is often hampered because programmers have to provide very precise types. Gradual typing is a means to vary the level of typing precision between program fragments and to transition smoothly towards more precisely typed programs. The combination of gradual typing and dependent types seems promising to promote the widespread use of dependent types.

We investigate a gradual version of a minimalist value-dependent lambda calculus. Compile-time calculations and thus dependencies are restricted to labels, drawn from a generic enumeration type. The calculus supports the usual Pi and Sigma types as well as singleton types and subtyping. It is sufficiently powerful to provide flexible encodings of variant and record types with first-class labels.

We provide type checking algorithms for the underlying label-dependent lambda calculus and its gradual extension. The gradual type checker drives the translation into a cast calculus, which extends the original language. The cast calculus comes with several innovations: refined typing for casts in the presence of singletons, type reduction in casts, and fully dependent Sigma types. Besides standard metatheoretical results, we establish the gradual guarantee for the gradual language.

Skip Supplemental Material Section

Supplemental Material

Auxiliary Presentation Video

This is a presentation video of the talk given at OOPSLA 2021 accompanying the paper "Label Dependent Lambda Calculus and Gradual Typing".

References

  1. Amal Ahmed, Robert Bruce Findler, Jeremy G. Siek, and Philip Wadler. 2011. Blame For All. In Proceedings of the 38th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, Thomas Ball and Mooly Sagiv (Eds.). ACM, Austin, TX, USA. 201–214.Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. David Aspinall. 1994. Subtyping with Singleton Types. In Computer Science Logic, CSL’94 (LNCS, Vol. 933). Springer, Kazimierz, Poland. 1–15.Google ScholarGoogle ScholarCross RefCross Ref
  3. David Aspinall and Adriana B. Compagnoni. 2001. Subtyping Dependent Types. Theoretical Computer Science, 266, 1-2 (2001), 273–309. https://doi.org/10.1016/S0304-3975(00)00175-4 Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Yves Bertot and Pierre Castéran. 2004. Interactive Theorem Proving and Program Development. Coq’Art: The Calculus of Inductive Constructions. Springer. isbn:978-3-642-05880-6Google ScholarGoogle Scholar
  5. Edwin Brady. 2013. Idris, A General-Purpose Dependently Typed Programming Language: Design and Implementation. J. Funct. Program., 23, 5 (2013), 552–593. https://doi.org/10.1017/S095679681300018X Google ScholarGoogle ScholarCross RefCross Ref
  6. Chris Casinghino, Vilhelm Sjöberg, and Stephanie Weirich. 2014. Combining Proofs and Programs in a Dependently Typed Language. In POPL, Suresh Jagannathan and Peter Sewell (Eds.). ACM, San Diego, CA, USA. 33–46. isbn:978-1-4503-2544-8 https://doi.org/10.1145/2535838.2535883 Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Giuseppe Castagna and Victor Lanvin. 2017. Gradual Typing with Union and Intersection Types. PACMPL, 1, ICFP (2017), 41:1–41:28. https://doi.org/10.1145/3110285 Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Matteo Cimini and Jeremy G. Siek. 2016. The Gradualizer: a Methodology and Algorithm for Generating Gradual Type Systems. In POPL. ACM, 443–455.Google ScholarGoogle Scholar
  9. Thierry Coquand and Gérard Huet. 1988. The Calculus of Constructions. Information and Computation, 76, 2/3 (1988), 95–120.Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Pierre-Évariste Dagand, Nicolas Tabareau, and Éric Tanter. 2018. Foundations of Dependent Interoperability. J. Funct. Program., 28 (2018), e9. https://doi.org/10.1017/S0956796818000011 Google ScholarGoogle ScholarCross RefCross Ref
  11. Jan de Muijnck-Hughes, Edwin C. Brady, and Wim Vanderbauwhede. 2019. Value-Dependent Session Design in a Dependently Typed Language. In Proceedings Programming Language Approaches to Concurrency- and Communication-cEntric Software, [email protected] 2019, Prague, Czech Republic, 7th April 2019, Francisco Martins and Dominic Orchard (Eds.) (EPTCS, Vol. 291). 47–59. https://doi.org/10.4204/EPTCS.291.5 Google ScholarGoogle ScholarCross RefCross Ref
  12. Joseph Eremondi, Éric Tanter, and Ronald Garcia. 2019. Approximate Normalization for Gradual Dependent Types. Proc. ACM Program. Lang., 3, ICFP (2019), 88:1–88:30. https://doi.org/10.1145/3341692 Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Ronald Garcia, Alison M. Clark, and Éric Tanter. 2016. Abstracting Gradual Typing. In POPL. ACM, 429–442.Google ScholarGoogle Scholar
  14. Fritz Henglein. 1994. Dynamic Typing: Syntax and Proof Theory. Science of Computer Programming, 22 (1994), 197–230.Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Atsushi Igarashi, Peter Thiemann, Vasco T. Vasconcelos, and Philip Wadler. 2017. Gradual Session Types. Proc. ACM Program. Lang., 1, ICFP (2017), Article 38, Sept., 28 pages. https://doi.org/10.1145/3110282 Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Yuu Igarashi, Taro Sekiyama, and Atsushi Igarashi. 2017. On Polymorphic Gradual Typing. PACMPL, 1, ICFP (2017), 40:1–40:29. https://doi.org/10.1145/3110284 Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Koen Jacobs, Amin Timany, and Dominique Devriese. 2021. Fully Abstract from Static to Gradual. Proc. ACM Program. Lang., 5, POPL (2021), 1–30. https://doi.org/10.1145/3434288 Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Kenneth L. Knowles and Cormac Flanagan. 2010. Hybrid type checking. ACM Trans. Program. Lang. Syst., 32, 2 (2010), 6:1–6:34.Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Fabian Krause, Weili Fu, and Peter Thiemann. 2021. Artifact for Label Dependent Lambda Calculus and Gradual Typing. https://doi.org/10.5281/zenodo.5497628 Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Nico Lehmann and Éric Tanter. 2017. Gradual Refinement Types. In POPL. ACM, Paris, France. 775–788.Google ScholarGoogle Scholar
  21. Meven Lennon-Bertrand, Kenji Maillard, Nicolas Tabareau, and Éric Tanter. 2020. Gradualizing the Calculus of Inductive Constructions. CoRR, abs/2011.10618 (2020), arxiv:2011.10618. arxiv:2011.10618Google ScholarGoogle Scholar
  22. Per Martin-Löf. 1984. Intuitionistic Type Theory. Bibliopolis, Napoli.Google ScholarGoogle Scholar
  23. Max S. New and Amal Ahmed. 2018. Graduality from Embedding-Projection Pairs. Proc. ACM Program. Lang., 2, ICFP (2018), 73:1–73:30. https://doi.org/10.1145/3236768 Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Max S. New and Daniel R. Licata. 2020. Call-by-name Gradual Type Theory. Logical Methods in Computer Science, Volume 16, Issue 1 (2020), Jan., https://doi.org/10.23638/LMCS-16(1:7)2020 Google ScholarGoogle ScholarCross RefCross Ref
  25. Susumu Nishimura. 1998. Static Typing for Dynamic Messages. In Proc. 25th ACM Symp. POPL, Luca Cardelli (Ed.). ACM Press, San Diego, CA, USA. 266–278. isbn:0-89791-979-3 https://doi.org/10.1145/268946.268968 Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Ulf Norell. 2008. Dependently Typed Programming in Agda. In Advanced Functional Programming, Pieter W. M. Koopman, Rinus Plasmeijer, and S. Doaitse Swierstra (Eds.) (LNCS, Vol. 5832). Springer, Heijen, The Netherlands. 230–266. isbn:978-3-642-04651-3Google ScholarGoogle Scholar
  27. Xinming Ou, Gang Tan, Yitzhak Mandelbaum, and David Walker. 2004. Dynamic Typing with Dependent Types. In IFIP TCS, Jean-Jacques Lévy, Ernst W. Mayr, and John C. Mitchell (Eds.). Kluwer, 437–450. isbn:1-4020-8140-5Google ScholarGoogle Scholar
  28. Benjamin C. Pierce and David N. Turner. 2000. Local Type Inference. ACM TOPLAS, 22, 1 (2000), 1–44. issn:0164-0925 https://doi.org/10.1145/345099.345100 Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Felipe Bañados Schwerter, Ronald Garcia, and Éric Tanter. 2014. A theory of gradual effect systems. In Proceedings of the 19th ACM SIGPLAN international conference on Functional programming, Gothenburg, Sweden, September 1-3, 2014, Johan Jeuring and Manuel M. T. Chakravarty (Eds.). ACM, Gothenburg, Sweden. 283–295. isbn:978-1-4503-2873-9 https://doi.org/10.1145/2628136.2628149 Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Jeremy Siek and Walid Taha. 2007. Gradual Typing for Objects. In 21st ECOOP, Erik Ernst (Ed.) (LNCS, Vol. 4609). Springer, Berlin, Germany. 2–27. isbn:978-3-540-73588-5 https://doi.org/10.1007/978-3-540-73589-2_2 Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Jeremy Siek, Peter Thiemann, and Philip Wadler. 2015. Blame and Coercion: Together Again for the First Time. In PLDI, Steve Blackburn (Ed.). ACM, Portland, OR, USA. 425–435. isbn:978-1-4503-3468-6 https://doi.org/10.1145/2737924.2737968 Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. Jeremy G. Siek and Walid Taha. 2006. Gradual Typing for Functional Languages. In Scheme and Functional Programming Workshop.Google ScholarGoogle Scholar
  33. Jeremy G. Siek and Manish Vachharajani. 2008. Gradual Typing with Unification-Based Inference. In Proceedings of the 2008 Symposium on Dynamic Languages, DLS 2008, July 8, 2008, Paphos, Cyprus, Johan Brichau (Ed.). ACM, 7. https://doi.org/10.1145/1408681.1408688 Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. Jeremy G. Siek, Michael M. Vitousek, Matteo Cimini, and John Tang Boyland. 2015. Refined Criteria for Gradual Typing. In SNAPL (LIPIcs, Vol. 32). Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, 274–293.Google ScholarGoogle Scholar
  35. Jeremy G. Siek and Philip Wadler. 2010. Threesomes, With and Without Blame. In Proc. 37th ACM Symp. POPL. ACM Press, Madrid, Spain. 365–376. isbn:978-1-60558-479-9 https://doi.org/10.1145/1706299.1706342 Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. Vilhelm Sjöberg, Chris Casinghino, Ki Yung Ahn, Nathan Collins, Harley D. Eades III, Peng Fu, Garrin Kimmell, Tim Sheard, Aaron Stump, and Stephanie Weirich. 2012. Irrelevance, Heterogeneous Equality, and Call-by-value Dependent Type Systems. In Proceedings Fourth Workshop on Mathematically Structured Functional Programming, James Chapman and Paul Blain Levy (Eds.) (EPTCS, Vol. 76). Tallinn, Estonia. 112–162. https://doi.org/10.4204/EPTCS.76.9 Google ScholarGoogle ScholarCross RefCross Ref
  37. Christopher Stone. 2000. Singleton Kinds and Singleton Types. Ph.D. Dissertation. School of Computer Science, CMU.Google ScholarGoogle Scholar
  38. Christopher A. Stone and Robert Harper. 2006. Extensional Equivalence and Singleton Types. ACM Trans. Comput. Log., 7, 4 (2006), 676–722. https://doi.org/10.1145/1183278.1183281 Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. Nikhil Swamy, Juan Chen, Cédric Fournet, Pierre-Yves Strub, Karthikeyan Bhargavan, and Jean Yang. 2013. Secure Distributed Programming With Value-Dependent Types. J. Funct. Program., 23, 4 (2013), 402–451. https://doi.org/10.1017/S0956796813000142 Google ScholarGoogle ScholarCross RefCross Ref
  40. Nikhil Swamy, Cédric Fournet, Aseem Rastogi, Karthikeyan Bhargavan, Juan Chen, Pierre-Yves Strub, and Gavin M. Bierman. 2014. Gradual Typing Embedded Securely in JavaScript. In POPL. ACM, 425–438.Google ScholarGoogle Scholar
  41. Éric Tanter and Nicolas Tabareau. 2015. Gradual Certified Programming in Coq. In Proceedings of the 11th Symposium on Dynamic Languages, DLS 2015, part of SPLASH 2015, Pittsburgh, PA, USA, October 25-30, 2015, Manuel Serrano (Ed.). ACM, 26–40. https://doi.org/10.1145/2816707.2816710 Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. Peter Thiemann and Vasco T. Vasconcelos. 2020. Label-Dependent Session Types. Proc. ACM Program. Lang., 4, POPL (2020), 67:1–67:29. https://doi.org/10.1145/3371135 Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. Matías Toro, Ronald Garcia, and Éric Tanter. 2018. Type-Driven Gradual Security with References. ACM Trans. Program. Lang. Syst., 40, 4 (2018), 16:1–16:55. https://doi.org/10.1145/3229061 Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. 2021. TypeScript Handbook, Advanced Types. https://www.typescriptlang.org/docs/handbook/advanced-types.htmlGoogle ScholarGoogle Scholar
  45. Philip Wadler and Robert Bruce Findler. 2009. Well-Typed Programs Can’t Be Blamed. In Programming Languages and Systems, 18th European Symposium on Programming, ESOP 2009, Giuseppe Castagna (Ed.) (Lecture Notes in Computer Science, Vol. 5502). Springer, York, UK. 1–16. isbn:978-3-642-00589-3 https://doi.org/10.1007/978-3-642-00590-9 Google ScholarGoogle ScholarCross RefCross Ref
  46. Stephanie Weirich, Pritam Choudhury, Antoine Voizard, and Richard A. Eisenberg. 2019. A Role for Dependent Types in Haskell. Proc. ACM Program. Lang., 3, ICFP (2019), 101:1–101:29. https://doi.org/10.1145/3341705 Google ScholarGoogle ScholarDigital LibraryDigital Library
  47. Hongwei Xi and Frank Pfenning. 1999. Dependent Types in Practical Programming. In Proc. 26th ACM Symp. POPL, Alexander Aiken (Ed.). ACM Press, San Antonio, Texas, USA. 214–227. isbn:1-58113-095-3Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Label dependent lambda calculus and gradual typing

      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

      • Article Metrics

        • Downloads (Last 12 months)152
        • Downloads (Last 6 weeks)10

        Other Metrics

      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!