Lifting the Reasoning Level in Generic Weak Memory Verification (Extended Version)

Lara Bargmann,Heike Wehrheim
DOI: https://doi.org/10.48550/arXiv.2309.01433
2023-09-04
Abstract:Weak memory models specify the semantics of concurrent programs on multi-core architectures. Reasoning techniques for weak memory models are often specialized to one fixed model and verification results are hence not transferable to other memory models. A recent proposal of a generic verification technique based on axioms on program behaviour expressed via weakest preconditions aims at overcoming this specialization to dedicated models. Due to the usage of weakest preconditions, reasoning however takes place on a very low level requiring the application of numerous axioms for deriving program properties, even for a single statement. In this paper, we lift reasoning in this generic verification approach to a more abstract level. Based on a view-based assertion language, we provide a number of novel proof rules for directly reasoning on the level of program constructs. We prove soundness of our proof rules and exemplify them on the write-to-read causality (WRC) litmus test. A comparison to the axiom-based low-level proof reveals a significant reduction in the number of required proof steps.
Logic in Computer Science,Programming Languages
What problem does this paper attempt to address?
### What problem does this paper attempt to solve? This paper aims to solve a key problem encountered in the verification of concurrent programs running on multi - core architectures: **the verification results of Weak Memory Models are difficult to transfer across models**. Specifically: 1. **Complexity of Weak Memory Models**: The behavior of concurrent programs on modern multi - core processors is affected by weak memory models, which specify how threads access shared variables and which values can be read. The behaviors of different weak memory models are different from Sequential Consistency (SC), where the latter assumes that the execution is the result of threads interleaving in program order. 2. **Limitations of Existing Verification Technologies**: Existing verification technologies are usually designed for specific memory models, which leads to concurrent programs proven correct for one memory model may no longer be correct on other memory models. For example, the traditional rely - guarantee or Owicki - Gries reasoning methods become unsound on weak memory models. 3. **Challenges of General Verification Methods**: Although Doherty et al. proposed a general verification technique based on weakest preconditions, this method still needs to apply low - level detailed axioms, and the reasoning process is very cumbersome, involving a large number of steps and complex properties. ### Solutions in the Paper To solve the above problems, the author proposes a method to raise the reasoning to a higher level of abstraction. The main contributions include: 1. **Introducing View - Based Languages**: Use a view - based assertion language to describe the behavior of concurrent programs. A view defines the write events that a thread can observe, thus determining the values it can read. 2. **Developing New Reasoning Rules**: Propose several new reasoning rules that can reason directly at the level of program construction without delving into the details of the weakest preconditions. These rules include: - **Fence Instruction (fence) Rule**: Ensure that after the execution of the fence instruction, the views of all threads are maximized. - **Read Operation Rule**: Describe how to replace global assertions with local assertions. - **Write Operation Rule**: Handle the impact of write operations on the views of other threads. 3. **Proving the Soundness of Rules**: Prove the soundness of each new rule through low - level axioms and list the required axioms, so that the verification results can be more easily transferred to memory models that partially satisfy these axioms. 4. **Reducing Reasoning Steps**: Demonstrate the application of the new rules through examples, significantly reducing the required reasoning steps and improving the verification efficiency. ### Example Application The author takes the Write - to - Read Causality (WRC) test as an example to show how to use the new rules for reasoning. The WRC test is a classic concurrent program test case for checking causal consistency under different memory models. By applying the new rules, the author proves the correctness of the WRC test on multiple memory models and shows the simplification of the reasoning steps. ### Summary This paper solves the problem that the verification results of weak memory models are difficult to transfer across models by raising the reasoning level and introducing new rules, while also improving the efficiency and portability of verification.