Skip to main content
Log in

Complexity of Fixed-Size Bit-Vector Logics

  • Published:
Theory of Computing Systems Aims and scope Submit manuscript

Abstract

Bit-precise reasoning is important for many practical applications of Satisfiability Modulo Theories (SMT). In recent years, efficient approaches for solving fixed-size bit-vector formulas have been developed. From the theoretical point of view, only few results on the complexity of fixed-size bit-vector logics have been published. Some of these results only hold if unary encoding on the bit-width of bit-vectors is used. In our previous work (Kovásznai et al. 2012), we have already shown that binary encoding adds more expressiveness to various fixed-size bit-vector logics with and without quantification. In a follow-up work (Fröhlich et al. 2013), we then gave additional complexity results for several fragments of the quantifier-free case. In this paper, we revisit our complexity results from (Fröhlich et al. 2013; Kovásznai et al. 2012) and go into more detail when specifying the underlying logics and presenting the proofs. We give a better insight in where the additional expressiveness of binary encoding comes from. In order to do this, we bring together our previous work and propose several new complexity results for new fragments and extensions of earlier bit-vector logics. We also discuss the expressiveness of various bit-vector operations in more detail. Altogether, we provide the currently most complete overview on the complexity of common bit-vector logics.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Institutional subscriptions

Fig. 1
Fig. 2

Similar content being viewed by others

Notes

  1. http://www.smtlib.org/

  2. This kind of result is often called unary NP-completeness [32].

  3. Recall that only a variable, a constant, or an uninterpreted function can have explicit bit-width.

  4. Although we do not intend the present a reduction of a general shift to the respective shift by constant, it is worth to mention that a common approach for such a reduction is the barrel shifter.

  5. http://ecee.colorado.edu/wpmu/iimc/

  6. http://fmv.jku.at/

  7. http://www.satcompetition.org/

