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.
- 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 Scholar
Cross Ref
- Martín Abadi. 1999. Protection in Programming-Language Translations. In Secure Internet Programming. Springer-Verlag. isbn:3-540-66130-1Google Scholar
Digital Library
- 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 Scholar
Cross Ref
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
- Koen Jacobs, Dominique Devriese, and Amin Timany. 2022. Artifact - Purity of an ST Monad. https://doi.org/10.5281/zenodo.6329773 Google Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- Marco Patrignani. 2020. Why should anyone use colours? or, syntax highlighting beyond code snippets. arXiv preprint arXiv:2001.11334.Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- Benjamin C. Pierce. 2002. Types and programming languages. MIT press.Google Scholar
Digital Library
- 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 Scholar
Digital Library
- Amin Timany, Robbert Krebbers, and Lars Birkedal. 2017. Logical relations in Iris. In CoqPL, Date: 2017/01/21-2017/01/21, Location: Paris.Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Index Terms
Purity of an ST monad: full abstraction by semantically typed back-translation
Recommendations
Full Abstraction for Probabilistic PCF
Distributed Computing, Cryptography, Distributed Computing, Cryptography, Coding Theory, Automata Theory, Complexity Theory, Programming Languages, Algorithms, Invited Paper Foreword and DatabasesWe present a probabilistic version of PCF, a well-known simply typed universal functional language. The type hierarchy is based on a single ground type of natural numbers. Even if the language is globally call-by-name, we allow a call-by-value ...
Fully-abstract compilation by approximate back-translation
POPL '16A compiler is fully-abstract if the compilation from source language programs to target language programs reflects and preserves behavioural equivalence. Such compilers have important security benefits, as they limit the power of an attacker ...
The Key monad: type-safe unconstrained dynamic typing
Haskell '16We present a small extension to Haskell called the Key monad. With the Key monad, unique keys of different types can be created and can be tested for equality. When two keys are equal, we also obtain a concrete proof that their types are equal. This ...






Comments