Skip to main content
Log in

Towards Satisfiability Modulo Parametric Bit-vectors

  • Published:
Journal of Automated Reasoning Aims and scope Submit manuscript

Abstract

Many SMT solvers implement efficient SAT-based procedures for solving fixed-size bit-vector formulas. These techniques, however, cannot be used directly to reason about bit-vectors of symbolic bit-width. To address this shortcoming, we propose a translation from bit-vector formulas with parametric bit-width to formulas in a logic supported by SMT solvers that includes non-linear integer arithmetic, uninterpreted functions, and universal quantification. While this logic is undecidable, our approach can still solve many formulas that arise in practice by capitalizing on advances in SMT solving for non-linear arithmetic and universally quantified formulas. We provide several case studies in which we have applied this approach with promising results, including the bit-width independent verification of invertibility conditions, compiler optimizations, and bit-vector rewrite rules.

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.

Fig. 1

Similar content being viewed by others

Notes

  1. Our implementation of the translation does consider the general case since quantified formulas appear in the first of the case studies we discuss in Sect. 5.

  2. On preliminary experiments we observed that higher time limits did not increase the overall success rate of the case studies.

  3. All benchmarks, results, log files, and solver configurations are available at http://cvc4.cs.stanford.edu/papers/CADE2019-JAR/.

  4. At https://github.com/nunoplopes/alive/tree/master/tests/instcombine.

