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

Approximate normalization for gradual dependent types

Published:26 July 2019Publication History
Skip Abstract Section

Abstract

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 disciplines more flexible, so an appropriate notion of gradual dependent types could fruitfully lower this cost. However, dependent types raise unique challenges for gradual typing. Dependent typechecking involves the execution of program code, but gradually-typed code can signal runtime type errors or diverge. These runtime errors threaten the soundness guarantees that make dependent types so attractive, while divergence spoils the type-driven programming experience.

This paper presents GDTL, a gradual dependently-typed language that emphasizes pragmatic dependently-typed programming. GDTL fully embeds both an untyped and dependently-typed language, and allows for smooth transitions between the two. In addition to gradual types we introduce gradual terms, which allow the user to be imprecise in type indices and to omit proof terms; runtime checks ensure type safety. To account for nontermination and failure, we distinguish between compile-time normalization and run-time execution: compile-time normalization is approximate but total, while runtime execution is exact, but may fail or diverge. We prove that GDTL has decidable typechecking and satisfies all the expected properties of gradual languages. In particular, GDTL satisfies the static and dynamic gradual guarantees: reducing type precision preserves typedness, and altering type precision does not change program behavior outside of dynamic type failures. To prove these properties, we were led to establish a novel normalization gradual guarantee that captures the monotonicity of approximate normalization with respect to imprecision.

Skip Supplemental Material Section

Supplemental Material

a88-eremondi.webm

