<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Solving Constraints over Bit-Vectors with SAT-based Model Checking Extended Abstract</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Yakir Vizel</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Alexander Nadel</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Sharad Malik</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Intel Development Center</institution>
          ,
          <addr-line>Haifa</addr-line>
          ,
          <country country="IL">Israel</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Princeton University</institution>
          ,
          <country country="US">USA</country>
        </aff>
      </contrib-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>We present BVMC, a novel decision procedure for constraints over xed-width
bit-vectors, which is based on propositional model checking (MC).</p>
      <p>
        Nowadays, Satis ability Modulo Theory (SMT) [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] solvers for the quanti
erfree xed-width bit-vector (QF BV) logic are widely used, especially when
bitprecise reasoning is required. One subset of QF BV, which is particularly
important in formal veri cation of software (SW), is quanti er-free linear arithmetic
over integers modulo 2N (LIAN ). This paper presents an e cient decision
procedure, BVMC, suitable for solving LIAN .
      </p>
      <p>Formal veri cation of SW is one of the main forces driving SMT research.
SW veri cation usually involves reasoning about arithmetic constraints, and
in particular, linear arithmetic constraints over integers modulo 2N for some
N 2 N. This is due to the fact that SW uses a nite representation for integers.
More precisely, arithmetic operations over integers are interpreted over the ring
Z=2N Z (\machine arithmetic") rather than over the ring Z. As a result, e cient
bit-precise reasoning is highly desired.</p>
      <p>In order to capture the semantics of linear arithmetic over Z=2N Z (LIAN ),
SMT solvers for the theory of xed-width bit-vectors (BV solvers) are often used.
BV solvers, however, are not e cient when the bit-vectors are wide. Namely,
when the value of 2N is large (e.g. N = 128), solving linear arithmetic constraints
over Z=2N Z becomes intractable for BV solvers. This ine ciency is mainly due
to the way BV solvers are implemented: in most cases, the formula is reduced
to a propositional formula using bit-blasting. Therefore, as N increases, so is the
complexity of the resulting SAT formula. One way to overcome this ine ciency
is by applying a LIA solver. Unlike BV solvers, LIA solvers reason about linear
arithmetic over Z. While LIA solvers are more e cient than that of BV solvers
for this task, they are less precise. This imprecision comes from the di erent
semantics of LIA and LIAN . Namely, arithmetic operations over Z cannot
result in an \over ow" (i.e. wrap-around). In the context of SW veri cation, this
may lead to unsound results. Hence, an e cient LIAN solver, which this paper
presents, should be extremely useful for SW veri cation.</p>
    </sec>
    <sec id="sec-2">
      <title>Our Approach</title>
      <p>
        Our novel decision procedure BVMC is based on a reduction of the input formula
to a safety veri cation problem. Namely, a formula ' in LIAN is transformed to
a transition system T such that the satis ability of ' corresponds to whether
T is SAFE or UNSAFE. The key to our reduction lies in treating bit-vectors as
unbounded streams of bits over time. More precisely, for each input bit-vector,
the least signi cant bit (LSB) corresponds to time 0 in the corresponding stream,
and the k-th bit corresponds to the bit received at time k. The structure of
T captures the constraints between the bit-vector variables that appear in '.
To determine if T is SAFE or UNSAFE, BVMC uses SAT-based model checking
(SATMC) [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ].
      </p>
      <p>
        One possible way to reason about T is by using Bounded Model Checking
(BMC) [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], an e cient SATMC algorithm that can show T is UNSAFE.
Considering our reduction, if BMC nds a counterexample of length N in T (T is
UNSAFE), then ' is satis able over Z=2N Z. If no counterexample of length N
exists in T , then ' is unsatis able over Z=2N Z. This can be used as a decision
procedure for LIAN . However, the performance of such an approach is usually
not better then that of BV solvers [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]. BMC can either nd a counterexample of
length N , or prove that counterexample of length N does not exist. In that sense,
in the context of BVMC, it can only reason about LIAN for a given N . In fact,
this approach is somewhat \equivalent" to how modern eager BV solvers are
implemented. Consequently, this approach is, in general, not superior to solving
the bit-blasted formula.
      </p>
      <p>
        Unlike BMC, modern SATMC algorithms [
        <xref ref-type="bibr" rid="ref3 ref8 ref9">8,3,9</xref>
        ] use generalization in order
to show that no counterexample, of any length, exists, and by that they can
prove a transition system is SAFE. BVMC takes advantage of this generalization
mechanism. In case BVMC nds ' to be unsatis able over Z=2kZ, SATMC's
generalization mechanism is applied to show ' is unsatis able over Z=2N Z for every
N &gt; k. For the case a counterexample of length k is found, we have
implemented an e cient procedure in BVMC that tries to extend the counterexample
to some target N (where N &gt; k) and by that show ' is satis able over Z=2N Z.
When such a counterexample cannot be extended, BVMC blocks it and continues
the search until either a new counterexample is found (possibly longer) or until
unsatis ability is established.
      </p>
    </sec>
    <sec id="sec-3">
      <title>Evaluation</title>
      <p>
        As discussed above, our goal in designing BVMC is to support QF BV. Currently,
we implemented a prototype which supports all bit-wise operators, as well as all
operators required to support LIAN . For evaluation, we transformed the QF LIA
subset of the SMT-COMP'16 benchmark to QF BV using xed-width bit-vectors
of sizes 32, 64, and 128. We then compared BVMC to Boolector3 [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ], and Z34 [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ].
BVMC solved the most satis able instances out of the three, even for a width as
low as 32. Moreover, it was able to solve many more instances, that were not
solved by neither Boolector nor Z3.
      </p>
    </sec>
    <sec id="sec-4">
      <title>Related and Future Work</title>
      <p>
        A closely related line of work appears in [
        <xref ref-type="bibr" rid="ref1 ref7">1,7</xref>
        ], where a reduction from a fragment
of BV, restricted to addition, shift by one and equality, to propositional model
checking has been introduced (as a by-product of studying the complexity of
bit-vector logic). The proposed method has been implemented and shown to
outperform traditional SMT solvers on crafted BV benchmarks, restricted to the
aforementioned BV fragment. Unlike the transformation applied by BVMC, the
modeling suggested in [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] only supports xed-width bit-vectors, making SATMC
algorithms ine cient. As a result, BDD-based model checking algorithms were
found to be the most e cient experimentally [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. BVMC shows how SATMC can
be applied e ciently even for the subset supported by [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]5. In addition, our
approach can handle a more extensive set of operators, which makes it applicable
to arbitrary formulas in LIAN .
      </p>
      <p>Our future work in this direction includes the following:
{ Extend our method to fully support QF BV, and
{ Implement dedicated SATMC algorithms that can e ciently solve transition
systems originating from LIAN and from QF BV.
5 Note that throughout our experiments, the transition systems include more than
thousands of state elements, making BDD-based MC intractable.
0</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>A. B. Andreas</surname>
            Frohlich,
            <given-names>Gergely</given-names>
          </string-name>
          <string-name>
            <surname>Kovasznai</surname>
          </string-name>
          .
          <article-title>E ciently solving bit-vector problems using model checkers</article-title>
          .
          <source>In 11th International Workshop on Satis ability Modulo Theories</source>
          ,
          <year>2013</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <given-names>A.</given-names>
            <surname>Biere</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Cimatti</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E. M.</given-names>
            <surname>Clarke</surname>
          </string-name>
          ,
          <string-name>
            <given-names>O.</given-names>
            <surname>Strichman</surname>
          </string-name>
          , and
          <string-name>
            <given-names>Y.</given-names>
            <surname>Zhu</surname>
          </string-name>
          .
          <article-title>Bounded model checking</article-title>
          .
          <source>Advances in Computers</source>
          ,
          <volume>58</volume>
          :
          <fpage>117</fpage>
          {
          <fpage>148</fpage>
          ,
          <year>2003</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <given-names>A. R.</given-names>
            <surname>Bradley</surname>
          </string-name>
          .
          <article-title>SAT-Based Model Checking without Unrolling</article-title>
          .
          <source>In VMCAI</source>
          , pages
          <volume>70</volume>
          {
          <fpage>87</fpage>
          ,
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <given-names>R.</given-names>
            <surname>Brummayer</surname>
          </string-name>
          and
          <string-name>
            <given-names>A.</given-names>
            <surname>Biere</surname>
          </string-name>
          . Boolector:
          <article-title>An e cient SMT solver for bit-vectors and arrays</article-title>
          .
          <source>In Tools and Algorithms for the Construction and Analysis of Systems, 15th International Conference, TACAS 2009</source>
          , pages
          <fpage>174</fpage>
          {
          <fpage>177</fpage>
          ,
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          <string-name>
            <surname>5. L. M. de Moura</surname>
            and
            <given-names>N.</given-names>
          </string-name>
          <article-title>Bj rner. Z3: an e cient SMT solver</article-title>
          .
          <source>In Tools and Algorithms for the Construction and Analysis of Systems, 14th International Conference, TACAS 2008</source>
          , pages
          <fpage>337</fpage>
          {
          <fpage>340</fpage>
          ,
          <year>2008</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          <string-name>
            <surname>6. L. M. de Moura</surname>
            and
            <given-names>N.</given-names>
          </string-name>
          <article-title>Bj rner. Satis ability modulo theories: introduction and applications</article-title>
          .
          <source>Commun. ACM</source>
          ,
          <volume>54</volume>
          (
          <issue>9</issue>
          ):
          <volume>69</volume>
          {
          <fpage>77</fpage>
          ,
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <given-names>G.</given-names>
            <surname>Kovasznai</surname>
          </string-name>
          ,
          <string-name>
            <surname>A.</surname>
          </string-name>
          <article-title>Frohlich, and</article-title>
          <string-name>
            <given-names>A.</given-names>
            <surname>Biere</surname>
          </string-name>
          .
          <article-title>Complexity of xed-size bit-vector logics</article-title>
          .
          <source>Theory Comput. Syst.</source>
          ,
          <volume>59</volume>
          (
          <issue>2</issue>
          ):
          <volume>323</volume>
          {
          <fpage>376</fpage>
          ,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>K. L. McMillan</surname>
          </string-name>
          .
          <article-title>Interpolation and SAT-Based Model Checking</article-title>
          .
          <source>In CAV</source>
          , pages
          <volume>1</volume>
          {
          <fpage>13</fpage>
          ,
          <year>2003</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <given-names>Y.</given-names>
            <surname>Vizel</surname>
          </string-name>
          and
          <string-name>
            <surname>A.</surname>
          </string-name>
          <article-title>Gur nkel. Interpolating property directed reachability</article-title>
          .
          <source>In CAV</source>
          , pages
          <volume>260</volume>
          {
          <fpage>276</fpage>
          ,
          <year>2014</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <given-names>Y.</given-names>
            <surname>Vizel</surname>
          </string-name>
          , G. Weissenbacher, and
          <string-name>
            <given-names>S.</given-names>
            <surname>Malik</surname>
          </string-name>
          .
          <article-title>Boolean satis ability solvers and their applications in model checking</article-title>
          .
          <source>Proceedings of the IEEE</source>
          ,
          <volume>103</volume>
          (
          <issue>11</issue>
          ):
          <year>2021</year>
          {
          <year>2035</year>
          ,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>