skip to main content

Intrinsically-typed definitional interpreters à la carte

Published:31 October 2022Publication History
Skip Abstract Section

Abstract

Specifying and mechanically verifying type safe programming languages requires significant effort. This effort can in theory be reduced by defining and reusing pre-verified, modular components. In practice, however, existing approaches to modular mechanical verification require many times as much specification code as plain, monolithic definitions. This makes it hard to develop new reusable components, and makes existing component specifications hard to grasp. We present an alternative approach based on intrinsically-typed interpreters, which reduces the size and complexity of modular specifications as compared to existing approaches. Furthermore, we introduce a new abstraction for safe-by-construction specification and composition of pre-verified type safe language components: language fragments. Language fragments are about as concise and easy to develop as plain, monolithic intrinsically-typed interpreters, but require about 10 times less code than previous approaches to modular mechanical verification of type safety.

References

  1. Michael Gordon Abbott, Thorsten Altenkirch, and Neil Ghani. 2005. Containers: Constructing strictly positive types. Theor. Comput. Sci. 342, 1 (2005), 3–27. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Amal Jamil Ahmed. 2004. Semantics of Types for Mutable State. Ph.D. Dissertation. USA. AAI3136691. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Amal J. Ahmed, Andrew W. Appel, and Roberto Virga. 2002. A Stratified Semantics of General References A Stratified Semantics of General References. In 17th IEEE Symposium on Logic in Computer Science (LICS 2002), 22-25 July 2002, Copenhagen, Denmark, Proceedings. IEEE Computer Society, 75. Google ScholarGoogle ScholarCross RefCross Ref
  4. Guillaume Allais, Robert Atkey, James Chapman, Conor McBride, and James McKinna. 2018. A type and scope safe universe of syntaxes with binding: their semantics and proofs. Proc. ACM Program. Lang. 2, ICFP (2018), 90:1–90:30. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Thorsten Altenkirch, Neil Ghani, Peter G. Hancock, Conor McBride, and Peter Morris. 2015. Indexed containers. J. Funct. Program. 25 (2015). Google ScholarGoogle ScholarCross RefCross Ref
  6. Nada Amin and Tiark Rompf. 2017. Type soundness proofs with definitional interpreters. In Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages, POPL 2017, Paris, France, January 18-20, 2017, Giuseppe Castagna and Andrew D. Gordon (Eds.). ACM, 666–679. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Lennart Augustsson and Magnus Carlsson. 1999. An exercise in dependent types: A well-typed interpreter. In In Workshop on Dependent Types in Programming, Gothenburg. Google ScholarGoogle Scholar
  8. Casper Bach Poulsen, Arjen Rouvoet, Andrew Tolmach, Robbert Krebbers, and Eelco Visser. 2018. Intrinsically-typed definitional interpreters for imperative languages. Proc. ACM Program. Lang. 2, POPL (2018), 16:1–16:34. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Patrick Bahr and Tom Hvitved. 2012. Parametric Compositional Data Types. In Proceedings Fourth Workshop on Mathematically Structured Functional Programming, [email protected] 2012, Tallinn, Estonia, 25 March 2012 (EPTCS), James Chapman and Paul Blain Levy (Eds.), Vol. 76. 3–24. Google ScholarGoogle ScholarCross RefCross Ref
  10. Birthe van den Berg, Tom Schrijvers, Casper Bach Poulsen, and Nicolas Wu. 2021. Latent Effects for Reusable Language Components: Extended Version. CoRR abs/2108.11155 (2021). arxiv:2108.11155 https://arxiv.org/abs/2108.11155 Google ScholarGoogle Scholar
  11. Jacques Carette, Oleg Kiselyov, and Chung-chieh Shan. 2009. Finally tagless, partially evaluated: Tagless staged interpreters for simpler typed languages. J. Funct. Program. 19, 5 (2009), 509–543. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. James Chapman, Pierre-Évariste Dagand, Conor McBride, and Peter Morris. 2010. The gentle art of levitation. In Proceeding of the 15th ACM SIGPLAN international conference on Functional programming, ICFP 2010, Baltimore, Maryland, USA, September 27-29, 2010, Paul Hudak and Stephanie Weirich (Eds.). ACM, 3–14. isbn:978-1-60558-794-3 Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Adam Chlipala. 2008. Parametric higher-order abstract syntax for mechanized semantics. 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, 143–156. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Martin Churchill and Peter D. Mosses. 2013. Modular Bisimulation Theory for Computations and Values. In FOSSACS 2013 (LNCS), Frank Pfenning (Ed.), Vol. 7794. Springer, 97–112. Google ScholarGoogle ScholarCross RefCross Ref
  15. Martin Churchill, Peter D. Mosses, Neil Sculthorpe, and Paolo Torrini. 2015. Reusable Components of Semantic Specifications. LNCS Trans. Aspect Oriented Softw. Dev. 12 (2015), 132–179. Google ScholarGoogle ScholarCross RefCross Ref
  16. Matteo Cimini, Dale Miller, and Jeremy G. Siek. 2020. Extrinsically typed operational semantics for functional languages. In Proceedings of the 13th ACM SIGPLAN International Conference on Software Language Engineering, SLE 2020, Virtual Event, USA, November 16-17, 2020, Ralf Lämmel, Laurence Tratt, and Juan de Lara (Eds.). ACM, 108–125. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Jesper Cockx. 2017. Dependent Pattern Matching and Proof-Relevant Unification. (2017). https://lirias.kuleuven.be/handle/123456789/583556 Google ScholarGoogle Scholar
  18. Thierry Coquand. 1992. Pattern matching with dependent types. In Proceedings of the Workshop on Types for Proofs and Programs. Citeseer, 71–83. Google ScholarGoogle Scholar
  19. Bruno C. d. S. Oliveira and William R. Cook. 2012. Extensibility for the Masses - Practical Extensibility with Object Algebras. In ECOOP 2012 - Object-Oriented Programming - 26th European Conference, Beijing, China, June 11-16, 2012. Proceedings (Lecture Notes in Computer Science), James Noble (Ed.), Vol. 7313. Springer, 2–27. isbn:978-3-642-31056-0 Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Pierre-Évariste Dagand. 2013. A cosmology of datatypes : reusability and dependent types. Ph.D. Dissertation. University of Strathclyde, Glasgow, UK. http://oleg.lib.strath.ac.uk/R/?func=dbin-jump-full&object_id=22713 Google ScholarGoogle Scholar
  21. Pierre-Évariste Dagand. 2017. The essence of ornaments. J. Funct. Program. 27 (2017), e9. Google ScholarGoogle ScholarCross RefCross Ref
  22. Pierre-Évariste Dagand and Conor McBride. 2014. Transporting functions across ornaments. J. Funct. Program. 24, 2-3 (2014), 316–383. Google ScholarGoogle ScholarCross RefCross Ref
  23. Benjamin Delaware, Bruno C. d. S. Oliveira, and Tom Schrijvers. 2013. Meta-theory à la carte. In The 40th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL ’13, Rome, Italy - January 23 - 25, 2013, Roberto Giacobazzi and Radhia Cousot (Eds.). ACM, 207–218. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Benjamin Delaware, Steven Keuchel, Tom Schrijvers, and Bruno C. d. S. Oliveira. 2013. Modular monadic meta-theory. (2013), 319–330. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Dominique Devriese and Frank Piessens. 2011. On the bright side of type classes: instance arguments in Agda. In ACM SIGPLAN international conference on Functional Programming (ICFP). 143–155. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Robert Harper. 1994. A Simplified Account of Polymorphic References. Inf. Process. Lett. 51, 4 (1994), 201–206. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Steven Keuchel and Tom Schrijvers. 2013. Generic datatypes à la carte. In Proceedings of the 9th ACM SIGPLAN workshop on Generic programming, WGP 2013, Boston, Massachusetts, USA, September 28, 2013, Jacques Carette and Jeremiah Willcock (Eds.). ACM, 13–24. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Oleg Kiselyov and Hiromi Ishii. 2015. Freer monads, more extensible effects. In Proceedings of the 8th ACM SIGPLAN Symposium on Haskell, Haskell 2015, Vancouver, BC, Canada, September 3-4, 2015, Ben Lippmeier (Ed.). ACM, 94–105. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Oleg Kiselyov, Amr Sabry, and Cameron Swords. 2013. Extensible effects: an alternative to monad transformers. In Proceedings of the 2013 ACM SIGPLAN Symposium on Haskell, Boston, MA, USA, September 23-24, 2013, Chung-chieh Shan (Ed.). ACM, 59–70. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Hsiang-Shang Ko and Jeremy Gibbons. 2017. Programming with ornaments. J. Funct. Program. 27 (2017), e2. Google ScholarGoogle ScholarCross RefCross Ref
  31. Saul A Kripke. 1963. Semantical analysis of modal logic i normal modal propositional calculi. Mathematical Logic Quarterly 9, 5-6 (1963), 67–96. Google ScholarGoogle ScholarCross RefCross Ref
  32. Sheng Liang, Paul Hudak, and Mark P. Jones. 1995. Monad Transformers and Modular Interpreters. In Conference Record of POPL’95: 22nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, San Francisco, California, USA, January 23-25, 1995, Ron K. Cytron and Peter Lee (Eds.). ACM Press, 333–343. isbn:0-89791-692-1 Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. Ken Madlener, Sjaak Smetsers, and Marko C. J. D. van Eekelen. 2011. Formal Component-Based Semantics. In Proceedings Eight Workshop on Structural Operational Semantics 2011, SOS 2011, Aachen, Germany, 5th September 2011 (EPTCS), Michel A. Reniers and Pawel Sobocinski (Eds.), Vol. 62. 17–29. Google ScholarGoogle ScholarCross RefCross Ref
  34. Conor McBride. 2011. Ornamental Algebras, Algebraic Ornaments. (2011). Unpublished manuscript. Google ScholarGoogle Scholar
  35. Lambert G. L. T. Meertens. 1992. Paramorphisms. Formal Aspects Comput. 4, 5 (1992), 413–424. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. Robin Milner. 1978. A Theory of Type Polymorphism in Programming. J. Comput. Syst. Sci. 17, 3 (1978), 348–375. Google ScholarGoogle ScholarCross RefCross Ref
  37. Eugenio Moggi. 1989. Computational Lambda-Calculus and Monads. In Proceedings of the Fourth Annual Symposium on Logic in Computer Science (LICS ’89), Pacific Grove, California, USA, June 5-8, 1989. IEEE Computer Society, 14–23. Google ScholarGoogle Scholar
  38. Eugenio Moggi. 1991. Notions of Computation and Monads. Inf. Comput. 93, 1 (1991), 55–92. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. Peter D. Mosses. 2004. Modular structural operational semantics. J. Log. Algebraic Methods Program. 60-61 (2004), 195–228. Google ScholarGoogle ScholarCross RefCross Ref
  40. Ulf Norell. 2008. Dependently Typed Programming in Agda. In Advanced Functional Programming, 6th International School, AFP 2008, Heijen, The Netherlands, May 2008, Revised Lectures (Lecture Notes in Computer Science), Pieter W. M. Koopman, Rinus Plasmeijer, and S. Doaitse Swierstra (Eds.), Vol. 5832. Springer, 230–266. isbn:978-3-642-04651-3 Google ScholarGoogle ScholarCross RefCross Ref
  41. Ulf Norell. 2009. Dependently typed programming in Agda. In Proceedings of TLDI’09: 2009 ACM SIGPLAN International Workshop on Types in Languages Design and Implementation, Savannah, GA, USA, January 24, 2009, Andrew Kennedy and Amal Ahmed (Eds.). ACM, 1–2. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. Scott Owens, Magnus O. Myreen, Ramana Kumar, and Yong Kiam Tan. 2016. Functional Big-Step Semantics. In Programming Languages and Systems - 25th European Symposium on Programming, ESOP 2016, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2016, Eindhoven, The Netherlands, April 2-8, 2016, Proceedings (Lecture Notes in Computer Science), Peter Thiemann (Ed.), Vol. 9632. Springer, 589–615. Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. Lionel Parreaux, Aleksander Boruch-Gruszecki, and Paolo G. Giarrusso. 2019. Towards improved GADT reasoning in Scala. In Proceedings of the Tenth ACM SIGPLAN Symposium on Scala, [email protected] 2019, London, UK, July 17, 2019, Jonathan Immanuel Brachthäuser, Sukyoung Ryu, and Nathaniel Nystrom (Eds.). ACM, 12–16. Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. Benjamin C. Pierce. 2002. Types and programming languages. MIT Press. isbn:978-0-262-16209-8 Google ScholarGoogle ScholarDigital LibraryDigital Library
  45. Cas van der Rest, Casper Bach Poulsen, Arjen Rouvoet, Eelco Visser, and Peter Mosses. 2022. Intrinsically-Typed Definitional Interpreters à la Carte (artifact). Google ScholarGoogle ScholarCross RefCross Ref
  46. Christopher Schwaab and Jeremy G. Siek. 2013. Modular type-safety proofs in Agda. In Proceedings of the 7th Workshop on Programming languages meets program verification, PLPV 2013, Rome, Italy, January 22, 2013, Matthew Might, David Van Horn, Andreas Abel, and Tim Sheard (Eds.). ACM, 3–12. Google ScholarGoogle ScholarDigital LibraryDigital Library
  47. Wouter Swierstra. 2008. Data types à la carte. J. Funct. Program. 18, 4 (2008), 423–436. Google ScholarGoogle ScholarDigital LibraryDigital Library
  48. Paolo Torrini and Tom Schrijvers. 2015. Reasoning about modular datatypes with Mendler induction. In Proceedings Tenth International Workshop on Fixed Points in Computer Science, FICS 2015, Berlin, Germany, September 11-12, 2015 (EPTCS), Ralph Matthes and Matteo Mio (Eds.), Vol. 191. 143–157. Google ScholarGoogle ScholarCross RefCross Ref
  49. Philip Wadler, Wen Kokke, and Jeremy G. Siek. 2020. Programming Language Foundations in Agda. http://plfa.inf.ed.ac.uk/20.07/ Google ScholarGoogle Scholar
  50. Andrew K. Wright and Matthias Felleisen. 1994. A Syntactic Approach to Type Soundness. Inf. Comput. 115, 1 (1994), 38–94. Google ScholarGoogle ScholarDigital LibraryDigital Library
  51. Li-yao Xia, Yannick Zakowski, Paul He, Chung-Kil Hur, Gregory Malecha, Benjamin C. Pierce, and Steve Zdancewic. 2020. Interaction trees: representing recursive and impure programs in Coq. Proc. ACM Program. Lang. 4, POPL (2020), 51:1–51:32. Google ScholarGoogle ScholarDigital LibraryDigital Library
  52. Yannick Zakowski, Calvin Beck, Irene Yoon, Ilia Zaichuk, Vadim Zaliva, and Steve Zdancewic. 2021. Modular, compositional, and executable formal semantics for LLVM IR. Proc. ACM Program. Lang. 5, ICFP (2021), 1–30. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Intrinsically-typed definitional interpreters à la carte

      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!