NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

OASIS: ILP-Guided Synthesis of Loop Invariants

Sahil Bhatia, Saswat Padhi, Nagarajan Natarajan, Rahul Sharma, Prateek Jain

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 software verification, a loop invariant is a logical property that remains true before, during, and after a loop's execution. Identifying these invariants is critical for proving program safety. While traditional static analysis methods have been the standard for decades, recent "data-driven" approaches have emerged, learning invariants from program execution traces (examples) rather than source code alone.

However, data-driven methods face a significant scalability challenge. Most existing tools rely on exhaustive enumeration, attempting every possible combination of variables and operations. As the number of variables increases, the search space grows exponentially. For instance, a program might contain dozens of variables, but only a few are relevant to the invariant. Exhaustive tools waste computational resources on this "noise," limiting their applicability to real-world software.

The OASIS Methodology

OASIS (Optimization And Search for Invariant Synthesis) addresses these scalability issues by shifting from a "generate-and-check" paradigm to a "guess-and-check" strategy powered by Integer Linear Programming (ILP).

Conceptual visualization of inductive invariant synthesis, where the invariant $I$ must contain reachable states $\rho$ while avoiding the unsafe region.

1. Relevant Variable Identification

OASIS employs a machine learning pre-processing step to identify the "wheat from the chaff." By generating both reachable (good) and safety-violating (bad) program states, the tool trains a sparse binary classifier. Variables that do not contribute to separating good states from bad ones are marked as irrelevant and excluded from the main synthesis phase, drastically reducing the search space.

2. ILP-based Invariant Learning

Rather than enumerating predicates, OASIS formulates the search for an invariant as an ILP problem. It seeks a classifier that minimizes both the number of variables used and the magnitude of their coefficients. This application of Occam’s Razor biases the system toward simpler, more generalizable invariants that are more likely to be inductive.

Example program traces (states) used as input for the data-driven learning process in OASIS.

3. Handling Partial Program States

SMT solvers often produce partial program states where certain variables are "don't cares." While standard machine learning algorithms struggle with missing data, the ILP formulation in OASIS naturally incorporates these partial maps. This allows the tool to leverage all available information without introducing noise or losing precision.

Experimental Evaluation

The authors evaluated OASIS against 403 benchmarks from the 2019 Syntax-Guided Synthesis (SyGuS) competition, including standard benchmarks and "Confounded" sets specifically designed to test scalability by adding irrelevant variables.

Key Results

  • Superior Coverage: OASIS solved 353 out of 403 instances, outperforming DryadSynth (346) and LoopInvGen (272).
  • Scalability on Complex Benchmarks: On the Confounded5 set—the most difficult benchmarks with the highest number of irrelevant variables—OASIS solved 67 instances, significantly more than LoopInvGen’s 44.
  • Unique Capabilities: OASIS successfully solved 13 specific benchmarks that were beyond the reach of all other competing tools.
  • Efficiency at Scale: While the overhead of ILP setup makes OASIS slightly slower on trivial problems, its performance scales gracefully as variable counts increase, whereas enumerative tools often time out.

Conclusion and Future Work

OASIS demonstrates that ILP-guided search and semantic variable pruning can overcome the scalability barriers of data-driven invariant synthesis. By focusing on sparsity and optimization, OASIS finds invariants in high-dimensional spaces that were previously inaccessible.

Future work includes extending OASIS to support non-linear invariants and optimizing the SMT query refinement process. The ultimate goal is to integrate these ILP-guided techniques into production-grade verification frameworks for languages like C++ and Rust, bringing automated formal verification to larger, more complex software systems.

Summary updated

BibTeX
@inproceedings{bhatia2020oasis,
  author = {Sahil Bhatia and Saswat Padhi and Nagarajan Natarajan and Rahul Sharma and Prateek Jain},
  title = {{OASIS: ILP-Guided Synthesis of Loop Invariants}},
  booktitle = {CAP @ NeurIPS},
  year = {2020},
  url = {https://openreview.net/forum?id=T591RKxIh6Q},
}
Figure