References

  1. Ayari, A., Basin, D.A., Klaedtke, F.: Decision procedures for inductive boolean functions based on alternating automata. In: CAV, volume 1855 of LNCS. Springer (2000)

  2. Balabanov, V., Chiang, H.-J.K., Jiang, J.-H.R.: Henkin quantifiers and boolean formulae. In: Proceedings of the SAT’12 (2012)

  3. Barrett, C., Stump, A., Tinelli, C.: The smt-lib standard: Version 2.0. In: Proceedings of the 8th International Workshop on Satisfiability Modulo Theories (Edinburgh, UK) (2010)

  4. Barrett, C.W., Dill, D.L., Levitt, J.R.: A decision procedure for bit-vector arithmetic. In: Proceedings of the 35th Design Automation Conference, pp 522–527 (1998)

  5. Bjørner, N., Pichora, M.C.: Deciding fixed and non-fixed size bit-vectors. In: TACAS, volume 1384 of LNCS, pages 376–392. Springer (1998)

  6. Bradley, A.R.: Sat-based model checking without unrolling. In: Proceedings of the VMCAI’11, pp. 70–87 (2011)

  7. Bradley, A.R., Manna, Z., Sipma, H.B.: What’s decidable about arrays? In: Emerson, E.A., Namjoshi, K.S. (eds.) VMCAI, volume 3855 of Lecture Notes in Computer Science, pp. 427–442. Springer (2006)

  8. Bradley, A.R., Somenzi, F., Hassan, Z., Zhang, Y.: An incremental approach to model checking progress properties. In: Proceedings of the FMCAD’11, pp. 144–153 (2011)

  9. Brummayer, R., Boolector, A.B.: An efficient smt solver for bit-vectors and arrays. Springer (2009)

  10. Brummayer, R., Biere, A., Florian, L.: BTOR: bit-precise modelling of word-level problems for model checking. In: Proceedings of the 1st International Workshop on Bit-Precise Reasoning, pp. 33–38. ACM, New York (2008)

  11. Bruttomesso, R.: RTL Verification: From SAT to SMT(BV). PhD thesis, University of Trento (2008)

  12. Bruttomesso, R., Cimatti, A., Franzén, A., Griggio, A., Sebastiani, R.: The MathSAT SMT solver. In: CAV, volume 5123 of LNCS, pp. 299–303. Springer (2008)

  13. Bruttomesso, R., Sharygina, N.: A scalable decision procedure for fixed-width bit-vectors. In: ICCAD, pp. 13–20. IEEE (2009)

  14. Bryant, R.E., Kroening, D., Ouaknine, J., Seshia, S.A., Strichman, O., Brady, B.: Deciding bit-vector arithmetic with abstraction. In: Proceedings of the 13th international conference on Tools and algorithms for the construction and analysis of systems, TACAS’07, pp. 358–372. Springer, Berlin (2007)

  15. Bubeck, U., Büning, H.K.: Encoding nested boolean functions as quantified boolean formulas. JSAT 8(1/2), 101–116 (2012)

    MathSciNet  MATH  Google Scholar 

  16. Butler, R.W., Miner, P.S., Srivas, M.K., Greve, D.A., Miller, S.P.: A bitvectors library for pvs. Technical report. NASA Langley Research Center, Hampton (1996)

    Google Scholar 

  17. Chlebus, B.S.: From domino tilings to a new model of computation. In: Symposium on Computation Theory, vol. 208 of LNCS. Springer (1984)

  18. Cimatti, A., Clarke, E., Giunchiglia, E., Giunchiglia, F., Pistore, M., Roveri, M., Sebastiani, R., Tacchella, A.: Nusmv version 2: An opensource tool for symbolic model checking. In: Proceedings of the CAV02 (2002)

  19. Cook, B., Kroening, D., Rümmer, P., Wintersteiger, C.M.: Ranking function synthesis for bit-vector relations. In: TACAS, vol. 6015 of LNCS. Springer (2010)

  20. Cook, S., Soltys, M.: Boolean programs and quantified propositional proof systems. Bulletin of the Section of Logic (1999)

  21. Cyrluk, D., Oliver, M., Harald, R.: An efficient decision procedure for a theory of fixed-sized bitvectors with composition and extraction. In: Computer-Aided Verification (CAV 97), pp. 60–71. Springer (1997)

  22. De Moura, L., Bjørner, N.: Z3: an efficient smt solver. Springer, Berlin (2008)

    Google Scholar 

  23. Donini, F.M., Liberatore, P., Massacci, F., Schaerf, M.: Solving QBF with SMV. In: Proceedings of the KR’02, pp 578–589 (2002)

  24. Downey, R.G., Fellows, M.R.: Parameterized Complexity, p 530. Springer (1999)

  25. Dutertre, B., de Moura, L.: The Yices SMT solver. Tool paper at http://yices.csl.sri.com/tool-paper.pdf (2006)

  26. Emmer, M., Khasidashvili, Z., Korovin, K., Voronkov, A.: Encoding industrial hardware verification problems into effectively propositional logic. In: FMCAD’10, pp. 137–144 (2010)

  27. Franzén, A.: Efficient Solving of the Satisfiability Modulo Bit-Vectors Problem and Some Extensions to SMT. PhD thesis, University of Trento (2010)

  28. Fröhlich, A., Kovásznai, G., Biere, A.: A DPLL algorithm for solving DQBF. In: Proceedings of the POS’12 (2012)

  29. Fröhlich, A., Kovásznai, G., Biere, A.: Efficiently solving bit-vector problems using model checkers. In: Proceedings of the SMT’13 (2013)

  30. Fröhlich, A., Kovásznai, G., Biere, A.: More on the complexity of quantifier-free fixed-size bit-vector logics with binary encoding. In: Proceedings of the CSR’13 (2013)

  31. Ganesh, V., Dill, D.L.: A decision procedure for bit-vectors and arrays. In: Computer Aided Verification (CAV ’07). Springer, Berlin (2007)

  32. Garey, M.R., Johnson, D.S.: NP-completeness results: Motivation, examples, and implications. J. ACM 25(3), 499–508 (1978)

    Article  MathSciNet  MATH  Google Scholar 

  33. Godefroid, P., Levin, M.Y., Molnar, D.A.: Automated whitebox fuzz testing. In: Network Distributed Security Symposium (NDSS). Internet Society (2008)

  34. Henkin, L.: Some remarks on infinitely long formulas. In: Infinistic Methods, pp. 167–183. Pergamon Press (1961)

  35. Johannsen, P.: Reducing bitvector satisfiability problems to scale down design sizes for RTL property checking. In: Proceedings of the High-Level Design Validation and Test Workshop, vol. 2001, pp 123–128 (2001)

  36. Johannsen, P.: Speeding Up Hardware Verification by Automated Data Path Scaling. PhD thesis. CAU Kiel, Germany (2002)

    Google Scholar 

  37. Khasidashvili, Z., Kinanah, M., Voronkov, A.: Verifying equivalence of memories using a first order logic theorem prover. In: FMCAD’09, pp. 128–135 (2009)

  38. Klarlund, N., Anders, M., Schwartzbach, M.I.: Mona implementation secrets. In: Proceedings of the CIAA’00, pp. 182–194 (2000)

  39. Knuth, D.E.: The Art of Computer Programming, Volume 4A: Combinatorial Algorithms. Addison-Wesley (2011)

  40. Korovin, K.: iProver — an instantiation-based theorem prover for first-order logic (system description). In: Proceedings of the IJCAR’08, IJCAR ’08. Springer (2008)

  41. Kovásznai, G., Fröhlich, A., Biere, A.: On the complexity of fixed-size bit-vector logics with binary encoded bit-width. In: Proceedings of the SMT’12, pp. 44–55 (2012)

  42. Kovásznai, G., Fröhlich, A., Biere, A.: bv2epr: A tool for polynomially translating quantifier-free bit-vector formulas into epr. In: Proceedings of the CADE’13 (2013)

  43. Kovásznai, G., Fröhlich, A., Biere, A.: Quantifier-free bit-vector formulas with binary encoding: Benchmark description. In: Balint, A., Belov, A., Heule, M., Järvisalo, M. (eds.) Proceedings of the SAT Competition 2013, vol. B-2013-1 of Department of Computer Science Series of Publications B, pp. 107–108. University of Helsinki (2013)

  44. Kroening, D., Strichman, O.: Decision Procedures: An Algorithmic Point of View. Texts in Theoretical Computer Science. Springer (2008)

  45. Lewis, H.R.: Complexity results for classes of quantificational formulas. J. Comput. Syst. Sci. 21(3), 317–353 (1980)

    Article  MathSciNet  MATH  Google Scholar 

  46. Marx, M.: Complexity of modal logic. In: Handbook of Modal Logic, volume 3 of Studies in Logic and Practical Reasoning, pp. 139–179. Elsevier (2007)

  47. Niewerth, M., Schwentick, T.: Two-variable logic and key constraints on data words. In: ICDT, pp. 138–149 (2011)

  48. Papadimitriou, C.H.: Computational complexity. Addison-Wesley (1994)

  49. Peterson, G., Reif, J., Azhar, S.: Lower bounds for multiplayer noncooperative games of incomplete information (2001)

  50. Peterson, G.L., Reif, J.H.: Multiple-person alternation. In: FOCS, pp. 348–363. IEEE Computer Society (1979)

  51. Prasad, M.R., Biere, A., Gupta, A.: A survey of recent advances in SAT-based formal verification. STTT 7(2), 156–173 (2005)

    Article  Google Scholar 

  52. Savitch, W.J.: Relationships between nondeterministic and deterministic tape complexities. J. Comput. Syst. Sci. 4(2), 177–192 (1970)

    Article  MathSciNet  MATH  Google Scholar 

  53. Schuele, T., Schneider, K.: Verification of data paths using unbounded integers: automata strike back. In: Proceedings of the 2nd international Haifa verification conference on Hardware and software, verification and testing, HVC’06, pp. 65–80. Springer-Verlag, Berlin (2007)

  54. Prasad Sistla, A., Clarke, E.M.: The complexity of propositional linear temporal logics. J. ACM 32(3), 733–749 (1985)

    Article  MathSciNet  MATH  Google Scholar 

  55. Spielmann, A., Kuncak, V.: On synthesis for unbounded bit-vector arithmetic. Technical report, EPFL, Lausanne, Switzerland (2012)

  56. Spielmann, A., Kuncak, V.: Synthesis for unbounded bitvector arithmetic. In: International Joint Conference on Automated Reasoning (IJCAR), LNAI. Springer (2012)

  57. Stockmeyer, L.J., Meyer, A.R.: Word problems requiring exponential time: Preliminary report. In: Aho, A.V., Borodin, A., Constable, R.L., Floyd, R.W., Harrison, M.A., Karp, R.M., Raymond Strong, H. (eds.) STOC, pp. 1–9. ACM (1973)

  58. Warren, H.S.: Hacker’s Delight. Addison-Wesley Longman (2002)

  59. Wintersteiger, C.M.: Termination Analysis for Bit-Vector Programs. PhD thesis. ETH Zurich, Switzerland (2011)

    Google Scholar 

  60. Wintersteiger, C.M., Hamadi, Y., de Moura, M.L.: Efficiently solving quantified bit-vector formulas. In: Proceedings of the FMCAD, pp. 239–246. IEEE (2010)

  61. Wolper, P., Boigelot, B.: An automata-theoretic approach to presburger arithmetic constraints (extended abstract). In: Procedings of the Static Analysis Symposium, LNCS 983, pp. 21–32. Springer LNCS (1995)

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Andreas Fröhlich.

