[Paper Review] Now It Compiles! Certified Automatic Repair of Uncompilable Protocols
This paper presents the first formalization of an amendment procedure that automatically repairs uncompilable choreographies in choreographic programming by resolving knowledge-of-choice issues through selective communication. Using Coq, the authors identify and correct a flaw in the original theoretical formulation, proving that the amended choreographies preserve behavioral equivalence and are projectable, thereby enabling Turing-completeness of the underlying process calculus.
Choreographic programming is a paradigm where developers write the global specification (called choreography) of a communicating system, and then a correct-by-construction distributed implementation is compiled automatically. Unfortunately, it is possible to write choreographies that cannot be compiled, because of issues related to an agreement property known as knowledge of choice. This forces programmers to reason manually about implementation details that may be orthogonal to the protocol that they are writing. Amendment is an automatic procedure for repairing uncompilable choreographies. We present a formalisation of amendment from the literature, built upon an existing formalisation of choreographic programming. However, in the process of formalising the expected properties of this procedure, we discovered a subtle counterexample that invalidates the original published and peer-reviewed pen-and-paper theory. We discuss how using a theorem prover led us to both finding the issue, and stating and proving a correct formulation of the properties of amendment.
Motivation & Objective
- To formally verify the correctness of an automatic repair procedure (amendment) for uncompilable choreographies.
- To address the theoretical flaw in the original pen-and-paper formulation of amendment, which incorrectly claimed behavioral correspondence.
- To demonstrate that amended choreographies are projectable and preserve functional equivalence with original protocols.
- To establish that the repaired choreographies enable Turing-completeness of the underlying process calculus (Stateful Processes).
- To provide a certified, formally verified transformer from arbitrary choreographies to projectable ones using theorem proving.
Proposed method
- Formalizing the amendment procedure within Coq using an existing formalization of Core Choreographies (CC), Stateful Processes (SP), and Endpoint Projection (EPP).
- Defining a new amendment transformation that inserts selection labels (e.g., left/right) at conditional branches to resolve knowledge-of-choice conflicts.
- Proving that the amended choreography preserves behavioral equivalence via a lemma stating that if a choreography implements a function, so does its amendment.
- Using the EPP theorem to show that the EPP of an amended choreography yields a correct, distributed implementation.
- Formalizing projectability of amended choreographies and proving that the resulting implementations are behaviorally equivalent to the original protocols.
- Leveraging Coq’s proof capabilities to discover and correct a subtle counterexample invalidating the original published theory.
Experimental results
Research questions
- RQ1Does the original theoretical formulation of amendment guarantee behavioral correspondence between original and amended choreographies?
- RQ2Can the amendment procedure be formally verified to preserve functional equivalence and projectability?
- RQ3What is the correct semantic characterization of amendment that ensures correctness in the presence of knowledge-of-choice issues?
- RQ4Can amended choreographies still achieve Turing-completeness when compiled to distributed implementations?
- RQ5How can a formally verified, certifiable repair procedure be integrated into practical choreographic programming frameworks?
Key findings
- The original published theory of amendment was found to be incorrect due to a subtle counterexample, invalidating its claimed behavioral correspondence.
- A corrected formulation of amendment was formally proven in Coq, ensuring that amended choreographies preserve functional equivalence with the original protocols.
- The amendment procedure successfully resolves knowledge-of-choice issues by inserting minimal selection labels, enabling correct compilation via Endpoint Projection.
- The formalized amendment procedure ensures that all amended choreographies are projectable, thus enabling their compilation to distributed implementations.
- The corrected amendment procedure supports the proof of Turing-completeness for both Core Choreographies and the underlying Stateful Processes calculus.
- The entire formalization, including amendment and its properties, is extracted into Coq code totaling approximately 250 lines, demonstrating modularity and reusability.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.