Nothing Special   »   [go: up one dir, main page]

skip to main content
research-article

Modular monadic meta-theory

Published: 25 September 2013 Publication History

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

Cited By

View all
  • (2024)Abstract Interpreters: A Monadic Approach to Modular VerificationProceedings of the ACM on Programming Languages10.1145/36746468:ICFP(602-629)Online publication date: 15-Aug-2024
  • (2020)Coq à la carte: a practical approach to modular syntax with bindersProceedings of the 9th ACM SIGPLAN International Conference on Certified Programs and Proofs10.1145/3372885.3373817(186-200)Online publication date: 20-Jan-2020
  • (2019)A Hierarchy of Monadic Effects for Program Verification Using Equational ReasoningMathematics of Program Construction10.1007/978-3-030-33636-3_9(226-254)Online publication date: 7-Oct-2019
  • Show More Cited By

Recommendations

Comments

Please enable JavaScript to view thecomments powered by Disqus.

Information & Contributors

Information

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
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 25 September 2013
Published in SIGPLAN Volume 48, Issue 9

Check for updates

Author Tags

  1. mechanized meta-theory
  2. modularity
  3. monads
  4. side-effects

Qualifiers

  • Research-article

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)17
  • Downloads (Last 6 weeks)0
Reflects downloads up to 20 Nov 2024

Other Metrics

Citations

Cited By

View all
  • (2024)Abstract Interpreters: A Monadic Approach to Modular VerificationProceedings of the ACM on Programming Languages10.1145/36746468:ICFP(602-629)Online publication date: 15-Aug-2024
  • (2020)Coq à la carte: a practical approach to modular syntax with bindersProceedings of the 9th ACM SIGPLAN International Conference on Certified Programs and Proofs10.1145/3372885.3373817(186-200)Online publication date: 20-Jan-2020
  • (2019)A Hierarchy of Monadic Effects for Program Verification Using Equational ReasoningMathematics of Program Construction10.1007/978-3-030-33636-3_9(226-254)Online publication date: 7-Oct-2019
  • (2015)Reusable Components of Semantic SpecificationsTransactions on Aspect-Oriented Software Development XII10.1007/978-3-662-46734-3_4(132-179)Online publication date: 20-Mar-2015
  • (2024)Deriving Dependently-Typed OOP from First PrinciplesProceedings of the ACM on Programming Languages10.1145/36498468:OOPSLA1(983-1009)Online publication date: 29-Apr-2024
  • (2024)Outcome Separation Logic: Local Reasoning for Correctness and Incorrectness with Computational EffectsProceedings of the ACM on Programming Languages10.1145/36498218:OOPSLA1(276-304)Online publication date: 29-Apr-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)A Type-Based Approach to Divide-and-Conquer Recursion in CoqProceedings of the ACM on Programming Languages10.1145/35711967:POPL(61-90)Online publication date: 11-Jan-2023
  • (2022)Intrinsically-typed definitional interpreters à la carteProceedings of the ACM on Programming Languages10.1145/35633556:OOPSLA2(1903-1932)Online publication date: 31-Oct-2022
  • (2019)Reusable specification templates for defining dynamic semantics of DSLsSoftware and Systems Modeling (SoSyM)10.1007/s10270-017-0590-018:1(691-720)Online publication date: 1-Feb-2019
  • Show More Cited By

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media