Abstract
This paper presents 3MT, a framework for modular mechanized meta-theory of languages with effects. Using 3MT, individual language features and their corresponding definitions -- semantic functions, theorem statements and proofs-- can be built separately and then reused to create different languages with fully mechanized meta-theory. 3MT combines modular datatypes and monads to define denotational semantics with effects on a per-feature basis, without fixing the particular set of effects or language constructs.
One well-established problem with type soundness proofs for denotational semantics is that they are notoriously brittle with respect to the addition of new effects. The statement of type soundness for a language depends intimately on the effects it uses, making it particularly challenging to achieve modularity. 3MT solves this long-standing problem by splitting these theorems into two separate and reusable parts: a feature theorem that captures the well-typing of denotations produced by the semantic function of an individual feature with respect to only the effects used, and an effect theorem that adapts well-typings of denotations to a fixed superset of effects. The proof of type soundness for a particular language simply combines these theorems for its features and the combination of their effects. To establish both theorems, 3MT uses two key reasoning techniques: modular induction and algebraic laws about effects. Several effectful language features, including references and errors, illustrate the capabilities of 3MT. A case study reuses these features to build fully mechanized definitions and proofs for 28 languages, including several versions of mini-ML with effects.
- Brian E. Aydemir et al. Mechanized metatheory for the masses: The poplmark challenge. In Theorem Proving in Higher Order Logics, volume 3603 of Lecture Notes in Computer Science, pages 50--65. Springer, 2005. Google Scholar
Digital Library
- Patrick Bahr and Tom Hvitved. Compositional data types. In Proceedings of the seventh ACM SIGPLAN workshop on Generic programming, WGP '11, pages 83--94. ACM, 2011. Google Scholar
Digital Library
- Don Batory, Jongwook Kim, and Peter Hofner. Feature interactions, products, and composition. In Proceedings of the 10th ACM international conference on Generative programming and component engineering, GPCE '11. ACM, 2011. Google Scholar
Digital Library
- Andrej Bauer and Matija Pretnar. Programming with algebraic effects and handlers. CoRR, abs/1203.1539, 2012.Google Scholar
- Corrado Böhm and Alessandro Berarducci. Automatic synthesis of typed-programs on term algebras. Theoretical Computer Science, 39(0):135 -- 154, 1985.Google Scholar
Cross Ref
- Pietro Cenciarelli and Eugenio Moggi. A syntactic approach to modularity in denotational semantics. In In Proceedings of the Conference on Category Theory and Computer Science, CCTCS '93, 1993.Google Scholar
- Adam Chlipala. Parametric higher-order abstract syntax for mechanized semantics. In Proceedings of the 13th ACM SIGPLAN international conference on Functional programming, ICFP '08, pages 143--156. ACM, 2008. Google Scholar
Digital Library
- Dominique Clement, Thierry Despeyroux, Gilles Kahn, and Joelle Despeyroux. A simple applicative language: mini-ml. In Proceedings of the 1986 ACM conference on LISP and functional programming, LFP '86, pages 13--27. ACM, 1986. Google Scholar
Digital Library
- Benjamin Delaware, Bruno C. d. S. Oliveira, and Tom Schrijvers. Meta-theory a la carte. In Proceedings of the 40th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages, POPL '13, pages 207--218. ACM, 2013. Google Scholar
Digital Library
- Andrzej Filinski. Representing layered monads. In Proceedings of the 26th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, POPL '99, pages 175--188. ACM, 1999. Google Scholar
Digital Library
- Andrzej Filinski. On the relations between monadic semantics. Theor. Comput. Sci., 375(1-3):41--75, 2007. Google Scholar
Digital Library
- Andrzej Filinski. Monads in action. In Proceedings of the 37th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages, POPL '10, pages 483--494. ACM, 2010. Google Scholar
Digital Library
- Jeremy Gibbons and Ralf Hinze. Just do it: simple monadic equational reasoning. In Proceedings of the 16th ACM SIGPLAN international conference on Functional programming, ICFP '11, pages 2--14. ACM, 2011. Google Scholar
Digital Library
- Joseph A. Goguen, James W. Thatcher, Eric G. Wagner, and Jesse B. Wright. Initial algebra semantics and continuous algebras. J. ACM, 24(1), 1977. Google Scholar
Digital Library
- Georges Gonthier. Engineering mathematics: the odd order theorem proof. In Proceedings of the 40th annual ACM SIGPLANSIGACT symposium on Principles of programming languages, POPL '13, pages 1--2. ACM, 2013. Google Scholar
Digital Library
- Brian Huffman. Formal verification of monad transformers. In Proceedings of the 17th ACM SIGPLAN international conference on Functional programming, ICFP '12, pages 15--16. ACM, 2012. Google Scholar
Digital Library
- John Hughes. Generalising monads to arrows. Sci. Comput. Program., 37(1-3):67--111, 2000. Google Scholar
Digital Library
- Graham Hutton and Diana Fulger. Reasoning about effects: Seeing the wood through the trees. In Proceedings of the Ninth Symposium on Trends in Functional Programming, 2008.Google Scholar
- Mauro Jaskelioff. Monatron: An extensible monad transformer library. In Implementation and Application of Functional Languages, volume 5836 of Lecture Notes in Computer Science, pages 233--248. Springer, 2011. Google Scholar
Digital Library
- Mauro Jaskelioff, Neil Ghani, and Graham Hutton. Modularity and implementation of mathematical operational semantics. Electron. Notes Theor. Comput. Sci., 229(5):75--95, 2011. Google Scholar
Digital Library
- Mark P. Jones and Luc Duponcheel. Composing monads. Research Report YALEU/DCS/RR-1004, Yale University, 1993.Google Scholar
- Ohad Kammar, Sam Lindley, and Nicolas Oury. Handlers in action. In The 1st ACM SIGPLAN Workshop on Higher-Order Programming with Effects, HOPE '12, 2012. Google Scholar
Digital Library
- Klein et al. sel4: formal verification of an operating-system kernel. Commun. ACM, 53(6):107--115, 2010. Google Scholar
Digital Library
- Peter Lee. Realistic Compiler Generation. MIT Press, Cambridge, MA, 1989. Google Scholar
Digital Library
- Xavier Leroy. Formal verification of a realistic compiler. Commun. ACM, 52(7):107--115, 2009. Google Scholar
Digital Library
- Paul Blain Levy. Monads and adjunctions for global exceptions. Electron. Notes Theor. Comput. Sci., 158:261--287, 2006. Google Scholar
Digital Library
- Sheng Liang and Paul Hudak. Modular denotational semantics for compiler construction. In Proceedings of the 6th European Symposium on Programming Languages and Systems, ESOP '96, pages 219--234. Springer-Verlag, 1996. Google Scholar
Digital Library
- Sheng Liang, Paul Hudak, and Mark Jones. Monad transformers and modular interpreters. In Proceedings of the 22nd ACM SIGPLANSIGACT symposium on Principles of programming languages, POPL '95, pages 333--343. ACM, 1995. Google Scholar
Digital Library
- Grant Malcolm. Algebraic Data Types and Program Transformation. PhD thesis, Rijksuniversiteit Groningen, September 1990.Google Scholar
- Conor Mcbride and Ross Paterson. Applicative programming with effects. J. Funct. Program., 18(1):1--13, 2008. Google Scholar
Digital Library
- Eugenio Moggi. An abstract view of programming languages. Technical Report ECS-LFCS-90-113, Edinburgh University, Department of Computer Science, June 1989.Google Scholar
- Peter D. Mosses. A basic abstract semantic algebra. In Semantics of Data Types, volume 173 of Lecture Notes in Computer Science, pages 87--107. Springer, 1984. Google Scholar
Digital Library
- Peter D. Mosses. Modular structural operational semantics. Journal of Logic and Algebraic Programming, 6061(0):195 -- 228, 2004.Google Scholar
Cross Ref
- Bruno C. d. S. Oliveira. Modular visitor components. In Proceedings of the 23rd European Conference on Object-Oriented Programming, ECOOP 2009, pages 269--293. Springer-Verlag, 2009. Google Scholar
Digital Library
- Bruno C. d. S. Oliveira, Tom Schrijvers, and William R. Cook. EffectiveAdvice: disciplined advice with explicit effects. In Proceedings of the 9th International Conference on Aspect-Oriented Software Development, AOSD '10, pages 109--120. ACM, 2010. Google Scholar
Digital Library
- Frank Pfenning and Christine Paulin-Mohring. Inductively defined types in the calculus of constructions. In Mathematical Foundations of Programming Semantics, volume 442 of Lecture Notes in Computer Science, pages 209--228. Springer-Verlag, 1990. Google Scholar
Digital Library
- Benjamin C. Pierce. Types and Programming Languages. MIT Press, 2002. Google Scholar
Digital Library
- Gordon Plotkin and Matija Pretnar. Handlers of algebraic effects. In Programming Languages and Systems: 18th European Symposium on Programming, ESOP 2009, volume 5502 of Lecture Notes in Computer Science, pages 80--94. Springer, 2009. Google Scholar
Digital Library
- Gordon D. Plotkin and John Power. Notions of computation determine monads. In Proceedings of the 5th International Conference on Foundations of Software Science and Computation Structures, FoSSaCS '02, pages 342--356. Springer-Verlag, 2002. Google Scholar
Digital Library
- John C. Reynolds. Types, abstraction and parametric polymorphism. In IFIP Congress, pages 513--523, 1983.Google Scholar
- Tom Schrijvers and Bruno C. d. S. Oliveira. Monads, zippers and views: virtualizing the monad stack. In Proceedings of the 16th ACM SIGPLAN international conference on Functional programming, ICFP '11, pages 32--44. ACM, 2011. Google Scholar
Digital Library
- Tom Schrijvers and Bruno C. d. S. Oliveira. The monad zipper. Report CW 595, Dept. of Computer Science, K.U.Leuven, 2010.Google Scholar
- Zhong Shao. Certified software. Commun. ACM, 53(12):56--66, 2010.Google Scholar
Digital Library
- Antonis Stampoulis and Zhong Shao. Veriml: typed computation of logical terms inside a language with effects. In Proceedings of the 15th ACM SIGPLAN international conference on Functional programming, ICFP '10, pages 333--344. ACM, 2010. Google Scholar
Digital Library
- Guy L. Steele, Jr. Building interpreters by composing monads. In Proceedings of the 21st ACM SIGPLAN-SIGACT symposium on Principles of programming languages, POPL '94, pages 472--492. ACM, 1994. Google Scholar
Digital Library
- Wouter Swierstra. Data types a la carte. J. Funct. Program., 18(4):423--436, 2008. Google Scholar
Digital Library
- Tarmo Uustalu and Varmo Vene. Coding recursion a la Mendler. In Proceedings 2nd Workshop on Generic Programming, WGP '00, pages 69--85, 2000.Google Scholar
- Janis Voigtlander. Free theorems involving type constructor classes: functional pearl. In Proceedings of the 14th ACM SIGPLAN international conference on Functional programming, ICFP '09, pages 173--184. ACM, 2009. Google Scholar
Digital Library
- Philip Wadler. Theorems for free! In Proceedings of the fourth international conference on Functional programming languages and computer architecture, FPCA '89, pages 347--359. ACM, 1989. Google Scholar
Digital Library
- Philip Wadler. Monads for functional programming. In Proceedings of the Marktoberdorf Summer School on Program Design Calculi, August 1992.Google Scholar
- Philip Wadler. The Expression Problem. Email, November 1998. Discussion on the Java Genericity mailing list.Google Scholar
- Philip Wadler and Stephen Blott. How to make ad-hoc polymorphism less ad hoc. In Proceedings of the 16th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, POPL '89, pages 60--76. ACM, 1989. Google Scholar
Digital Library
- Andrew K. Wright and Matthias Felleisen. A syntactic approach to type soundness. Information and Computation, 115(1):38 -- 94, 1994. Google Scholar
Digital Library
Index Terms
Modular monadic meta-theory
Recommendations
Generic datatypes à la carte
WGP '13: Proceedings of the 9th ACM SIGPLAN workshop on Generic programmingFormal reasoning in proof assistants, also known as mechanization, has high development costs. Building modular reusable components is a key issue in reducing these costs. A stumbling block for reuse is that inductive definitions and proofs are closed ...
Modular monadic meta-theory
ICFP '13: Proceedings of the 18th ACM SIGPLAN international conference on Functional programmingThis paper presents 3MT, a framework for modular mechanized meta-theory of languages with effects. Using 3MT, individual language features and their corresponding definitions -- semantic functions, theorem statements and proofs-- can be built separately ...
Formalized meta-theory of sequent calculi for linear logics
AbstractWhen studying sequent calculi, proof theorists often have to prove properties about the systems, whether to show that they are “well-behaved”, amenable to automated proof search, complete with respect to another system, consistent, ...







Comments