References

  1. Felipe Bañados Schwerter, Ronald Garcia, and Éric Tanter. 2016. Gradual Type-and-Effect Systems. Journal of Functional Programming 26 (Sept. 2016), 19:1–19:69.Google ScholarGoogle Scholar
  2. Yves Bertot and Pierre Castéran. 2004. Interactive Theorem Proving and Program Development. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Edwin Brady. 2013. Idris, a general-purpose dependently typed programming language: Design and implementation. Journal of Functional Programming 23, 5 (2013), 552–593.Google ScholarGoogle ScholarCross RefCross Ref
  4. Edwin Brady, Conor McBride, and James McKinna. 2003. Inductive Families Need Not Store Their Indices. In Types for Proofs and Programs, International Workshop, TYPES 2003, Torino, Italy, April 30 - May 4, 2003, Revised Selected Papers (Lecture Notes in Computer Science), Stefano Berardi, Mario Coppo, and Ferruccio Damiani (Eds.), Vol. 3085. Springer, 115–129.Google ScholarGoogle Scholar
  5. 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 ’14). ACM, New York, NY, USA, 33–45. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Iliano Cervesato and Frank Pfenning. 2003. A Linear Spine Calculus. Journal of Logic and Computation 13, 5 (2003), 639–688.Google ScholarGoogle ScholarCross RefCross Ref
  7. Chiyan Chen and Hongwei Xi. 2005. Combining Programming with Theorem Proving. In Proceedings of the Tenth ACM SIGPLAN International Conference on Functional Programming (ICFP ’05). ACM, New York, NY, USA, 66–77. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Adam Chlipala. 2013. Certified Programming with Dependent Types: A Pragmatic Introduction to the Coq Proof Assistant. The MIT Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. T. Coquand. 1986. An analysis of Girard’s paradox. Technical Report RR-0531. INRIA. https://hal.inria.fr/inria- 00076023Google ScholarGoogle Scholar
  10. Thierry Coquand and Gérard Huet. 1988. The calculus of constructions. Information and Computation 76, 2 (1988), 95 – 120. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Pierre-Evariste 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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Pierre-Évariste Dagand, Nicolas Tabareau, and Éric Tanter. 2018. Foundations of dependent interoperability. Journal of Functional Programming 28 (2018), e9.Google ScholarGoogle ScholarCross RefCross Ref
  13. Nachum Dershowitz and Zohar Manna. 1979. Proving termination with multiset orderings. In Automata, Languages and Programming, Hermann A. Maurer (Ed.). Springer Berlin Heidelberg, Berlin, Heidelberg, 188–202. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Harley Eades and Aaron Stump. 2010. Hereditary substitution for stratified system F. In International Workshop on ProofSearch in Type Theories, PST T, Vol. 10.Google ScholarGoogle Scholar
  15. Richard A. Eisenberg. 2016. Dependent Types in Haskell: Theory and Practice. arXiv: cs.PL/1610.07978Google ScholarGoogle Scholar
  16. Joseph Eremondi. 2019. Github Repository: GDTL-artifact. https://github.com/JoeyEremondi/GDTL- artifact/ .Google ScholarGoogle Scholar
  17. Joseph Eremondi, Éric Tanter, and Ronald Garcia. 2019. Approximate Normalization for Gradual Dependent Types. arXiv: 1906.06469 Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Luminous Fennell and Peter Thiemann. 2013. Gradual Security Typing with References. In Proceedings of the 26th Computer Security Foundations Symposium (CSF). 224–239. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. 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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Jean-Yves Girard. 1972. Interprétation fonctionelle et élimination des coupures de l’arithmétique d’ordre supérieur. Ph.D. Dissertation. PhD thesis, Université Paris VII.Google ScholarGoogle Scholar
  21. Ben Greenman and Matthias Felleisen. 2018. A Spectrum of Type Soundness and Performance. Proc. ACM Program. Lang. 2, ICFP, Article 71 (July 2018), 32 pages. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Robert Harper, Furio Honsell, and Gordon Plotkin. 1993. A Framework for Defining Logics. J. ACM 40, 1 (Jan. 1993), 143–184. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Robert Harper and Daniel R. Licata. 2007. Mechanizing metatheory in a logical framework. Journal of Functional Programming 17, 4-5 (2007), 613–673. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Atsushi Igarashi, Peter Thiemann, Vasco T. Vasconcelos, and Philip Wadler. 2017. Gradual Session Types. Proceedings of the ACM on Programming Languages 1, ICFP (Sept. 2017), 38:1–38:28. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Limin Jia, Jeffrey A. Vaughan, Karl Mazurak, Jianzhou Zhao, Luke Zarko, Joseph Schorr, and Steve Zdancewic. 2008. AURA: a programming language for authorization and audit. In Proceeding of the 13th ACM SIGPLAN international conference on Functional programming, ICFP 2008, Victoria, BC, Canada, September 20-28, 2008, James Hook and Peter Thiemann (Eds.). ACM, 27–38. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. 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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Andres Löh, Conor McBride, and Wouter Swierstra. 2010. A Tutorial Implementation of a Dependently Typed Lambda Calculus. Fundam. Inf. 102, 2 (April 2010), 177–207. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Cyprien Mangin and Matthieu Sozeau. 2015. Equations for Hereditary Substitution in Leivant’s Predicative System F: A Case Study. CoRR abs/1508.00455 (2015). arXiv: 1508.00455 http://arxiv.org/abs/1508.00455Google ScholarGoogle Scholar
  29. Aleksandar Nanevski, Frank Pfenning, and Brigitte Pientka. 2008. Contextual Modal Type Theory. ACM Trans. Comput. Logic 9, 3, Article 23 (June 2008), 49 pages. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Phúc C. Nguy ˜ ên, Thomas Gilray, Sam Tobin-Hochstadt, and David Van Horn. 2019. Size-change Termination As a Contract: Dynamically and Statically Enforcing Termination for Higher-order Programs. In Proceedings of the 40th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2019). ACM, New York, NY, USA, 845–859. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Ulf Norell. 2009. Dependently Typed Programming in Agda. In Proceedings of the 4th International Workshop on Types in Language Design and Implementation (TLDI ’09). ACM, New York, NY, USA, 1–2. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. Cyrus Omar, Ian Voysey, Ravi Chugh, and Matthew A. Hammer. 2019. Live functional programming with typed holes. PACMPL 3, POPL (2019), 14:1–14:32. https://dl.acm.org/citation.cfm?id=3290327 Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. 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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. 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.Google ScholarGoogle Scholar
  35. Frank Pfenning. 2008. Church and Curry: Combining intrinsic and extrinisic typing. In Reasoning in Simple Type Theory – Festschrift in Honor of Peter B. Andrews on His 70th Birthday (Studies in Logic, Mathematical Logic and Foundations), Christoph Benzmüller, Chad Brown, Jörg Siekmann, and Richard Statman (Eds.). College Publications. http://www. collegepublications.co.uk/logic/mlf/?00010Google ScholarGoogle Scholar
  36. Brigitte Pientka and Joshua Dunfield. 2008. Programming with Proofs and Explicit Contexts. In Proceedings of the 10th International ACM SIGPLAN Conference on Principles and Practice of Declarative Programming (PPDP ’08). ACM, New York, NY, USA, 163–173. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. Benjamin C. Pierce and David N. Turner. 2000. Local Type Inference. ACM Trans. Program. Lang. Syst. 22, 1 (Jan. 2000), 1–44. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. Ilya Sergey and Dave Clarke. 2012. Gradual Ownership Types. In Proceedings of the 21st European Symposium on Programming Languages and Systems (ESOP 2012) (Lecture Notes in Computer Science), Helmut Seidl (Ed.), Vol. 7211. Springer-Verlag, Tallinn, Estonia, 579–599. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. Tim Sheard and Nathan Linger. 2007. Programming in Omega. In Central European Functional Programming School, Second Summer School, CEFP 2007, Cluj-Napoca, Romania, June 23-30, 2007, Revised Selected Lectures (Lecture Notes in Computer Science), Zoltán Horváth, Rinus Plasmeijer, Anna Soós, and Viktória Zsók (Eds.), Vol. 5161. Springer, 158–227.Google ScholarGoogle Scholar
  40. Jeremy G. Siek and Walid Taha. 2006. Gradual Typing for Functional Languages. In Scheme and Functional Programming Workshop. 81–92.Google ScholarGoogle Scholar
  41. 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)), Thomas Ball, Rastislav Bodik, Shriram Krishnamurthi, Benjamin S. Lerner, and Greg Morrisett (Eds.), Vol. 32. Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik, Dagstuhl, Germany, 274–293.Google ScholarGoogle Scholar
  42. 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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. Aaron Stump. 2017. The calculus of dependent lambda eliminations. Journal of Functional Programming 27 (2017), e14.Google ScholarGoogle ScholarCross RefCross Ref
  44. Nikhil Swamy, Cătălin Hriţcu, Chantal Keller, Aseem Rastogi, Antoine Delignat-Lavaud, Simon Forest, Karthikeyan Bhargavan, Cédric Fournet, Pierre-Yves Strub, Markulf Kohlweiss, Jean-Karim Zinzindohoué, and Santiago Zanella-Béguelin. 2016. Dependent Types and Multi-Monadic Effects in F*. In 43rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL). ACM, 256–270. https://www.fstar- lang.org/papers/mumon/ Google ScholarGoogle ScholarDigital LibraryDigital Library
  45. Matías Toro, Ronald Garcia, and Éric Tanter. 2018a. Type-Driven Gradual Security with References. ACM Transactions on Programming Languages and Systems 40, 4 (Nov. 2018), 16:1–16:55. Google ScholarGoogle ScholarDigital LibraryDigital Library
  46. Matías Toro, Elizabeth Labrada, and Éric Tanter. 2018b. Gradual Parametricity, Revisited. arXiv: cs.PL/1807.04596Google ScholarGoogle Scholar
  47. Michael M. Vitousek, Cameron Swords, and Jeremy G. Siek. 2017. Big Types in Little Runtime: Open-world Soundness and Collaborative Blame for Gradual Type Systems. SIGPLAN Not. 52, 1 (Jan. 2017), 762–774.Google ScholarGoogle ScholarDigital LibraryDigital Library
  48. Philip Wadler and Robert Bruce Findler. 2009. Well-Typed Programs Can’t Be Blamed. In Programming Languages and Systems, Giuseppe Castagna (Ed.). Springer Berlin Heidelberg, Berlin, Heidelberg, 1–16. Google ScholarGoogle ScholarDigital LibraryDigital Library
  49. Kevin Watkins, Iliano Cervesato, Frank Pfenning, and David Walker. 2003. A Concurrent Logical Framework I: Judgments and Properties. Technical Report CMU-CS-02-101. https://www.cs.cmu.edu/~fp/papers/CMU- CS- 02- 101.pdf .Google ScholarGoogle Scholar
  50. Hongwei Xi and Frank Pfenning. 1999. Dependent Types in Practical Programming. In Proceedings of the 26th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’99). ACM, New York, NY, USA, 214–227. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Approximate normalization for gradual dependent types

      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!