Additional information

This work is partially supported by FWF, NFN Grant S11408-N23 (RiSE)

Appendices

Appendix A: Example: A Reduction of a DQBF to QF_BV2c

Consider the following DQBF:

$$\begin{array}{ll} \forall u_{0},u_{1},u_{2} \exists x(u_{0}),y(u_{1},u_{2}) \ . \ & (x \lor y \lor \neg u_{0} \lor \neg u_{1}) \ \land \\ & (x \lor \neg y \lor u_{0} \lor \neg u_{1} \lor \neg u_{2}) \ \land \\ & (x \lor \neg y \lor \neg u_{0} \lor \neg u_{1} \lor u_{2}) \ \land \\ & (\neg x \lor y \lor \neg u_{0} \lor \neg u_{2}) \ \land \\ & (\neg x \lor \neg y \lor u_{0} \lor u_{1} \lor \neg u_{2}) \end{array} $$

This DQBF is unsatisfiable.

Using the reduction given in Lemma 1, this formula is translated to the following QF_BV2c formula:

$$ \begin{array}{l} \left( (X \mid Y \mid \sim\! U_{0} \mid \sim\! U_{1}) \ \& \ (X \mid \sim\! Y \mid U_{0} \mid \sim\! U_{1} \mid \sim\! U_{2}) \ \& \ (X \mid \sim\! Y \mid \sim\! U_{0} \mid \sim\! U_{1} \mid U_{2}) \ \& \ \right.\\ \left.(\sim\! X \mid Y \mid \sim\! U_{0} \mid \sim\! U_{2}) \ \& \ (\sim\! X \mid \sim\! Y \mid U_{0} \mid U_{1} \mid \sim\! U_{2}) \right) \ = \ \sim\!0^{[8]} \ \ \land \\ \bigwedge_{m\in\{0,1,2\}} U_{m} \ll 2^{m} \ = \ \sim\!U_{m} \ \ \land \\ X \ \& \ \sim\!U_{1} \ = \ (X \ll 2^{1}) \ \& \ \sim\!U_{1} \ \ \land \\ X \ \& \ \sim\!U_{2} \ = \ (X \ll 2^{2}) \ \& \ \sim\!U_{2} \ \ \land \\ Y \ \& \ \sim\!U_{0} \ = \ (Y \ll 2^{0}) \ \& \ \sim\!U_{0} \end{array} $$
(6)

