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

Intrinsically-typed definitional interpreters à la carte

Published: 31 October 2022 Publication History

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.
[2]
Amal Jamil Ahmed. 2004. Semantics of Types for Mutable State. Ph.D. Dissertation. USA. AAI3136691.
[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.
[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.
[5]
Thorsten Altenkirch, Neil Ghani, Peter G. Hancock, Conor McBride, and Peter Morris. 2015. Indexed containers. J. Funct. Program. 25 (2015).
[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.
[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.
[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.
[9]
Patrick Bahr and Tom Hvitved. 2012. Parametric Compositional Data Types. In Proceedings Fourth Workshop on Mathematically Structured Functional Programming, MSFP@ETAPS 2012, Tallinn, Estonia, 25 March 2012 (EPTCS), James Chapman and Paul Blain Levy (Eds.), Vol. 76. 3–24.
[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
[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.
[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
[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.
[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.
[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.
[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.
[17]
Jesper Cockx. 2017. Dependent Pattern Matching and Proof-Relevant Unification. (2017). https://lirias.kuleuven.be/handle/123456789/583556
[18]
Thierry Coquand. 1992. Pattern matching with dependent types. In Proceedings of the Workshop on Types for Proofs and Programs. Citeseer, 71–83.
[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
[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
[21]
Pierre-Évariste Dagand. 2017. The essence of ornaments. J. Funct. Program. 27 (2017), e9.
[22]
Pierre-Évariste Dagand and Conor McBride. 2014. Transporting functions across ornaments. J. Funct. Program. 24, 2-3 (2014), 316–383.
[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.
[24]
Benjamin Delaware, Steven Keuchel, Tom Schrijvers, and Bruno C. d. S. Oliveira. 2013. Modular monadic meta-theory. (2013), 319–330.
[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.
[26]
Robert Harper. 1994. A Simplified Account of Polymorphic References. Inf. Process. Lett. 51, 4 (1994), 201–206.
[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.
[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.
[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.
[30]
Hsiang-Shang Ko and Jeremy Gibbons. 2017. Programming with ornaments. J. Funct. Program. 27 (2017), e2.
[31]
Saul A Kripke. 1963. Semantical analysis of modal logic i normal modal propositional calculi. Mathematical Logic Quarterly 9, 5-6 (1963), 67–96.
[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
[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.
[34]
Conor McBride. 2011. Ornamental Algebras, Algebraic Ornaments. (2011). Unpublished manuscript.
[35]
Lambert G. L. T. Meertens. 1992. Paramorphisms. Formal Aspects Comput. 4, 5 (1992), 413–424.
[36]
Robin Milner. 1978. A Theory of Type Polymorphism in Programming. J. Comput. Syst. Sci. 17, 3 (1978), 348–375.
[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.
[38]
Eugenio Moggi. 1991. Notions of Computation and Monads. Inf. Comput. 93, 1 (1991), 55–92.
[39]
Peter D. Mosses. 2004. Modular structural operational semantics. J. Log. Algebraic Methods Program. 60-61 (2004), 195–228.
[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
[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.
[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.
[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, Scala@ECOOP 2019, London, UK, July 17, 2019, Jonathan Immanuel Brachthäuser, Sukyoung Ryu, and Nathaniel Nystrom (Eds.). ACM, 12–16.
[44]
Benjamin C. Pierce. 2002. Types and programming languages. MIT Press. isbn:978-0-262-16209-8
[45]
Cas van der Rest, Casper Bach Poulsen, Arjen Rouvoet, Eelco Visser, and Peter Mosses. 2022. Intrinsically-Typed Definitional Interpreters à la Carte (artifact).
[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.
[47]
Wouter Swierstra. 2008. Data types à la carte. J. Funct. Program. 18, 4 (2008), 423–436.
[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.
[49]
Philip Wadler, Wen Kokke, and Jeremy G. Siek. 2020. Programming Language Foundations in Agda. http://plfa.inf.ed.ac.uk/20.07/
[50]
Andrew K. Wright and Matthias Felleisen. 1994. A Syntactic Approach to Type Soundness. Inf. Comput. 115, 1 (1994), 38–94.
[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.
[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.

Cited By

View all
  • (2025)Progressful Interpreters for Efficient WebAssembly MechanisationProceedings of the ACM on Programming Languages10.1145/37048589:POPL(627-655)Online publication date: 9-Jan-2025
  • (2024)Type Inference LogicsProceedings of the ACM on Programming Languages10.1145/36897868:OOPSLA2(2125-2155)Online publication date: 8-Oct-2024
  • (2024)Intrinsically Typed Syntax, a Logical Relation, and the Scourge of the Transfer LemmaProceedings of the 9th ACM SIGPLAN International Workshop on Type-Driven Development10.1145/3678000.3678201(2-15)Online publication date: 28-Aug-2024
  • Show More Cited By

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 OOPSLA2
October 2022
1932 pages
EISSN:2475-1421
DOI:10.1145/3554307
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 October 2022
Published in PACMPL Volume 6, Issue OOPSLA2

Permissions

Request permissions for this article.

Check for updates

Badges

Author Tags

  1. Definitional Interpreters
  2. Dependently Typed Programming
  3. Modularity
  4. Reuse
  5. Type Safety

Qualifiers

  • Research-article

Funding Sources

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)438
  • Downloads (Last 6 weeks)61
Reflects downloads up to 11 Jan 2025

Other Metrics

Citations

Cited By

View all
  • (2025)Progressful Interpreters for Efficient WebAssembly MechanisationProceedings of the ACM on Programming Languages10.1145/37048589:POPL(627-655)Online publication date: 9-Jan-2025
  • (2024)Type Inference LogicsProceedings of the ACM on Programming Languages10.1145/36897868:OOPSLA2(2125-2155)Online publication date: 8-Oct-2024
  • (2024)Intrinsically Typed Syntax, a Logical Relation, and the Scourge of the Transfer LemmaProceedings of the 9th ACM SIGPLAN International Workshop on Type-Driven Development10.1145/3678000.3678201(2-15)Online publication date: 28-Aug-2024
  • (2023)Extensible Metatheory Mechanization via Family PolymorphismProceedings of the ACM on Programming Languages10.1145/35912867:PLDI(1608-1632)Online publication date: 6-Jun-2023
  • (2023)Towards the Complexity Analysis of Programming Language Proof MethodsTheoretical Aspects of Computing – ICTAC 202310.1007/978-3-031-47963-2_8(100-118)Online publication date: 4-Dec-2023

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Login options

Full Access

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media