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

Mechanized relational verification of concurrent programs with continuations

Published:26 July 2019Publication History
Skip Abstract Section

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.

Skip Supplemental Material Section

Supplemental Material

a105-timany.webm

References

  1. Amal Ahmed. 2004. Semantics of Types for Mutable State. Ph.D. Dissertation. Princeton University. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. 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 ScholarDigital LibraryDigital Library
  3. 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
  4. 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 ScholarDigital LibraryDigital Library
  5. Martin Berger. 2010. Program Logics for Sequential Higher-Order Control. Springer Berlin Heidelberg, Berlin, Heidelberg, 194–211. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. 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 ScholarDigital LibraryDigital Library
  7. Lars Birkedal, Filip Sieczkowski, and Jacob Thamsborg. 2012. A Concurrent Logical Relation. In CSL.Google ScholarGoogle Scholar
  8. Andrea Cerone, Alexey Gotsman, and Hongseok Yang. 2014. Parameterised Linearisability. In ICALP.Google ScholarGoogle Scholar
  9. 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 ScholarGoogle ScholarCross RefCross Ref
  10. Pedro da Rocha Pinto, Thomas Dinsdale-Young, and Philippa Gardner. 2014. TaDA: A Logic for Time and Data Abstraction. In ECOOP. 207–231. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Olivier Danvy and Andrzej Filinski. 1990. Abstracting Control. In Proceedings of the 1990 ACM Conference on LISP and Functional Programming. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Germán Andrés Delbianco and Aleksandar Nanevski. 2013. Hoare-style reasoning with (algebraic) continuations. ACM SIGPLAN Notices 48, 9 (2013), 363–376. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Thomas Dinsdale-Young, Lars Birkedal, Philippa Gardner, Matthew Parkinson, and Hongseok Yang. 2013. Views: Compositional Reasoning for Concurrent Programs. In POPL. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. T. Dinsdale-Young, M. Dodds, P. Gardner, M. Parkinson, and V. Vafeiadis. 2010. Concurrent abstract predicates. In ECOOP. 504–528. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. D. Dreyer, A. Ahmed, and L. Birkedal. 2011. Logical Step-Indexed Logical Relations. LMCS 7, 2:16 (2011).Google ScholarGoogle Scholar
  16. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  17. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  18. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  19. Matthew Flatt. 2017. More: Systems Programming with Racket. https://docs.racket-lang.org/more/index.html .Google ScholarGoogle Scholar
  20. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  21. Christopher T. Haynes, Daniel P. Friedman, and Mitchell Wand. 1984. Continuations and Coroutines (LFP ’84). Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Greg Hendershott. 2017. http://www.greghendershott.com/2014/09/written-in-racket.html .Google ScholarGoogle Scholar
  23. Maurice P. Herlihy and Jeannette M. Wing. 1990. Linearizability: a correctness condition for concurrent objects. TOPLAS 12, 3 (1990), 463–492. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Ralf Jung, Robbert Krebbers, Lars Birkedal, and Derek Dreyer. 2016. Higher-order ghost state. In ICFP. 256–269. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. 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 ScholarGoogle ScholarCross RefCross Ref
  26. 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 ScholarDigital LibraryDigital Library
  27. 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
  28. Robbert Krebbers, Amin Timany, and Lars Birkedal. 2017b. Interactive Proofs in Higher-Order Concurrent Separation Logic. In POPL. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  30. Morten Krogh-Jespersen, Kasper Svendsen, and Lars Birkedal. 2017. A Logical Account of a Type-and-Effect System. In POPL.Google ScholarGoogle Scholar
  31. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  32. Ruy Ley-Wild and Aleksandar Nanevski. 2013. Subjective Auxiliary State for Coarse-Grained Concurrency. In POPL. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. Matt Might. 2017. http://matt.might.net/articles/low-level-web-in-racket/ .Google ScholarGoogle Scholar
  34. Andrzej S. Murawski and Nikos Tzevelekos. 2017. Higher-Order Linearisability. In CONCUR 2017.Google ScholarGoogle Scholar
  35. Keiko Nakata and Andri Saar. 2013. Compiling Cooperative Task Management to Continuations. In Fundamentals of Software Engineering, Farhad Arbab and Marjan Sirjani (Eds.).Google ScholarGoogle Scholar
  36. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  37. Peter W. O’Hearn. 2007. Resources, Concurrency and Local Reasoning. Theor. Comput. Sci. 375, 1-3 (2007), 271–307. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. 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 ScholarGoogle Scholar
  39. Gordon D. Plotkin. 1977. LCF considered as a programming language. Theoretical computer science 5, 3 (1977), 223–255.Google ScholarGoogle Scholar
  40. Christian Queinnec. 2004. Continuations and web servers. Higher-Order and Symbolic Computation 17, 4 (2004), 277–295. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. 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
  42. Ilya Sergey, Aleksandar Nanevski, and Anindya Banerjee. 2015. Mechanized verification of fine-grained concurrent programs. In PLDI. 77–87. Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. Kristian Støvring and Soren Lassen. 2007. A Complete, Co-Inductive Syntactic Theory of Sequential Control and State. In POPL. Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. Kasper Svendsen and Lars Birkedal. 2014. Impredicative Concurrent Abstract Predicates. In ESOP. 149–168. Google ScholarGoogle ScholarDigital LibraryDigital Library
  45. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  46. Aaron Turon, Derek Dreyer, and Lars Birkedal. 2013a. Unifying refinement and Hoare-style reasoning in a logic for higher-order concurrency. In ICFP. Google ScholarGoogle ScholarDigital LibraryDigital Library
  47. Aaron Turon, Jacob Thamsborg, Amal Ahmed, Lars Birkedal, and Derek Dreyer. 2013b. Logical relations for fine-grained concurrency. In POPL. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Mechanized relational verification of concurrent programs with continuations

                    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!