lazybvtoint at the SMT Competition 2020

Yoni Zohar, Ahmed Irfan, Makai Mann, Andres Nötzli, Andrew Reynolds, Clark W. BarrettarXiv 2021

Abstract

The lazybv2int solver is a prototype designed to address the limitations of traditional bit-blasting techniques in Satisfiability Modulo Theories (SMT) solving. By translating bit-vector problems into non-linear integer arithmetic and employing a Counter-Example Guided Abstraction Refinement (CEGAR) loop, the tool aims to handle large bit-widths and complex arithmetic constraints more efficiently than standard Boolean circuit conversions.

Introduction

Satisfiability Modulo Theories (SMT) solvers are foundational tools in the verification of hardware and software systems. In these domains, data is typically represented as fixed-width bit-vectors. The standard approach for solving bit-vector logic (QF_BV) is "bit-blasting," which translates the problem into a massive Boolean circuit for a SAT solver to process.

While effective for many problems, bit-blasting encounters significant scalability issues when dealing with large bit-widths (e.g., 256-bit, 512-bit, or 1024-bit) and complex arithmetic operations like multiplication. As the bit-width increases, the size of the resulting Boolean formula can explode, making the problem computationally intractable. lazybv2int proposes an alternative: treating bit-vectors as integers and leveraging the recent advancements in non-linear integer arithmetic solvers.

Methodology

lazybv2int operates as a wrapper tool that orchestrates a pipeline involving multiple specialized solvers. The core methodology consists of three main phases: translation, solving, and refinement.

1. Translation to Integer Arithmetic

The initial bit-vector formula ((\phi)) is translated into a corresponding formula ((\phi')) in the logic of non-linear integer arithmetic combined with uninterpreted functions.

  • Arithmetic Mapping: Standard operations such as addition and multiplication are mapped directly to their integer counterparts.
  • Bit-wise Abstraction: Operations that do not have a direct integer equivalent (e.g., bit-wise AND, OR, or Shift) are initially replaced by "black box" uninterpreted functions. This keeps the initial integer formula simple and avoids the immediate complexity of bit-level reasoning.

2. The CEGAR Loop

To ensure correctness without overwhelming the solver with detail, lazybv2int utilizes a Counter-Example Guided Abstraction Refinement (CEGAR) loop:

  • Solve: The integer abstraction is sent to CVC4, which attempts to find a solution.
  • Check: If a solution is found, the solver performs an "under-approximation check" using MathSAT5 to verify if the integer model is valid for the original bit-vector problem.
  • Refine: If the check fails (meaning the integer model is "spurious"), the solver generates "lemmas" or axioms. These axioms describe specific bit-vector properties—such as the fact that any value ANDed with itself must equal itself—and are added back into the integer formula for the next iteration.

3. Tool Integration

The system is built using the smt-switch API, which provides a unified interface to communicate between the MathSAT5 parser, the CVC4 arithmetic solver, and the custom refinement logic.

Competition and Evaluation

The solver was developed for and evaluated during the SMT-COMP 2020 (Satisfiability Modulo Theories Competition). It participated in the:

  • QF_BV Incremental track
  • QF_BV Non-incremental track

The primary target for lazybv2int is benchmarks characterized by large bit-widths and heavy arithmetic constraints, which are frequently encountered in cryptographic verification and high-level hardware modeling.

Insights and Discussion

The approach behind lazybv2int offers several key advantages:

  • Bit-Width Independence: Because the encoding uses integer arithmetic, the complexity of the initial formula remains relatively constant regardless of bit-width. A 1024-bit addition is represented similarly to a 64-bit addition, avoiding the exponential growth seen in bit-blasting.
  • Lazy Axiomatization: By only introducing bit-vector axioms when necessary to rule out incorrect models, the solver avoids the overhead of processing irrelevant bit-level details.
  • Modular Design: The tool demonstrates the power of "wrapper" architectures, combining the specialized strengths of CVC4 (integer reasoning) and MathSAT5 (bit-vector handling).

Limitations and Future Work

As a prototype, lazybv2int currently functions as a wrapper rather than a native implementation. This introduces communication overhead between the different solver components. Furthermore, while the tool excels at arithmetic, problems dominated by bit-wise logic (like XOR or OR) are less natural to represent as integers and may lead to a high number of CEGAR iterations.

Future development aims to integrate these arithmetic-based techniques directly into primary SMT solvers. This would reduce overhead and allow for more sophisticated heuristics to determine when to switch between integer-based reasoning and traditional bit-blasting.

Summary updated

BibTeX
@misc{zohar2021lazybvtoint,
  author = {Yoni Zohar and Ahmed Irfan and Makai Mann and Andres Nötzli and Andrew Reynolds and Clark W. Barrett},
  title = {{lazybvtoint at the SMT Competition 2020}},
  year = {2021},
  eprint = {2105.09743},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2105.09743},
}
Figure