References

  1. Alur, R., Bodík, R., Juniwal, G., Martin, M.M.K., Raghothaman, M., Seshia, S.A., Singh, R., Solar-Lezama, A., Torlak, E., Udupa, A.: Syntax-guided synthesis. In: Formal Methods in Computer-Aided Design, FMCAD 2013, Portland, OR, USA, October 20–23, 2013, pp. 1–8 (2013)

  2. Barrett, C., Conway, C.L., Deters, M., Hadarean, L., Jovanović, D., King, T., Reynolds, A., Tinelli, C.: CVC4. In: CAV, CAV’11, pp. 171–177. Springer (2011). http://dl.acm.org/citation.cfm?id=2032305.2032319. Accessed on 15 Apr 2020

  3. Barrett, C., Stump, A., Tinelli, C.: The SMT-LIB Standard: Version 2.0. In: Gupta, A., Kroening, D. (eds.) Proceedings of the 8th International Workshop on Satisfiability Modulo Theories (Edinburgh, UK) (2010)

  4. Bjørner, N.S., Pichora, M.C.: Deciding fixed and non-fixed size bit-vectors. In: Steffen, B. (ed.) Tools and Algorithms for the Construction and Analysis of Systems, pp. 376–392. Springer, Berlin (1998)

    Chapter  Google Scholar 

  5. Blanchette, J.C., Böhme, S., Paulson, L.C.: Extending sledgehammer with SMT solvers. J. Autom. Reason. 51(1), 109–128 (2013)

    Article  MATH  Google Scholar 

  6. Bozzano, M., Bruttomesso, R., Cimatti, A., Franzén, A., Hanna, Z., Khasidashvili, Z., Palti, A., Sebastiani, R.: Encoding rtl constructs for mathsat: a preliminary report. Electron. Notes Theor. Comput. Sci. 144(2), 3–14 (2006). Proceedings of the Third Workshop on Pragmatics of Decision Procedures in Automated Reasoning (PDPAR 2005)

    Article  MATH  Google Scholar 

  7. Brinkmann, R., Drechsler, R.: Rtl-datapath verification using integer linear programming. In: Proceedings of ASP-DAC/VLSI Design 2002. 7th Asia and South Pacific Design Automation Conference and 15h International Conference on VLSI Design, pp. 741–746 (2002)

  8. Cimatti, A., Griggio, A., Irfan, A., Roveri, M., Sebastiani, R.: Experimenting on solving nonlinear integer arithmetic with incremental linearization. In: SAT, Lecture Notes in Computer Science, vol. 10929, pp. 383–398. Springer (2018)

  9. Cimatti, A., Griggio, A., Irfan, A., Roveri, M., Sebastiani, R.: Incremental linearization for satisfiability and verification modulo nonlinear arithmetic and transcendental functions. ACM Trans. Comput. Logic 19(3), 19:1–19:52 (2018)

    Article  MATH  Google Scholar 

  10. Development team, T.C.: The coq proof assistant reference manual version 8.9 (2019). https://coq.inria.fr/distrib/current/refman/. Accessed on 15 Apr 2020

  11. de Moura, L.M., Bjørner, N.: Efficient e-matching for SMT solvers. In: Automated Deduction—CADE-21, 21st International Conference on Automated Deduction, Bremen, Germany, July 17–20, 2007, Proceedings, pp. 183–198 (2007)

  12. De Moura, L., Bjørner, N.: Z3: an efficient smt solver. In: Proceedings of the Theory and Practice of Software, 14th International Conference on Tools and Algorithms for the Construction and Analysis of Systems, TACAS’08/ETAPS’08, pp. 337–340. Springer (2008). http://dl.acm.org/citation.cfm?id=1792734.1792766. Accessed on 15 Apr 2020

  13. Ekici, B., Mebsout, A., Tinelli, C., Keller, C., Katz, G., Reynolds, A., Barrett, C.: Smtcoq: a plug-in for integrating smt solvers into coq. In: CAV, pp. 126–133. Springer (2017)

  14. Ekici, B., Viswanathan, A., Zohar, Y., Barrett, C.W., Tinelli, C.: Verifying bit-vector invertibility conditions in coq (extended abstract). PxTP, EPTCS 301, 18–26 (2019)

    Article  Google Scholar 

  15. Enderton, H., Enderton, H.B.: A Mathematical Introduction to Logic. Elsevier, Amsterdam (2001)

    MATH  Google Scholar 

  16. Gupta, A., Fisher, A.L.: Parametric circuit representation using inductive boolean functions. In: Courcoubetis, C. (ed.) CAV, pp. 15–28. Springer, Berlin (1993)

    Google Scholar 

  17. Gupta, A., Fisher, A.L.: Representation and symbolic manipulation of linearly inductive boolean functions. In: CAV, ICCAD ’93, pp. 192–199. IEEE Computer Society Press, Los Alamitos, CA, USA (1993). http://dl.acm.org.stanford.idm.oclc.org/citation.cfm?id=259794.259827. Accessed on 15 Apr 2020

  18. Kovács, L., Voronkov, A.: First-order theorem proving and vampire. In: CAV, Lecture Notes in Computer Science, vol. 8044, pp. 1–35. Springer (2013)

  19. Kovásznai, G., Fröhlich, A., Biere, A.: Complexity of fixed-size bit-vector logics. Theory Comput. Syst. 59(2), 323–376 (2016)

    Article  MATH  Google Scholar 

  20. Kroening, D., Strichman, O.: Decision Procedures—An Algorithmic Point of View. Texts in Theoretical Computer Science. An EATCS Series, 2nd edn. Springer, Berlin (2016)

    Book  MATH  Google Scholar 

  21. Lattner, C., Adve, V.S.: LLVM: A compilation framework for lifelong program analysis & transformation. In: 2nd IEEE/ACM International Symposium on Code Generation and Optimization (CGO 2004), 20–24 March 2004, San Jose, CA, USA, pp. 75–88. IEEE Computer Society (2004)

  22. Lopes, N.P., Menendez, D., Nagarakatte, S., Regehr, J.: Provably correct peephole optimizations with alive. In: Proceedings of the 36th ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI ’15, pp. 22–32. ACM, New York, NY, USA (2015)

  23. Niemetz, A., Preiner, M., Reynolds, A., Barrett, C., Tinelli, C.: Solving quantified bit-vectors using invertibility conditions. In: Chockler, H., Weissenbacher, G. (eds.) CAV, Lecture Notes in Computer Science, vol. 10982, pp. 236–255. Springer (2018)

  24. Niemetz, A., Preiner, M., Reynolds, A., Zohar, Y., Barrett, C.W., Tinelli, C.: Towards bit-width-independent proofs in SMT solvers. In: CADE, Lecture Notes in Computer Science, vol. 11716, pp. 366–384. Springer (2019)

  25. Nipkow, T., Paulson, L.C., Wenzel, M.: Isabelle/HOL: A Proof Assistant for Higher-order Logic, vol. 2283. Springer, Berlin (2002)

    MATH  Google Scholar 

  26. Nötzli, A., Reynolds, A., Barbosa, H., Niemetz, A., Preiner, M., Barrett, C.W., Tinelli, C.: Syntax-guided rewrite rule enumeration for SMT solvers. In: SAT, Lecture Notes in Computer Science, vol. 11628, pp. 279–297. Springer (2019)

  27. Pichora, M.C.: Automated reasoning about hardware data types using bit-vectors of symbolic lengths. Ph.D. thesis, Toronto, Ont., Canada, Canada (2003). AAINQ84686

  28. Reger, G., Suda, M., Voronkov, A.: Unification with abstraction and theory instantiation in saturation-based reasoning. In: Tools and Algorithms for the Construction and Analysis of Systems—24th International Conference, TACAS 2018, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2018, Thessaloniki, Greece, April 14–20, 2018, Proceedings, Part I, pp. 3–22 (2018)

  29. Reynolds, A., Barbosa, H., Fontaine, P.: Revisiting enumerative instantiation. In: Tools and Algorithms for the Construction and Analysis of Systems—24th International Conference, TACAS 2018, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2018, Thessaloniki, Greece, April 14–20, 2018, Proceedings, Part II, pp. 112–131 (2018)

  30. Reynolds, A., Barbosa, H., Nötzli, A., Barrett, C.W., Tinelli, C.: cvc4sy: Smart and fast term enumeration for syntax-guided synthesis. In: Dillig, I., Tasiran, S. (eds.) CAV, Lecture Notes in Computer Science, vol. 11562, pp. 74–83. Springer (2019)

  31. Reynolds, A., Tinelli, C., Jovanovic, D., Barrett, C.: Designing theory solvers with extensions. In: Frontiers of Combining Systems—11th International Symposium, FroCoS 2017, Brasília, Brazil, September 27–29, 2017, Proceedings, pp. 22–40 (2017)

  32. Reynolds, A., Tinelli, C., de Moura, L.M.: Finding conflicting instances of quantified formulas in SMT. In: Formal Methods in Computer-Aided Design, FMCAD 2014, Lausanne, Switzerland, October 21–24, 2014, pp. 195–202 (2014)

  33. Solidity Language Developers: Solidity (2018). https://solidity.readthedocs.io/en/v0.4.25/. Accessed on 15 Apr 2020

  34. Tinelli, C., Zarba, C.G.: Combining decision procedures for sorted theories. In: Alferes, J.J., Leite, J. (eds.) Logics in Artificial Intelligence, pp. 641–653. Springer, Berlin (2004)

    Chapter  Google Scholar 

  35. Voronkov, A.: AVATAR: the architecture for first-order theorem provers. In: CAV, Lecture Notes in Computer Science, vol. 8559, pp. 696–710. Springer (2014)

  36. Zeng, Z., Kalla, P., Ciesielski, M.: Lpsat: a unified approach to rtl satisfiability. In: Proceedings Design, Automation and Test in Europe. Conference and Exhibition 2001, pp. 398–402 (2001)

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Yoni Zohar.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

This work was supported in part by DARPA (Awards N66001-18-C-4012 and FA8650-18-2-7861), ONR (Award N68335-17-C-0558), NSF (Award 1656926), and the Stanford Center for Blockchain Research.

A preliminary version of this work was published in the proceedings of CADE-27 [24]. The current article includes proofs, concrete axiomatizations for bitwise operators, more details on the evaluation, and a list of conditional inverses for bit-vector literals.

Rights and permissions

Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Niemetz, A., Preiner, M., Reynolds, A. et al. Towards Satisfiability Modulo Parametric Bit-vectors. J Autom Reasoning 65, 1001–1025 (2021). https://doi.org/10.1007/s10817-021-09598-9

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s10817-021-09598-9

Keywords

Navigation