Beaver: Engineering an Efficient SMT Solver for Bit-Vector Arithmetic

Susmit Jha, Rhishikesh Limaye, Sanjit A. Seshia

Abstract

Beaver is an eager SMT solver designed to handle bit-vector arithmetic (QF_BV) by efficiently translating complex word-level formulas into Boolean SAT problems. By combining event-driven word-level constraint propagation with pre-optimized bit-level circuit templates and AIG rewriting, Beaver bridges the semantic gap between high-level specifications and low-level solvers. Experimental results from the SMTCOMP’08 competition demonstrate that Beaver's architecture, particularly when utilizing non-clausal SAT backends like NFLSAT, significantly outperforms traditional CNF-based approaches for formal verification tasks.

Introduction

In the field of formal verification, researchers rely on Satisfiability Modulo Theories (SMT) solvers to verify the correctness of software and hardware. A critical component of this process is QF_BV (Quantifier-Free Bit-Vector logic), which models how computers handle fixed-width integers and bit-wise operations.

The primary challenge in QF_BV solving is the "semantic gap": SMT formulas are high-level and word-oriented, while the underlying SAT solvers are low-level and bit-oriented. Efficiently bridging this gap requires sophisticated engineering to simplify the problem at the word level before "bit-blasting" it into millions of logic gates. Beaver was developed to address this challenge through an eager translation strategy and aggressive simplification techniques.

The Beaver Architecture

Beaver employs an eager approach, meaning it translates the entire SMT problem into a Boolean circuit before handing it to a SAT solver. Its efficiency is driven by three main components:

  1. Event-Driven Constraint Propagation: Beaver uses an online, queue-based system to propagate constants and equalities. When the solver discovers a variable equals a constant, it ripples that information throughout the formula to simplify other expressions.
  2. Pre-Synthesized Circuit Templates: To avoid the structural inefficiencies of standard bit-blasting, Beaver utilizes a library of arithmetic operators (e.g., adders, multipliers) pre-optimized offline using the ABC logic synthesis tool. These pre-optimized And-Inverter Graph (AIG) templates are inserted directly into the circuit.
  3. AIG Rewriting: Once high-level operators are expanded into bits, Beaver performs further bit-level simplifications on the AIG to remove structural redundancies.
Impact of word-level propagation (a) and template simplification (b) on runtime. Points above the diagonal indicate performance improvements.

Experimental Evaluation

Beaver was evaluated using the SMT-LIB benchmark suite, specifically the QF_BV section. This includes software benchmarks (e.g., catchconv), which feature many equalities and redundant variables, and hardware benchmarks (e.g., spear), which contain complex Boolean structures and structural repetitions.

Key Results

  • Optimization Efficacy: Word-level constraint propagation provided a 5x to 100x speedup on software path-feasibility queries. Similarly, logic optimization of circuit templates proved highly effective for the complex arithmetic found in hardware benchmark families.
  • SAT Back-end Comparison: Beaver is designed to be extensible, allowing it to interface with various SAT solvers. A head-to-head comparison revealed that NFLSAT, a non-clausal solver, exhibited the smallest aggregate runtime across all benchmarks. This suggests that the standard practice of converting formulas to Conjunctive Normal Form (CNF) may discard useful structural information.
Performance comparison of SAT backends: (a) Cumulative runtime across benchmarks and (b) relative performance between solver pairs.

Conclusion and Future Work

Beaver's success, including a third-place finish at SMTCOMP’08, highlights the importance of application-specific tuning in SMT solving. While software benchmarks benefit most from word-level propagation, hardware benchmarks require aggressive bit-level rewriting. Future work will explore family-specific auto-tuning to automatically adjust simplification strategies based on the characteristics of the input formula, as well as further investigation into why non-clausal solvers excel at bit-vector problems.

Summary updated

BibTeX
@inproceedings{jha2009beaver,
  author = {Susmit Jha and Rhishikesh Limaye and Sanjit A. Seshia},
  title = {{Beaver: Engineering an Efficient SMT Solver for Bit-Vector Arithmetic}},
  booktitle = {CAV},
  year = {2009},
  doi = {10.1007/978-3-642-02658-4\_53},
}
Figure