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.
- Michael Gordon Abbott, Thorsten Altenkirch, and Neil Ghani. 2005. Containers: Constructing strictly positive types. Theor. Comput. Sci. 342, 1 (2005), 3–27.
Google Scholar
Digital Library
- Amal Jamil Ahmed. 2004. Semantics of Types for Mutable State. Ph.D. Dissertation. USA. AAI3136691.
Google Scholar
Digital Library
- 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 Scholar
Cross Ref
- 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 Scholar
Digital Library
- Thorsten Altenkirch, Neil Ghani, Peter G. Hancock, Conor McBride, and Peter Morris. 2015. Indexed containers. J. Funct. Program. 25 (2015).
Google Scholar
Cross Ref
- 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 Scholar
Digital Library
- 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 Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Cross Ref
- 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 Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Cross Ref
- 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 Scholar
Cross Ref
- 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 Scholar
Digital Library
- Jesper Cockx. 2017. Dependent Pattern Matching and Proof-Relevant Unification. (2017). https://lirias.kuleuven.be/handle/123456789/583556
Google Scholar
- Thierry Coquand. 1992. Pattern matching with dependent types. In Proceedings of the Workshop on Types for Proofs and Programs. Citeseer, 71–83.
Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
- Pierre-Évariste Dagand. 2017. The essence of ornaments. J. Funct. Program. 27 (2017), e9.
Google Scholar
Cross Ref
- Pierre-Évariste Dagand and Conor McBride. 2014. Transporting functions across ornaments. J. Funct. Program. 24, 2-3 (2014), 316–383.
Google Scholar
Cross Ref
- 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 Scholar
Digital Library
- Benjamin Delaware, Steven Keuchel, Tom Schrijvers, and Bruno C. d. S. Oliveira. 2013. Modular monadic meta-theory. (2013), 319–330.
Google Scholar
Digital Library
- 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 Scholar
Digital Library
- Robert Harper. 1994. A Simplified Account of Polymorphic References. Inf. Process. Lett. 51, 4 (1994), 201–206.
Google Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- Hsiang-Shang Ko and Jeremy Gibbons. 2017. Programming with ornaments. J. Funct. Program. 27 (2017), e2.
Google Scholar
Cross Ref
- Saul A Kripke. 1963. Semantical analysis of modal logic i normal modal propositional calculi. Mathematical Logic Quarterly 9, 5-6 (1963), 67–96.
Google Scholar
Cross Ref
- 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 Scholar
Digital Library
- 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 Scholar
Cross Ref
- Conor McBride. 2011. Ornamental Algebras, Algebraic Ornaments. (2011). Unpublished manuscript.
Google Scholar
- Lambert G. L. T. Meertens. 1992. Paramorphisms. Formal Aspects Comput. 4, 5 (1992), 413–424.
Google Scholar
Digital Library
- Robin Milner. 1978. A Theory of Type Polymorphism in Programming. J. Comput. Syst. Sci. 17, 3 (1978), 348–375.
Google Scholar
Cross Ref
- 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 Scholar
- Eugenio Moggi. 1991. Notions of Computation and Monads. Inf. Comput. 93, 1 (1991), 55–92.
Google Scholar
Digital Library
- Peter D. Mosses. 2004. Modular structural operational semantics. J. Log. Algebraic Methods Program. 60-61 (2004), 195–228.
Google Scholar
Cross Ref
- 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 Scholar
Cross Ref
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- Benjamin C. Pierce. 2002. Types and programming languages. MIT Press. isbn:978-0-262-16209-8
Google Scholar
Digital Library
- Cas van der Rest, Casper Bach Poulsen, Arjen Rouvoet, Eelco Visser, and Peter Mosses. 2022. Intrinsically-Typed Definitional Interpreters à la Carte (artifact).
Google Scholar
Cross Ref
- 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 Scholar
Digital Library
- Wouter Swierstra. 2008. Data types à la carte. J. Funct. Program. 18, 4 (2008), 423–436.
Google Scholar
Digital Library
- 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 Scholar
Cross Ref
- Philip Wadler, Wen Kokke, and Jeremy G. Siek. 2020. Programming Language Foundations in Agda. http://plfa.inf.ed.ac.uk/20.07/
Google Scholar
- Andrew K. Wright and Matthias Felleisen. 1994. A Syntactic Approach to Type Soundness. Inf. Comput. 115, 1 (1994), 38–94.
Google Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
Index Terms
Intrinsically-typed definitional interpreters à la carte
Recommendations
Intrinsically-typed definitional interpreters for imperative languages
A definitional interpreter defines the semantics of an object language in terms of the (well-known) semantics of a host language, enabling understanding and validation of the semantics through execution. Combining a definitional interpreter with a ...
Intrinsically-typed definitional interpreters for linear, session-typed languages
CPP 2020: Proceedings of the 9th ACM SIGPLAN International Conference on Certified Programs and ProofsAn intrinsically-typed definitional interpreter is a concise specification of dynamic semantics, that is executable and type safe by construction. Unfortunately, scaling intrinsically-typed definitional interpreters to more complicated object languages ...
Tagless staged interpreters for typed languages
Multi-stage programming languages provide a convenient notation for explicitly staging programs. Staging a definitional interpreter for a domain specific language is one way of deriving an implementation that is both readable and efficient. In an ...






Comments