In the following, let us show that this formula is also unsatisfiable.

Recall that the notation t [n] d is an alternative for [[[n]]]=d, assuming an appropriate model for t. By construction, U 0 01010101, U 1 00110011, and U 2 00001111.

First, we show how the bits of X get restricted by the constraints introduced above. Let us denote the originally unrestricted bits of X with x 7,x 6,…,x 0. Since the bit-vectors

figure r

are forced to be equal, some bits of X should coincide, as follows:

figure s

Furthermore, considering also the equality

figure t

results in

figure u

In a similar fashion, the bits of Y are constrained as follows:

figure v

In order to show that the formula (6) is unsatisfiable, let us evaluate the “clauses” in the formula:

figure w

By applying bitwise and to them, we get the bit-vector constrained by the formula (6):

figure x

In order to check if t=∼ 0[8] is satisfiable, it is sufficient to try to satisfy the set of the above Boolean clauses. It is easy to see that this clause set is unsatisfiable, since, by unit propagation, x 1 and y 2 must be assigned to 1, which contradicts with the clause ¬x 1∨¬y 2.

Appendix B: Example: A Reduction of a QBF to QF_BV2≪1

Consider the following QBF:

$$\begin{array}{ll} \exists x \forall u_{2} \exists y \forall u_{1} u_{0} \exists z \ . \ & (u_{2} \lor u_{1} \lor \neg z) \ \land \\ & (u_{2} \lor \neg x \lor y) \ \land \\ & (u_{0} \lor \neg x \lor \neg z) \ \land \\ & (u_{1} \lor \neg y \lor z) \ \land \\ & (u_{0} \lor \neg u_{1} \lor z) \end{array} $$

