Abstract
Automated synthesis of inductive invariants is an important problem in software verification. Once all the invariants have been specified, software verification reduces to checking of verification conditions. Although static analyses to infer invariants have been studied for over forty years, recent years have seen a flurry of data-driven invariant inference techniques which guess invariants from examples instead of analyzing program text. However, these techniques have been demonstrated to scale only to programs with a small number of variables. In this paper, we study these scalability issues and address them in our tool Oasis that improves the scale of data-driven invariant inference and outperforms state-of-the-art systems on benchmarks from the invariant inference track of the Syntax Guided Synthesis competition.
Introduction
In the realm of formal methods, proving that a program is "safe"—meaning it never enters an undesirable state—is a fundamental challenge. This task often hinges on the discovery of loop invariants: logical properties that hold true before a loop starts, after every iteration, and upon loop termination. If a suitable invariant can be found that implies the desired safety property, the verification problem is essentially solved.
Traditionally, static analysis tools have attempted to derive these invariants by examining the source code. However, "data-driven" approaches have emerged as a powerful alternative. These methods treat the program as a black box, executing it to gather "good" (reachable) states and "bad" (safety-violating) states. The goal is then to learn a logical formula that perfectly separates these two sets. Despite their promise, data-driven methods often struggle with scalability. As the number of program variables increases, the search space for potential invariants grows exponentially, a phenomenon known as state-space explosion. Furthermore, real-world code is often cluttered with "irrelevant" variables that do not contribute to the invariant but significantly confuse learning algorithms.
The Oasis Approach: Invariant Inference as Classification
Oasis addresses these scalability bottlenecks by reframing invariant inference as a sparse binary classification task. Instead of exhaustively enumerating possible formulas, Oasis employs Integer Linear Programming (ILP) to "guess" candidate invariants that are then checked by an SMT solver.
As illustrated in the figure above, an inductive invariant $I$ must encompass all initial states $\rho$ and be closed under the transition relation, while remaining entirely within the safe region (avoiding the "bad" states marked with red minus signs). Oasis views this as a zero-error classification problem: the learned formula must include all observed reachable states and exclude all observed counterexamples.
Core Innovations
- The ILP Learner: Oasis encodes the search for a Conjunctive Normal Form (CNF) formula as an optimization problem. By using ILP, it can leverage high-performance solvers like Google's OR-Tools to navigate the search space far more efficiently than brute-force enumeration.
- Sparsity and Semantic Slicing: To combat the "irrelevant variable" problem, the ILP objective function includes a penalty for the number of variables used in the formula (akin to L1-regularization). This forces the tool to find the simplest possible explanation for the data, effectively performing "semantic slicing" to ignore variables that are syntactically present but logically irrelevant to the safety property.
- Handling Partial Models: SMT solvers frequently return "don't care" values for variables that don't affect a specific counterexample. While standard machine learning models struggle with missing data, Oasis's ILP formulation handles these partial maps naturally, ensuring no information is lost during the learning process.
- Active Learning Loop: Oasis operates using three parallel threads. One thread searches for new reachable states (positive examples), another searches for safety violations (negative examples), and the third runs the core inference engine, RelInfer, focusing only on the variables identified as relevant.
Evaluation and Results
The authors evaluated Oasis against 403 benchmarks from the Syntax-Guided Synthesis (SyGuS) competition. This included the standard SyGuS 2018 set and a "Confounded" set specifically designed to test scalability by injecting up to 23 irrelevant variables into existing problems.
The results demonstrate a significant leap in performance:
- Overall Success: Oasis solved 353 out of 403 instances, outperforming the previous state-of-the-art data-driven tool, LoopInvGen (272), and even leading deductive solvers like CVC4 (287).
- Scalability: On the Confounded benchmarks, Oasis maintained its performance, solving 235/276 instances, whereas LoopInvGen's performance dropped significantly to 165.
- Efficiency: By identifying relevant variables, Oasis reduced the dimensionality of the problem by an average of 3x, proving the effectiveness of its sparsity-driven ILP approach.
Discussion and Future Work
Oasis demonstrates that optimization-based learning is a viable path forward for automated verification. By prioritizing "Occam's Razor"—the simplest formula that fits the data—it avoids the overfitting and slowness that plague enumeration-based tools.
However, some limitations remain. The current ILP formulation is highly optimized for linear arithmetic and does not yet natively support non-linear invariants (e.g., $y = x^2$). Additionally, for very simple benchmarks, the overhead of setting up the ILP problem and querying the SMT solver can make Oasis slower than more direct methods. Future work aims to extend these techniques to non-linear domains and integrate Oasis into industrial-scale verification pipelines.
Conclusion
Oasis represents a major step forward in scaling data-driven invariant inference. By combining the strengths of SMT solvers for verification and ILP for efficient search and feature selection, it provides a robust solution for verifying programs with high variable counts and complex logic.
Summary updated