Mechanized Relational Verification of Concurrent Programs with Continuations


Amin Timany and Lars Birkedal: Mechanized Relational Verification of Concurrent Programs with Continuations. In PACMPL 3(ICFP): 105:1-105:28 (2019), August 2019. https://doi.org/10.1145/3341709
Journal Paper
Keywords: Concurrency, Continuations, Logical relations
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.

The bibtex source for this publication:
@article{Timany:2019:MRV:3352468.3341709,
 author = {Timany, Amin and Birkedal, Lars},
 title = {Mechanized Relational Verification of Concurrent Programs with Continuations},
 journal = {Proc. ACM Program. Lang.},
 issue_date = {August 2019},
 volume = {3},
 number = {ICFP},
 month = jul,
 year = {2019},
 issn = {2475-1421},
 pages = {105:1--105:28},
 articleno = {105},
 numpages = {28},
 url = {http://doi.acm.org/10.1145/3341709},
 doi = {10.1145/3341709},
 acmid = {3341709},
 publisher = {ACM},
 address = {New York, NY, USA},
 keywords = {Concurrency, Continuations, Logical relations},
}