This QBF is satisfiable.

Using the reduction given in Lemma 2, this formula is translated to the following QF_BV2≪1 formula:

$$ \begin{array}{l} \left( (U_{2} \mid U_{1} \mid \sim\! Z) \ \& \ (U_{2} \mid \sim\! X \mid Y) \ \& \ (U_{0} \mid \sim\! X \mid \sim\! Z) \ \& \ \right.\\ \left.(U_{1} \mid \sim\! Y \mid Z) \ \& \ (U_{0} \mid \sim\! U_{1} \mid Z) \right) \ = \ \sim\!0^{[8]} \ \ \land \\ \bigwedge_{m\in\{0,1,2\}} \left( \bigwedge_{0 \leq i < m} U_{i}\right) \oplus U_{m} \ = \ U_{m} \ll 1 \ \ \land \\ X \ \& \ \sim\! 1 \ = \ X \ll 1 \ \ \land \\ \left( U^{\prime}_{2} \ = \ \sim\! \left( (U_{2} \ll 1) \oplus U_{2} \right)\right) \ \ \land \ \ \left( Y \ \& \ U^{\prime}_{2} \ = \ (Y \ll 1) \ \& \ U^{\prime}_{2} \right) \end{array} $$
(7)

In the following, let us show that this formula is also satisfiable. As in the previous example, we have U 0 01010101, U 1 00110011, and U 2 00001111. However, this time the binary magic numbers were created in a different way to ensure that only addition and bitwise operations are used.

First, we show how the bits of X get restricted by the constraints introduced above. Let us denote the originally unrestricted bits of X with x 7,x 6,…,x 0. Since the bit-vectors

figure ab

must be equal, all bits of X are forced to be equal:

figure ac

Similarly, we get some constraints on Y. By using the mask

figure ad

the following bit-vectors

figure ae

are forced to be equal, putting restrictions on the individual bits of Y:

figure af

Finally, Z is not restricted in any way since u 0 is the innermost universal variable that z depends on, i.e., z depends on all universal variables.

figure ag

In order to show that the formula (7) is satisfiable, let us evaluate the “clauses” in the formula:

figure ah

By applying bitwise and to them, we get the bit-vector constrained by the formula (7):

