skip to main content
research-article

Modular monadic meta-theory

Published:25 September 2013Publication History
Skip Abstract Section

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.

References

  1. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  2. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  3. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  4. Andrej Bauer and Matija Pretnar. Programming with algebraic effects and handlers. CoRR, abs/1203.1539, 2012.Google ScholarGoogle Scholar
  5. Corrado Böhm and Alessandro Berarducci. Automatic synthesis of typed-programs on term algebras. Theoretical Computer Science, 39(0):135 -- 154, 1985.Google ScholarGoogle ScholarCross RefCross Ref
  6. 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 ScholarGoogle Scholar
  7. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  8. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  9. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  10. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  11. Andrzej Filinski. On the relations between monadic semantics. Theor. Comput. Sci., 375(1-3):41--75, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  13. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  14. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  15. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  16. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  17. John Hughes. Generalising monads to arrows. Sci. Comput. Program., 37(1-3):67--111, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. 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 ScholarGoogle Scholar
  19. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  20. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  21. Mark P. Jones and Luc Duponcheel. Composing monads. Research Report YALEU/DCS/RR-1004, Yale University, 1993.Google ScholarGoogle Scholar
  22. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  23. Klein et al. sel4: formal verification of an operating-system kernel. Commun. ACM, 53(6):107--115, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Peter Lee. Realistic Compiler Generation. MIT Press, Cambridge, MA, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Xavier Leroy. Formal verification of a realistic compiler. Commun. ACM, 52(7):107--115, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Paul Blain Levy. Monads and adjunctions for global exceptions. Electron. Notes Theor. Comput. Sci., 158:261--287, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  28. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  29. Grant Malcolm. Algebraic Data Types and Program Transformation. PhD thesis, Rijksuniversiteit Groningen, September 1990.Google ScholarGoogle Scholar
  30. Conor Mcbride and Ross Paterson. Applicative programming with effects. J. Funct. Program., 18(1):1--13, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Eugenio Moggi. An abstract view of programming languages. Technical Report ECS-LFCS-90-113, Edinburgh University, Department of Computer Science, June 1989.Google ScholarGoogle Scholar
  32. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  33. Peter D. Mosses. Modular structural operational semantics. Journal of Logic and Algebraic Programming, 6061(0):195 -- 228, 2004.Google ScholarGoogle ScholarCross RefCross Ref
  34. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  35. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  36. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  37. Benjamin C. Pierce. Types and Programming Languages. MIT Press, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  39. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  40. John C. Reynolds. Types, abstraction and parametric polymorphism. In IFIP Congress, pages 513--523, 1983.Google ScholarGoogle Scholar
  41. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  42. Tom Schrijvers and Bruno C. d. S. Oliveira. The monad zipper. Report CW 595, Dept. of Computer Science, K.U.Leuven, 2010.Google ScholarGoogle Scholar
  43. Zhong Shao. Certified software. Commun. ACM, 53(12):56--66, 2010.Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  45. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  46. Wouter Swierstra. Data types a la carte. J. Funct. Program., 18(4):423--436, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  47. Tarmo Uustalu and Varmo Vene. Coding recursion a la Mendler. In Proceedings 2nd Workshop on Generic Programming, WGP '00, pages 69--85, 2000.Google ScholarGoogle Scholar
  48. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  49. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  50. Philip Wadler. Monads for functional programming. In Proceedings of the Marktoberdorf Summer School on Program Design Calculi, August 1992.Google ScholarGoogle Scholar
  51. Philip Wadler. The Expression Problem. Email, November 1998. Discussion on the Java Genericity mailing list.Google ScholarGoogle Scholar
  52. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  53. Andrew K. Wright and Matthias Felleisen. A syntactic approach to type soundness. Information and Computation, 115(1):38 -- 94, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Modular monadic meta-theory

      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

      • Published in

        cover image ACM SIGPLAN Notices
        ACM SIGPLAN Notices  Volume 48, Issue 9
        ICFP '13
        September 2013
        457 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/2544174
        Issue’s Table of Contents
        • cover image ACM Conferences
          ICFP '13: Proceedings of the 18th ACM SIGPLAN international conference on Functional programming
          September 2013
          484 pages
          ISBN:9781450323260
          DOI:10.1145/2500365

        Copyright © 2013 ACM

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 25 September 2013

        Check for updates

        Qualifiers

        • research-article

      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!