Abstract
Writing concurrent programs is notoriously difficult due to the state space explosion and subtle process interactions like deadlocks and race conditions. While program synthesis offers a potential solution by automatically generating code from high-level specifications, existing tools often struggle with the "Information Gap"—where processes have private local variables—and the "Robustness Gap"—where components are overly dependent on specific neighbor implementations. This paper introduces a framework for Assume-Guarantee Synthesis (AGS) that addresses these challenges by combining game theory, program sketching, and SMT-based bounded synthesis. The approach allows for the generation of robust concurrent code that respects local variable privacy and remains correct even if neighboring components are modified.
Introduction
In modern software engineering, concurrent systems are ubiquitous but remain a primary source of bugs. Traditional synthesis methods often assume "perfect information," where every process can observe the entire system state. However, in practice, processes often have local variables that should remain hidden for security or modularity reasons. Furthermore, standard cooperative synthesis creates systems where processes rely on the exact implementation of their neighbors, making the code fragile to any local changes.
This research extends Assume-Guarantee Synthesis (AGS) to handle partial information. In this paradigm, processes are not treated as purely cooperative or purely adversarial. Instead, they are assumed to be adversarial but constrained by their own specifications. This creates a "contract" between components, ensuring that as long as each component meets its local specification, the global system remains correct.
Problem Statement
The authors identify two major hurdles in applying synthesis to real-world concurrent systems:
- The Information Gap: Most tools assume global visibility. Forcing a process to rely on another's private data makes the resulting code impossible to implement in distributed or modular hardware/software environments.
- The Robustness Gap: Cooperative synthesis builds systems where Process A relies on the specific internal logic of Process B. If Process B is updated, Process A may fail. AGS mitigates this by ensuring Process A only relies on Process B’s specification.
Methodology
The framework bridges theoretical game theory and practical software engineering through three primary pillars:
1. Game Theory Reductions
The interaction between two processes and their environment is modeled as a 3-player game. The authors analyze the complexity of finding "secure equilibria" within these games across various logic fragments, including Safety, GR(1), and Linear Temporal Logic (LTL).
2. Program Sketching
To manage the computational complexity of generating code from scratch, the framework utilizes program sketching. Users provide a code skeleton containing "holes" (denoted by ?) and define constraints on what information each hole can access. This allows the developer to guide the synthesis process while leaving the complex synchronization logic to the tool.
3. Bounded Synthesis via SMT
Since synthesis with partial information is generally undecidable, the authors employ a bounded synthesis approach. By limiting the memory and state size of the synthesized components, the search for a solution is encoded into a Satisfiability Modulo Theories (SMT) problem. The tool uses the Z3 solver to find a model that fills the holes in the sketch, effectively generating the missing code.
Experimental Evaluation
The tool, an extension of the BoSY framework, was evaluated against several classic concurrency and networking benchmarks:
- Peterson’s Mutual Exclusion: A standard protocol for process synchronization.
- P2P Filesharing Protocol: Managing peer-to-peer data transfers.
- Double Buffering: A pattern used in graphics and drivers to manage concurrent data processing.
- Linux I2C Driver: A real-world case study where the tool synthesized atomic sections to fix a known race condition bug.
Key Results
- Efficiency: Most benchmarks were solved in seconds. For instance, Peterson’s protocol took approximately 19 seconds, while the P2P protocol was resolved in under one second.
- Optimization: The tool successfully identified minimal atomic sections for the I2C driver, matching solutions provided by human experts.
- Theoretical Proofs: The authors formally proved that general AGS under partial information is undecidable for basic safety properties, validating the necessity of the bounded heuristic approach.
Discussion and Insights
A significant contribution of this work is the realization that enforcing local variable scope—previously a cumbersome task in AGS—can be simplified by allowing users to define variable dependencies (e.g., f(turn, flag2)). This ensures the synthesized code is implementable on actual hardware.
Furthermore, the paper reveals a non-monotonic complexity in AGS: the problem does not always become harder as logic becomes more expressive. In some fragments, moving from memoryless to general strategies actually simplifies the categorization of the problem.
Limitations and Future Work
Despite its successes, the SMT-based approach faces scalability challenges. In the double-buffering benchmark, synthesis time increased exponentially with buffer size, jumping from 47 seconds at $N=7$ to over 1000 seconds at $N=8$. Additionally, the current requirement for sketches to be written in SMT-LIBv2 format presents a barrier to entry for general programmers. Future work will focus on developing a C-like front-end and identifying specific decidable sub-cases of partial information AGS to provide stronger guarantees.
Summary updated