figure ai

t=∼ 0[8] can easily be satisfied, e.g., by setting

$$\begin{array}{l} z_{7} = z_{6} = y_{4} = y_{0} = x_{0} = 0 \\ z_{5} = z_{1} = 1 \end{array} $$

Therefore,

figure aj

is a possible satisfying assignment for the bit-vector formula.

Appendix C: Example: Bit-Width Reduction of a QF_BV2 b w Formula with Indexing and Relational Operations

Let

$${\Phi}_{0} \ := \ \left( x^{[100]} \ <_{\mathbf{u}}\ y^{[100]}\right) \land \left( z^{[50]} = w^{[50]}\right) \land \left( w^{[100]}\![38] = y^{[100]}\![72]\right) $$

be a bit-vector formula with maximal bit-width 100. Note that we now use decimal encoding on the scalars. The set of explicit indices in the formula is given by I:={38,72}. We now generate Φ1 by splitting all bit-vectors at the corresponding bit-indices. First, x [100] < u y [100] is therefore replaced by

$$\begin{array}{lcr} & & \left( x^{\prime}_{99:73}{\!}^{[27]} \ <_{\mathbf{u}}\ y^{\prime}_{99:73}{\!}^{[27]}\right)\\ & \lor & \left( x^{\prime}_{99:73}{\!}^{[27]} = y^{\prime}_{99:73}{\!}^{[27]}\right) \land \left( \lnot x^{\prime}_{72}{\!}^{[1]} \land y^{\prime}_{72}{\!}^{[1]}\right)\\ & \lor & \left( x^{\prime}_{99:73}{\!}^{[27]} = y^{\prime}_{99:73}{\!}^{[27]}\right) \land \left( x^{\prime}_{72}{\!}^{[1]} \Leftrightarrow y^{\prime}_{72}{\!}^{[1]}\right) \land \left( x^{\prime}_{71:39}{\!}^{[33]} \ <_{\mathbf{u}}\ y^{\prime}_{71:39}{\!}^{[33]}\right)\\ & \lor & \left( x^{\prime}_{99:73}{\!}^{[27]} = y^{\prime}_{99:73}{\!}^{[27]}\right) \land \left( x^{\prime}_{72}{\!}^{[1]} \Leftrightarrow y^{\prime}_{72}{\!}^{[1]}\right) \\ & & \land \ \left( x^{\prime}_{71:39}{\!}^{[33]} = y^{\prime}_{71:39}{\!}^{[33]}\right) \land \left( \lnot x^{\prime}_{38}{\!}^{[1]} \land y^{\prime}_{38}{\!}^{[1]}\right)\\ & \lor & \left( x^{\prime}_{99:73}{\!}^{[27]} = y^{\prime}_{99:73}{\!}^{[27]}\right) \land \left( x^{\prime}_{72}{\!}^{[1]} \Leftrightarrow y^{\prime}_{72}{\!}^{[1]}\right) \\ & & \land \ \left( x^{\prime}_{71:39}{\!}^{[33]} = y^{\prime}_{71:39}{\!}^{[33]}\right) \land \left( x^{\prime}_{38}{\!}^{[1]} \Leftrightarrow y^{\prime}_{38}{\!}^{[1]}\right) \land \left( x^{\prime}_{37:0}{\!}^{[38]} \ <_{\mathbf{u}}\ y^{\prime}_{37:0}{\!}^{[38]}\right) \end{array} $$

Next, z [50]=w [50] is replaced by

$$\left( z^{\prime}_{49:39}{\!}^{[11]} = w^{\prime}_{49:39}{\!}^{[11]}\right) \land \left( z^{\prime}_{38}{\!}^{[1]} \Leftrightarrow w^{\prime}_{38}{\!}^{[1]}\right) \land \left( z^{\prime}_{37:0}{\!}^{[38]} = w^{\prime}_{37:0}{\!}^{[38]}\right) $$

Finally, w [100] [38]=y [100] [72] is replaced by

