skip to main content
research-article
Open Access
Artifacts Available
Artifacts Evaluated & Functional

A logical relation for monadic encapsulation of state: proving contextual equivalences in the presence of runST

Published:27 December 2017Publication History
Skip Abstract Section

Abstract

We present a logical relations model of a higher-order functional programming language with impredicative polymorphism, recursive types, and a Haskell-style ST monad type with runST. We use our logical relations model to show that runST provides proper encapsulation of state, by showing that effectful computations encapsulated by runST are heap independent. Furthermore, we show that contextual refinements and equivalences that are expected to hold for pure computations do indeed hold in the presence of runST. This is the first time such relational results have been proven for a language with monadic encapsulation of state. We have formalized all the technical development and results in Coq.

Skip Supplemental Material Section

Supplemental Material

monadicencapsulation.webm

References

  1. Amal Ahmed. 2004. Semantics of Types for Mutable State. Ph.D. Dissertation. Princeton University.Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Amal Ahmed. 2006. Step-Indexed Syntactic Logical Relations for Recursive and Quantified Types. In ESOP. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Amal J. Ahmed, Andrew W. Appel, and Roberto Virga. 2002. A Stratified Semantics of General References Embeddable in Higher-Order Logic. In Proceedings of 17th Annual IEEE Symposium Logic in Computer Science. IEEE Computer Society Press, 75–86. Google ScholarGoogle ScholarCross RefCross Ref
  4. Andrew Appel and David McAllester. 2001. An Indexed Model of Recursive Types for Foundational Proof-Carrying Code. TOPLAS 23, 5 (2001), 657–683. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Andrew Appel, Paul-André Melliès, Christopher Richards, and Jérôme Vouillon. 2007. A Very Modal Model of a Modern, Major, General Type System. In POPL.Google ScholarGoogle Scholar
  6. Nick Benton and Peter Buchlovsky. 2007. Semantics of an effect analysis for exceptions. In TLDI. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Nick Benton, Andrew Kennedy, Lennart Beringer, and Martin Hofmann. 2007. Relational semantics for effect-based program transformations with dynamic allocation. In PPDP. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Nick Benton, Andrew Kennedy, Lennart Beringer, and Martin Hofmann. 2009. Relational semantics for effect-based program transformations: higher-order store. In PPDP. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Nick Benton, Andrew Kennedy, Martin Hofmann, and Lennart Beringer. 2006. Reading, writing and relations. In PLAS. Springer. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Lars Birkedal, Bernhard Reus, Jan Schwinghammer, Kristian Støvring, Jacob Thamsborg, and Hongseok Yang. 2011. StepIndexed Kripke Models over Recursive Worlds. In POPL.Google ScholarGoogle Scholar
  11. D. Dreyer, A. Ahmed, and L. Birkedal. 2011. Logical Step-Indexed Logical Relations. LMCS 7, 2:16 (2011).Google ScholarGoogle Scholar
  12. Matthias Felleisen and Robert Hieb. 1992. The revised report on the syntactic theories of sequential control and state. TCS 103, 2 (1992), 235–271. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. D. K. Gifford and J. M. Lucassen. 1986. Integrating functional and imperative programming. In LISP. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Ralf Jung, Robbert Krebbers, Lars Birkedal, and Derek Dreyer. 2016. Higher-order ghost state. In ICFP. 256–269. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Ralf Jung, David Swasey, Filip Sieczkowski, Kasper Svendsen, Aaron Turon, Lars Birkedal, and Derek Dreyer. 2015. Iris: Monoids and Invariants as an Orthogonal Basis for Concurrent Reasoning. In POPL. 637–650.Google ScholarGoogle Scholar
  16. Robbert Krebbers, Ralf Jung, AleÅą Bizjak, Jacques-Henri Jourdan, Derek Dreyer, and Lars Birkedal. 2017a. The essence of higher-order concurrent separation logic. In European Symposium on Programming (ESOP). Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Robbert Krebbers, Amin Timany, and Lars Birkedal. 2017b. Interactive Proofs in Higher-Order Concurrent Separation Logic. In POPL. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Morten Krogh-Jespersen, Kasper Svendsen, and Lars Birkedal. 2017. A relational model of types-and-effects in higher-order concurrent separation logic. In POPL. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. John Launchbury and Simon L. Peyton Jones. 1994. Lazy Functional State Threads. In Proceedings of the ACM SIGPLAN 1994 Conference on Programming Language Design and Implementation (PLDI ’94). ACM, New York, NY, USA, 24–35. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. John Launchbury and Simon L. Peyton Jones. 1995. State in haskell. Lisp and symbolic computation 8, 4 (1995), 293–341. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. E. Moggi and Amr Sabry. 2001. Monadic Encapsulation of Effects: A Revised Approach (Extended Version). J. Funct. Program. 11, 6 (Nov. 2001), 591–627.Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. John C. Reynolds. 1983. Types, Abstraction, and Parametric Polymorphism. Information Processing (1983).Google ScholarGoogle Scholar
  23. Steven Schäfer, Tobias Tebbi, and Gert Smolka. 2015. Autosubst: Reasoning with de Bruijn Terms and Parallel Substitutions. In ITP (LNCS), Vol. 9236. 359–374.Google ScholarGoogle Scholar
  24. Miley Semmelroth and Amr Sabry. 1999. Monadic Encapsulation in ML. In Proceedings of the Fourth ACM SIGPLAN International Conference on Functional Programming (ICFP ’99). ACM, New York, NY, USA, 8–17. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Jacob Thamsborg and Lars Birkedal. 2011. A Kripke logical relation for effect-based program transformations. In ICFP. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. A logical relation for monadic encapsulation of state: proving contextual equivalences in the presence of runST

              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

              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!