skip to main content

Purity of an ST monad: full abstraction by semantically typed back-translation

Published:29 April 2022Publication History
Skip Abstract Section

Abstract

In 1995, Launchbury and Peyton Jones extended Haskell with an ST monad that allows the programmer to use higher-order mutable state. They informally argued that these state computations were safely encapsulated, and as such, that the rich reasoning principles stemming from the purity of the language, were not threatened.

In this paper, we give a formal account of the preservation of purity after adding an ST monad to a simply-typed call-by-value recursive lambda calculus. We state and prove full abstraction when embedding the pure language into its extension with ST; contextual equivalences from the pure language continue to hold in the presence of ST.

Proving full abstraction of compilers is usually done by emulating or back-translating the target features (here: ST computations) into the source language, a well-known challenge in the secure compilation community. We employ a novel proof technique for proving our full abstraction result that allows us to use a semantically (but not syntactically) typed back-translation into an intermediate language. We believe that this technique provides additional insight into our proof and that it is of general interest to researchers studying programming languages and compilers using full abstraction.

The results presented here are fully formalized in the Coq proof assistant using the Iris framework.

References

  1. Martín Abadi. 1998. Protection in Programming-Language Translations: Mobile Object Systems. In European Conference on Object-Oriented Programming. Springer Berlin Heidelberg. https://doi.org/10.1007/3-540-49255-0_70 Google ScholarGoogle ScholarCross RefCross Ref
  2. Martín Abadi. 1999. Protection in Programming-Language Translations. In Secure Internet Programming. Springer-Verlag. isbn:3-540-66130-1Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Carmine Abate, Roberto Blanco, Deepak Garg, Catalin Hritcu, Marco Patrignani, and Jérémy Thibault. 2019. Journey beyond full abstraction: Exploring robust property preservation for secure compilation. In 2019 IEEE 32nd Computer Security Foundations Symposium (CSF). 256–25615.Google ScholarGoogle ScholarCross RefCross Ref
  4. Andrew W. Appel and David McAllester. 2001. An Indexed Model of Recursive Types for Foundational Proof-Carrying Code. ACM Trans. Program. Lang. Syst., 23, 5 (2001), Sept., 657–683. issn:0164-0925 https://doi.org/10.1145/504709.504712 Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Dominique Devriese, Marco Patrignani, and Frank Piessens. 2016. Fully-Abstract Compilation by Approximate Back-Translation. In Principles of Programming Languages (POPL ’16). ACM, 164–177. https://doi.org/10.1145/2837614.2837618 Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Paul Hudak, John Hughes, Simon Peyton Jones, and Philip Wadler. 2007. A History of Haskell: Being Lazy with Class. In History of Programming Languages.Google ScholarGoogle Scholar
  7. Koen Jacobs, Dominique Devriese, and Amin Timany. 2022. Artifact - Purity of an ST Monad. https://doi.org/10.5281/zenodo.6329773 Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Koen Jacobs, Amin Timany, and Dominique Devriese. 2021. Fully Abstract from Static to Gradual. Proc. ACM Program. Lang., 5, POPL (2021), Article 7, Jan., 30 pages. https://doi.org/10.1145/3434288 Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Ralf Jung, Robbert Krebbers, Jacques-Henri Jourdan, Aleš Bizjak, Lars Birkedal, and Derek Dreyer. 2018. Iris from the ground up: A modular foundation for higher-order concurrent separation logic. Journal of Functional Programming, 28 (2018).Google ScholarGoogle Scholar
  10. 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, 24–35. isbn:089791662X https://doi.org/10.1145/178243.178246 Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. E. Moggi and Amr Sabry. 2001. Monadic encapsulation of effects: a revised approach (extended version). Journal of Functional Programming, 11, 6 (2001), 591–627. https://doi.org/10.1017/S0956796801004154 Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Max S. New and Amal Ahmed. 2018. Graduality from Embedding-Projection Pairs. Proc. ACM Program. Lang., 2, ICFP (2018), Article 73, July, 30 pages. https://doi.org/10.1145/3236768 Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Max S. New, William J. Bowman, and Amal Ahmed. 2016. Fully Abstract Compilation via Universal Embedding. In International Conference on Functional Programming. ACM, 103–116. https://doi.org/10.1145/2951913.2951941 Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Joachim Parrow. 2008. Expressiveness of Process Algebras. Electronic Notes in Theoretical Computer Science, 209 (2008), April, 173–186. issn:1571-0661 https://doi.org/10.1016/j.entcs.2008.04.011 Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Marco Patrignani. 2020. Why should anyone use colours? or, syntax highlighting beyond code snippets. arXiv preprint arXiv:2001.11334.Google ScholarGoogle Scholar
  16. Marco Patrignani, Amal Ahmed, and Dave Clarke. 2019. Formal Approaches to Secure Compilation: A Survey of Fully Abstract Compilation and Related Work. ACM Comput. Surv., 51, 6 (2019), Article 125, Feb., 36 pages. issn:0360-0300 https://doi.org/10.1145/3280984 Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Marco Patrignani, Eric Mark Martin, and Dominique Devriese. 2021. On the Semantic Expressiveness of Recursive Types. Proc. ACM Program. Lang., 5, POPL (2021), Article 21, Jan., 29 pages. https://doi.org/10.1145/3434302 Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Benjamin C. Pierce. 2002. Types and programming languages. MIT press.Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Lau Skorstengaard, Dominique Devriese, and Lars Birkedal. 2019. StkTokens: Enforcing Well-Bracketed Control Flow and Stack Encapsulation Using Linear Capabilities. Proc. ACM Program. Lang., 3, POPL (2019), Jan., 19:1–19:28. issn:2475-1421 https://doi.org/10.1145/3290332 Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Amin Timany, Robbert Krebbers, and Lars Birkedal. 2017. Logical relations in Iris. In CoqPL, Date: 2017/01/21-2017/01/21, Location: Paris.Google ScholarGoogle Scholar
  21. Amin Timany, Léo Stefanesco, Morten Krogh-Jespersen, and Lars Birkedal. 2017. A Logical Relation for Monadic Encapsulation of State: Proving Contextual Equivalences in the Presence of RunST. Proc. ACM Program. Lang., 2, POPL (2017), Article 64, Dec., 28 pages. https://doi.org/10.1145/3158152 Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Philip Wadler. 1993. Monads for functional programming. In Program Design Calculi, Manfred Broy (Ed.). Springer Berlin Heidelberg, 233–264. isbn:978-3-662-02880-3Google ScholarGoogle Scholar

Index Terms

  1. Purity of an ST monad: full abstraction by semantically typed back-translation

      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!