TL;DR
This paper introduces a simple yet powerful Counterexample-Guided Inductive Synthesis (CEGIS) framework to verify probabilistic programs by automatically generating source-code-level inductive invariants. By avoiding explicit state-space construction and focusing on piecewise linear expectations, the approach scales to massive or infinite-state systems, outperforming or matching state-of-the-art model checkers and specialized synthesis tools.
What Problem Does This Paper Address?
Randomized algorithms and protocols are everywhere, but verifying their correctness—such as proving that a failure probability is below a certain threshold or that a program terminates in finite expected time—is notoriously difficult.
Traditional probabilistic model checking relies on building explicit state spaces (like Markov chains). This approach quickly succumbs to the "state-space explosion" problem when dealing with large constants or variables. For infinite-state systems, the problem becomes generally undecidable. This paper tackles the challenge of verifying quantitative reachability properties directly on the program's source code, completely bypassing the need to construct the underlying state space.
Methods
The authors propose an automated verification method implemented in a prototype tool called cegispro2. The core architecture relies on a Counterexample-Guided Inductive Synthesis (CEGIS) loop:
- Template Generation: The tool automatically generates a parameterized, non-linear template based on the program's loop guards and branches.
- Synthesizer: The synthesizer attempts to find concrete rational values for the template's parameters to form a candidate invariant. This is handled efficiently via an SMT solver (Z3) or linear programming.
- Verifier: An SMT-backed verifier checks if the candidate satisfies the conditions of being a well-defined, safe, and inductive quantitative invariant. If the candidate fails, the verifier extracts a concrete counterexample state and feeds it back to the synthesizer to refine the next guess.
Novel Enhancements:
- Source-Code Level Reasoning: The tool uses a weakest pre-expectation calculus to symbolically compute the loop's characteristic function directly from the source code.
- Cooperative Verifiers: To prevent the CEGIS loop from getting stuck in localized "counterexample enumeration spirals," the verifier uses a Manhattan distance metric to ensure that successive counterexamples are sufficiently diverse.
- Template Refinement: If a template is too restrictive to find an invariant, the tool automatically applies refinement strategies (such as splitting the state space into hyperrectangles) without requiring user interaction.
Datasets
The authors evaluated cegispro2 on standard probabilistic verification benchmarks collected from existing literature. These include:
- Finite-state programs: The Bounded Retransmission Protocol (BRP), randomized random walks (
boundedrwmultistep), grid worlds (gridsmall,gridbig), and zero-configuration networking (zeroconf). - Infinite-state programs: Benchmarks drawn from the evaluation suites of specialized tools like Absynth (for expected runtimes) and Exist (for data-driven invariant learning).
Key Insights and Ideas
- The Power of Source-Code Abstraction: By operating entirely at the source-code level, the framework abstracts away concrete state spaces. It successfully verifies a BRP instance with an implicit state space of roughly 80 million states in just a few seconds.
- Piecewise Linearity is Sufficient: Despite the complex, non-linear nature of probabilistic transitions, the authors demonstrate that piecewise linear inductive invariants are expressive enough to verify tight quantitative bounds for many real-world protocols.
- Decoupling Structure from Parameters: The evaluation reveals that searching for good fixed-partition templates in an outer loop, while letting the inner CEGIS loop solve purely linear parameter constraints, is vastly more efficient than attempting to solve complex formulas with arbitrary Boolean structures all at once.
Key Results
The prototype tool cegispro2 was compared against three state-of-the-art tools: Storm (probabilistic model checker), Absynth (resource analysis tool), and Exist (invariant learner).
- Outperforming Model Checkers: On massive finite-state benchmarks (like the BRP family),
cegispro2successfully verified properties where Storm's explicit and symbolic engines ran out of memory (MO) or timed out (TO). - Competitive Runtime Analysis: For proving termination in finite expected runtime (UPAST),
cegispro2performed competitively with Absynth, frequently synthesizing runtime bounds that were just as tight. - Sound Lower Bounds: Compared to Exist,
cegispro2was faster on 30 out of 32 benchmarks for finding sub-invariants. Crucially,cegispro2incorporates soundness checks (conditional difference boundedness) to guarantee that the synthesized lower bounds are mathematically valid, whereas Exist's sub-invariants could occasionally be unsound.
Limitations and Future Work
- Unrealizable Templates: The framework depends entirely on the expressiveness of piecewise linear expectations. For certain programs (such as the
gridbigbenchmark), no such piecewise linear invariant exists, causing the tool to fail. - Heuristic Refinement Scaling: While automated template refinement ensures completeness for finite-state loops, it relies on heuristics that can sometimes generate too many pieces, increasing the computational burden on the synthesizer.
- Future Directions: The authors plan to explore more sophisticated template refinement strategies and extend the framework to support non-linear or polynomial invariants to handle a broader class of probabilistic programs.
Summary updated