Skip to main content
QUICK REVIEW

[Paper Review] SymInfer: Inferring Program Invariants using Symbolic States

ThanhVu Nguyen, Matthew B. Dwyer|arXiv (Cornell University)|Mar 28, 2019
Formal Methods in VerificationComputer Science33 references6 citations
TL;DR

SymInfer introduces a counterexample-guided invariant generation technique that leverages symbolic states from symbolic execution to infer precise, complex invariants—especially nonlinear numerical ones—across arbitrary program locations in Java. By reusing symbolic states for both candidate inference and verification, it avoids redundant computation and outperforms existing tools in scalability and precision, particularly on benchmarks involving nonlinear arithmetic and complexity analysis.

ABSTRACT

We introduce a new technique for inferring program invariants that uses symbolic states generated by symbolic execution. Symbolic states, which consist of path conditions and constraints on local variables, are a compact description of sets of concrete program states and they can be used for both invariant inference and invariant verification. Our technique uses a counterexample-based algorithm that creates concrete states from symbolic states, infers candidate invariants from concrete states, and then verifies or refutes candidate invariants using symbolic states. The refutation case produces concrete counterexamples that prevent spurious results and allow the technique to obtain more precise invariants. This process stops when the algorithm reaches a stable set of invariants. We present SymInfer, a tool that implements these ideas to automatically generate invariants at arbitrary locations in a Java program. The tool obtains symbolic states from Symbolic PathFinder and uses existing algorithms to infer complex (potentially nonlinear) numerical invariants. Our preliminary results show that SymInfer is effective in using symbolic states to generate precise and useful invariants for proving program safety and analyzing program runtime complexity. We also show that SymInfer outperforms existing invariant generation systems.

Motivation & Objective

  • To address the limitations of dynamic invariant inference tools, which often produce spurious invariants and struggle with complex numerical properties like nonlinear arithmetic.
  • To overcome the inefficiency of black-box symbolic verification in existing CEGIR frameworks, where symbolic state spaces are recomputed repeatedly for each invariant.
  • To develop a unified framework that reuses symbolic states for both invariant inference and verification, improving performance and precision.
  • To enable the discovery of complex invariants—such as $x^2 + y^2 = z^2$ or $x_1 = x_2 \cdot y_1 + y_2 + y_3$—that are critical for program verification and static analysis.
  • To demonstrate that symbolic states form a superior foundation for invariant generation compared to concrete states or black-box symbolic execution.

Proposed method

  • Generates symbolic states (path conditions and variable constraints) using Symbolic PathFinder (SPF), representing compact, diverse encodings of large sets of concrete program states.
  • Uses symbolic states to bootstrap dynamic invariant inference via DIG, which infers expressive nonlinear invariants from concrete states derived from symbolic states.
  • Employs symbolic states directly to formulate verification conditions for candidate invariants, enabling efficient SAT/SMT-based verification.
  • Integrates counterexample generation during verification to refine inference and eliminate spurious invariants, ensuring convergence to a stable, precise set of invariants.
  • Reuses the same symbolic state representation across all inference and verification iterations, avoiding redundant symbolic execution.
  • Applies optimization techniques such as disjunctive SMT formula encoding and state-space reuse to reduce verification overhead and improve scalability.

Experimental results

Research questions

  • RQ1Can symbolic states from symbolic execution serve as an effective and reusable foundation for both invariant inference and verification in a CEGIR framework?
  • RQ2To what extent can symbolic states improve the precision and scalability of invariant inference for complex numerical invariants, such as nonlinear arithmetic relations?
  • RQ3How does SymInfer compare to existing tools like iDiscovery, PIE, ICE, and NumInv in terms of invariant quality, performance, and support for complex invariants?
  • RQ4Can SymInfer effectively infer nontrivial program complexity bounds (e.g., loop iterations) that are useful for static analysis and security reasoning?
  • RQ5Does reusing symbolic states across multiple verification checks lead to measurable performance improvements over black-box symbolic execution approaches?

Key findings

  • SymInfer successfully infers complex nonlinear invariants in 21 out of 27 non-linear arithmetic (NLA) benchmarks, where iDiscovery fails due to lack of support for such relations.
  • It discovers nontrivial complexity bounds for 18 out of 19 programs in the HOLA benchmark, with 4 of these bounds improving upon the best-known results from prior work.
  • In the HOLA benchmark, SymInfer outperforms the state-of-the-art PIE tool in 41 out of 46 programs, demonstrating superior scalability and precision.
  • SymInfer matches or exceeds the invariant quality of NumInv across all benchmarks while running faster, despite SPF being slower than KLEE for C programs, due to efficient symbolic state reuse.
  • The tool avoids spurious invariants through counterexample-driven refinement, achieving stable and precise invariant sets without redundant symbolic execution.
  • The use of symbolic states enables a significant performance advantage over black-box verification tools like KLEE, as symbolic state computation is performed only once and reused across all invariants.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.