Deciding Bit-Vector Arithmetic with Abstraction

Randal E. Bryant, Daniel Kroening, Joël Ouaknine, Sanjit A. Seshia, Ofer Strichman, Bryan A. Brady

Abstract

Formal verification of hardware and software often relies on deciding the satisfiability of bit-vector arithmetic. Traditional "bit-blasting" methods frequently suffer from state-space explosion. This paper presents a novel abstraction-refinement framework that "sandwiches" the problem between under-approximations and over-approximations. By utilizing unsatisfiable cores to guide refinement and operating on structural representations, the proposed method achieves significant performance gains, including speedups of over 800x on complex benchmarks involving multiplication.

Introduction

In formal verification, systems are modeled using bit-vectors—fixed-width integers that accurately represent hardware registers and software data types. The standard approach to solving bit-vector formulas is bit-blasting, which translates every bit and operation into a massive propositional logic (SAT) problem. While robust, bit-blasting is essentially a brute-force technique that ignores high-level mathematical structure, often leading to computational intractability for operations like large-width multiplication or division.

This research addresses the "state space explosion" inherent in bit-blasting by proposing a decision procedure that maintains the precision of bit-level reasoning while leveraging high-level abstractions for efficiency.

Methodology

The core of the proposed approach is an iterative Abstraction-Refinement Loop. This process alternates between under-approximating the problem (to find solutions quickly) and over-approximating it (to prove unsatisfiability efficiently).

The Abstraction-Refinement Loop for bit-vector arithmetic.

The algorithm follows four primary stages:

  1. Under-approximation: Variables are initially represented using a reduced bit-width (e.g., 2 or 4 bits instead of 32). If the SAT solver finds a satisfying assignment at this reduced width, it is a valid solution for the original formula.
  2. Unsatisfiable Core Extraction: If the under-approximation is unsatisfiable, the solver generates a proof of unsatisfiability. From this proof, the algorithm extracts the "unsatisfiable core"—the specific subset of constraints responsible for the conflict.
  3. Over-approximation (Abstraction): A simplified version of the original formula is constructed, containing only the constraints identified in the unsatisfiable core. If this abstraction is unsatisfiable, the original full-width formula is guaranteed to be unsatisfiable.
  4. Refinement: If the abstraction is satisfiable, the resulting solution is a "spurious counterexample." The algorithm uses this result to refine the abstraction—for instance, by increasing bit-widths for relevant variables—and restarts the loop.

Structural Awareness and Partial Interpretation

Unlike traditional methods that operate on flat Conjunctive Normal Form (CNF) formulas, this approach works directly on Directed Acyclic Graphs (DAGs). This preserves the high-level structure of the program, such as "If-Then-Else" (ITE) blocks. Furthermore, the authors employ "partial interpretation" for complex operators. For example, a multiplier might be initially treated as a black box that only "knows" basic identities like $x \cdot 0 = 0$ and $x \cdot 1 = x$, adding more complex logic only when necessary.

Key Insights

The effectiveness of this approach rests on two primary hypotheses:

  • The Small Core Hypothesis: In many unsatisfiable problems, only a small fraction of the total constraints are necessary to prove the result.
  • The Small Solution Hypothesis: Conversely, if a solution exists, it can often be represented using very few bits (e.g., edge cases involving 0 or 1).

By focusing on these "cores" and "small solutions," the solver avoids the overhead of processing irrelevant details of the full bit-blasted formula.

Experimental Results

The tool, implemented within the UCLID framework, was evaluated against state-of-the-art solvers (STP, Yices) on various benchmarks, including x86-like processor models, hardware verification suites from Intel, and software vulnerability detection formulas.

The results demonstrate significant performance advantages:

  • Performance Gains: On equivalence checking benchmarks involving 65-bit multiplication (e.g., C1-P2), the abstraction-based approach was over 825 times faster than competing solvers.
  • Robustness: The method successfully solved several benchmarks (such as Y86-btnft and C3-OP80) where traditional bit-blasting solvers timed out or crashed.
  • Efficiency of Abstraction: In many instances, the algorithm reached a conclusion in a single iteration. The resulting abstractions were frequently less than 20% of the size of the original bit-blasted formulas.

Conclusion and Future Work

While the abstraction-refinement approach offers massive speedups for many classes of problems, it is not without limitations. The overhead of re-generating SAT instances can make it slower on certain small or highly constrained problems. Future work aims to integrate "incremental SAT" solvers to preserve learning between iterations and to extend the framework to handle floating-point arithmetic. Nevertheless, this "sandwich" approach represents a significant step forward in making bit-vector reasoning scalable for complex verification tasks.

Summary updated

BibTeX
@inproceedings{bryant2007deciding,
  author = {Randal E. Bryant and Daniel Kroening and Joël Ouaknine and Sanjit A. Seshia and Ofer Strichman and Bryan A. Brady},
  title = {{Deciding Bit-Vector Arithmetic with Abstraction}},
  booktitle = {TACAS},
  year = {2007},
  doi = {10.1007/978-3-540-71209-1\_28},
}
Figure