Abstract
Concurrent higher-order imperative programming languages with continuations are very flexible and allow for the implementation of sophisticated programming patterns. For instance, it is well known that continuations can be used to implement cooperative concurrency. Continuations can also simplify web server implementations. This, in particular, helps simplify keeping track of the state of server’s clients. However, such advanced programming languages are very challenging to reason about. One of the main challenges in reasoning about programs in the presence of continuations is due to the fact that the non-local flow of control breaks the bind rule, one of the important modular reasoning principles of Hoare logic.
In this paper we present the first completely formalized tool for interactive mechanized relational verification of programs written in a concurrent higher-order imperative programming language with continuations (call/cc and throw). We develop novel logical relations which can be used to give mechanized proofs of relational properties. In particular, we prove correctness of an implementation of cooperative concurrency with continuations. In addition, we show that that a rudimentary web server implemented using the continuation-based pattern is contextually equivalent to one implemented without the continuation-based pattern. We introduce context-local reasoning principles for our calculus which allows us to regain modular reasoning principles for the fragment of the language without non-local control flow. These novel reasoning principles can be used in tandem with our (non-context-local) Hoare logic for reasoning about programs that do feature non-local control flow. Indeed, we use the combination of context-local and non-context-local reasoning to simplify reasoning about the examples.
Supplemental Material
- Amal Ahmed. 2004. Semantics of Types for Mutable State. Ph.D. Dissertation. Princeton University. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- Andrew Appel and David McAllester. 2001. An Indexed Model of Recursive Types for Foundational Proof-Carrying Code. TOPLAS 23, 5 (2001), 657–683. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- Martin Berger. 2010. Program Logics for Sequential Higher-Order Control. Springer Berlin Heidelberg, Berlin, Heidelberg, 194–211. Google Scholar
Digital Library
- Lars Birkedal, Bernhard Reus, Jan Schwinghammer, Kristian Støvring, Jacob Thamsborg, and Hongseok Yang. 2011. StepIndexed Kripke Models over Recursive Worlds. In POPL. Google Scholar
Digital Library
- Lars Birkedal, Filip Sieczkowski, and Jacob Thamsborg. 2012. A Concurrent Logical Relation. In CSL.Google Scholar
- Andrea Cerone, Alexey Gotsman, and Hongseok Yang. 2014. Parameterised Linearisability. In ICALP.Google Scholar
- T. Crolard and E. Polonowski. 2012. Deriving a Floyd-Hoare logic for non-local jumps from a formulæ-as-types notion of control. The Journal of Logic and Algebraic Programming 81, 3 (2012), 181 – 208. The 22nd Nordic Workshop on Programming Theory (NWPT 2010).Google Scholar
Cross Ref
- Pedro da Rocha Pinto, Thomas Dinsdale-Young, and Philippa Gardner. 2014. TaDA: A Logic for Time and Data Abstraction. In ECOOP. 207–231. Google Scholar
Digital Library
- Olivier Danvy and Andrzej Filinski. 1990. Abstracting Control. In Proceedings of the 1990 ACM Conference on LISP and Functional Programming. Google Scholar
Digital Library
- Germán Andrés Delbianco and Aleksandar Nanevski. 2013. Hoare-style reasoning with (algebraic) continuations. ACM SIGPLAN Notices 48, 9 (2013), 363–376. Google Scholar
Digital Library
- Thomas Dinsdale-Young, Lars Birkedal, Philippa Gardner, Matthew Parkinson, and Hongseok Yang. 2013. Views: Compositional Reasoning for Concurrent Programs. In POPL. Google Scholar
Digital Library
- T. Dinsdale-Young, M. Dodds, P. Gardner, M. Parkinson, and V. Vafeiadis. 2010. Concurrent abstract predicates. In ECOOP. 504–528. Google Scholar
Digital Library
- D. Dreyer, A. Ahmed, and L. Birkedal. 2011. Logical Step-Indexed Logical Relations. LMCS 7, 2:16 (2011).Google Scholar
- Derek Dreyer, Georg Neis, and Lars Birkedal. 2012. The impact of higher-order state and control effects on local relational reasoning. Journal of Functional Programming 22, 4-5 (2012), 477–528. Google Scholar
Digital Library
- Mattias Felleisen. 1988. The Theory and Practice of First-class Prompts. In Proceedings of the 15th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL). Google Scholar
Digital Library
- Matthias Felleisen and Robert Hieb. 1992. The revised report on the syntactic theories of sequential control and state. Theoretical Computer Science 103, 2 (1992), 235 – 271. Google Scholar
Digital Library
- Matthew Flatt. 2017. More: Systems Programming with Racket. https://docs.racket-lang.org/more/index.html .Google Scholar
- Daniel P. Friedman and Christopher T. Haynes. 1985. Constraining Control. In Proceedings of the 12th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages (POPL ’85). ACM, New York, NY, USA, 245–254. Google Scholar
Digital Library
- Christopher T. Haynes, Daniel P. Friedman, and Mitchell Wand. 1984. Continuations and Coroutines (LFP ’84). Google Scholar
Digital Library
- Greg Hendershott. 2017. http://www.greghendershott.com/2014/09/written-in-racket.html .Google Scholar
- Maurice P. Herlihy and Jeannette M. Wing. 1990. Linearizability: a correctness condition for concurrent objects. TOPLAS 12, 3 (1990), 463–492. Google Scholar
Digital Library
- Ralf Jung, Robbert Krebbers, Lars Birkedal, and Derek Dreyer. 2016. Higher-order ghost state. In ICFP. 256–269. 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), e20.Google Scholar
Cross Ref
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- Robbert Krebbers, Amin Timany, and Lars Birkedal. 2017b. Interactive Proofs in Higher-Order Concurrent Separation Logic. In POPL. Google Scholar
Digital Library
- Shriram Krishnamurthi, Peter Walton Hopkins, Jay McCarthy, Paul T Graunke, Greg Pettyjohn, and Matthias Felleisen. 2007. Implementation and use of the PLT Scheme web server. Higher-Order and Symbolic Computation 20, 4 (2007), 431–460. Google Scholar
Digital Library
- Morten Krogh-Jespersen, Kasper Svendsen, and Lars Birkedal. 2017. A Logical Account of a Type-and-Effect System. In POPL.Google Scholar
- James Laird. 1997. Full Abstraction for Functional Languages with Control. In Proceedings of the 12th Annual IEEE Symposium on Logic in Computer Science (LICS ’97). IEEE Computer Society, Washington, DC, USA, 58–. http://dl.acm.org/citation. cfm?id=788019.788859 Google Scholar
Digital Library
- Ruy Ley-Wild and Aleksandar Nanevski. 2013. Subjective Auxiliary State for Coarse-Grained Concurrency. In POPL. Google Scholar
Digital Library
- Matt Might. 2017. http://matt.might.net/articles/low-level-web-in-racket/ .Google Scholar
- Andrzej S. Murawski and Nikos Tzevelekos. 2017. Higher-Order Linearisability. In CONCUR 2017.Google Scholar
- Keiko Nakata and Andri Saar. 2013. Compiling Cooperative Task Management to Continuations. In Fundamentals of Software Engineering, Farhad Arbab and Marjan Sirjani (Eds.).Google Scholar
- Aleksandar Nanevski, Ruy Ley-Wild, Ilya Sergey, and Germán Andrés Delbianco. 2014. Communicating State Transition Systems for Fine-Grained Concurrent Resources. In ESOP. Google Scholar
Digital Library
- Peter W. O’Hearn. 2007. Resources, Concurrency and Local Reasoning. Theor. Comput. Sci. 375, 1-3 (2007), 271–307. Google Scholar
Digital Library
- Andrew M. Pitts. 2005. Typed Operational Reasoning. In Advanced Topics in Types and Programming Languages, B. C. Pierce (Ed.). The MIT Press, Chapter 7, 245–289.Google Scholar
- Gordon D. Plotkin. 1977. LCF considered as a programming language. Theoretical computer science 5, 3 (1977), 223–255.Google Scholar
- Christian Queinnec. 2004. Continuations and web servers. Higher-Order and Symbolic Computation 17, 4 (2004), 277–295. Google Scholar
Digital Library
- 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 Scholar
- Ilya Sergey, Aleksandar Nanevski, and Anindya Banerjee. 2015. Mechanized verification of fine-grained concurrent programs. In PLDI. 77–87. Google Scholar
Digital Library
- Kristian Støvring and Soren Lassen. 2007. A Complete, Co-Inductive Syntactic Theory of Sequential Control and State. In POPL. Google Scholar
Digital Library
- Kasper Svendsen and Lars Birkedal. 2014. Impredicative Concurrent Abstract Predicates. In ESOP. 149–168. Google Scholar
Digital Library
- Amin Timany, Léo Stefanesco, Morten Krogh-Jespersen, and Lars Birkedal. 2018. A Logical Relation for Monadic Encapsulation of State: Proving contextual equivalences in the presence of runST. Proc. ACM Program. Lang. 2, POPL (Jan. 2018), to appear. Google Scholar
Digital Library
- Aaron Turon, Derek Dreyer, and Lars Birkedal. 2013a. Unifying refinement and Hoare-style reasoning in a logic for higher-order concurrency. In ICFP. Google Scholar
Digital Library
- Aaron Turon, Jacob Thamsborg, Amal Ahmed, Lars Birkedal, and Derek Dreyer. 2013b. Logical relations for fine-grained concurrency. In POPL. Google Scholar
Digital Library
Index Terms
Mechanized relational verification of concurrent programs with continuations
Recommendations
Linear lambda calculus with non-linear first-class continuations
ICSCA '17: Proceedings of the 6th International Conference on Software and Computer ApplicationsThe Curry-Howard isomorphism is the correspondence between propositions and types, proofs and lambda-terms, and proof normalization and evaluation. In Curry-Howard isomorphism, we find a duality between values and continuations in pure functional ...
Mechanized verification of fine-grained concurrent programs
PLDI '15: Proceedings of the 36th ACM SIGPLAN Conference on Programming Language Design and ImplementationEfficient concurrent programs and data structures rarely employ coarse-grained synchronization mechanisms (i.e., locks); instead, they implement custom synchronization patterns via fine-grained primitives, such as compare-and-swap. Due to sophisticated ...
Mechanized verification of fine-grained concurrent programs
PLDI '15Efficient concurrent programs and data structures rarely employ coarse-grained synchronization mechanisms (i.e., locks); instead, they implement custom synchronization patterns via fine-grained primitives, such as compare-and-swap. Due to sophisticated ...






Comments