$$w^{\prime}_{38}{\!}^{[1]} \Leftrightarrow y^{\prime}_{72}{\!}^{[1]} $$

Since we only have 11 relational operations in Φ1, we can generate a bit-width reduced formula Φ2 by replacing all bit-widths n in Φ1 with min{11,n}. We therefore replace the variables

$$\begin{array}{@{}rcl@{}} x^{\prime}_{99:73}{\!}^{[27]}, y^{\prime}_{99:73}{\!}^{[27]}, x^{\prime}_{71:39}{\!}^{[33]}, y^{\prime}_{71:39}{\!}^{[33]},\\ x^{\prime}_{37:0}{\!}^{[38]}, y^{\prime}_{37:0}{\!}^{[38]}, z^{\prime}_{37:0}{\!}^{[38]}, w^{\prime}_{37:0}{\!}^{[38]}, \end{array} $$

by

$$\begin{array}{@{}rcl@{}} x^{\prime\prime}_{99:73}{\!}^{[11]}, y^{\prime\prime}_{99:73}{\!}^{[11]}, x^{\prime\prime}_{71:39}{\!}^{[11]}, y^{\prime\prime}_{71:39}{\!}^{[11]},\\ x^{\prime\prime}_{37:0}{\!}^{[11]}, y^{\prime\prime}_{37:0}{\!}^{[11]}, z^{\prime\prime}_{37:0}{\!}^{[11]}, w^{\prime\prime}_{37:0}{\!}^{[11]} \end{array} $$

respectively.

Appendix D: Example: Half-Shuffle and Expand Applied to a Bit-Vector

\(\mathit {halfshuffle}(\overbrace {1101}^{t^{[4]}},\ 16)\) can be replaced with x 2 [16], by adding the following assertions. First, zero extension is applied to the original vector:

figure ak

Now, in two iterations, the bits of t [4] are separated and moved to the distinct partitions of the extended vector:

figure al

The result now can be used for example in expand: \(\mathit {expand}(\overbrace {1101}^{t^{[4]}},\ 16)\) can be expressed as \(x^{\prime }_{2}{\!}^{[16]}\), by adding the following assertions:

figure am

Appendix E: Example: Multiplication of Two Bit-Vectors

The multiplication \(\overbrace {0011}^{t_{1}{\!}^{[4]}} \cdot \overbrace {0101}^{t_{2}{\!}^{[4]}}\) can be expressed as x 2 [16][3:0], by adding the following assertions. First, both bit-vectors are transformed by selfconcat and expand to quadratic size in order to generate all single-digit multiplications in one step by using bitwise and:

figure an

g 3 [4],g 2 [4],g 1 [4], and g 0 [4] are the bit groups representing the bit-vector which is the result of single-digit multiplication of t 1 [4]=0011 with the single bits of t 2 [4]=0101. Now, the neighbouring groups have to be shifted to their relative offsets and are added:

figure ao

g 32 [8] and g 10 [8] are the bit groups representing the bit-vectors which would be obtained by adding the bit-vectors represented by g 3 [4], g 2 [4] and g 1 [4], g 0 [4], respectively. This involves respecting their relative offsets, i.e., g 32=(g 3≪1)+g 2 and g 10=(g 1≪1)+g 0.

Since we still have several partial results, we have to continue adding neighbouring groups:

figure ap

After the last step, there is only one bit group left and the least significant bits of the bit-vector x 2 [16] 0000 0000 0000 1111 correspond to the solution of the multiplication, i.e., 0011⋅0101=x 2 [16][3:0]1111.

Further examples for multiplication or for other operations can easily be generated by feeding our benchmark family of bit-vector operations encoded in the SMT-LIB format into an SMT solver.

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Kovásznai, G., Fröhlich, A. & Biere, A. Complexity of Fixed-Size Bit-Vector Logics. Theory Comput Syst 59, 323–376 (2016). https://doi.org/10.1007/s00224-015-9653-1

Download citation

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s00224-015-9653-1

Keywords

Navigation