solving quantified bit vector formulas using binary
play

Solving Quantified Bit-Vector Formulas Using Binary Decision - PowerPoint PPT Presentation

Solving Quantified Bit-Vector Formulas Using Binary Decision Diagrams Martin Jon a s Jan Strej cek Masaryk University, Brno, Czech Republic Brussels September 7, 2016 1 / 13 Quantified bit-vector formulas x 32 y 32 ( y


  1. Solving Quantified Bit-Vector Formulas Using Binary Decision Diagrams Martin Jon´ aˇ s Jan Strejˇ cek Masaryk University, Brno, Czech Republic Brussels – September 7, 2016 1 / 13

  2. Quantified bit-vector formulas ∀ x 32 ∃ y 32 ( y � s 0 ∧ x + y = 0 ) Example: Quantified BV formulas naturally arise in software and hardware analysis, e.g. invariant synthesis ranking function synthesis loop summarization symbolic state comparision Traditionally solved by the model-based quantifier instantiation. 2 / 13

  3. When quantifier instantiation fails Consider the unsatisfiable formula a = 16 · b + 16 · c ∧ ∀ x ( a � = 16 · x ) . � �� � � �� � ϕ ψ Quantifier instances for all numbers divisible by 16 have to be added to show the unsatisfiability. 3 / 13

  4. When quantifier instantiation fails Consider the unsatisfiable formula a = 16 · b + 16 · c ∧ ∀ x ( a � = 16 · x ) . � �� � � �� � ϕ ψ Quantifier instances for all numbers divisible by 16 have to be added to show the unsatisfiability. Unsatisfiability could be shown by considering the instance ψ [ b + c ] , yielding a = 16 · b + 16 · c ∧ a � = 16 · ( b + c ) , but considering all possible terms is in general not feasible. 3 / 13

  5. Solution a = 16 · b + 16 · c ∧ ∀ x ( a � = 16 · x ) . � �� � � �� � ϕ ψ BDDs for subformulas can be build bottom-up using the standard BDD operations. 4 / 13

  6. Solution a = 16 · b + 16 · c ∧ ∀ x ( a � = 16 · x ) . � �� � � �� � ϕ ψ BDDs for subformulas can be build bottom-up using the standard BDD operations. The BDD for ∀ x ψ [ x ] is a 0 a 1 a 2 a 3 1 0 4 / 13

  7. Solution a = 16 · b + 16 · c ∧ ∀ x ( a � = 16 · x ) . � �� � � �� � ϕ ψ BDDs for subformulas can be build bottom-up using the standard BDD operations. The BDD for ∀ x ψ [ x ] is a 0 a 1 a 2 a 3 1 0 The BDD for the whole formula consists only of the node 0 . 4 / 13

  8. Towards BDD based SMT solver Simple conversion of a formula to BDD is not good enough. Our algorithm further relies on formula simplifications precomputed initial BDD variable ordering approximations 5 / 13

  9. Approximations What to do with the formula ∃ x ∀ y ( x · y = 0 ) ? Try to solve a simpler formula instead. 6 / 13

  10. Approximations What to do with the formula ∃ x ∀ y ( x · y = 0 ) ? Try to solve a simpler formula instead. Notion of approximations of ϕ : Underapproximation A formula ϕ such that ϕ | = ϕ . If ϕ is sat , ϕ is sat . Overapproximation A formula ϕ such that ϕ | = ϕ . If ϕ is unsat , ϕ is unsat . 6 / 13

  11. Approximations Represent some bit-vector variables by fewer bits – effective bit-width. Variable x of bit-width 6. Possible reductions to 3 effective bits: zero-extension 0 0 0 x 2 x 1 x 0 sign-extension x 2 x 2 x 2 x 2 x 1 x 0 right zero-extension x 5 x 4 x 3 0 0 0 right sign-extension x 5 x 4 x 3 x 3 x 3 x 3 7 / 13

  12. The algorithm 1 Apply simplifications up to the fixed point and convert the formula to the NNF. 8 / 13

  13. The algorithm 1 Apply simplifications up to the fixed point and convert the formula to the NNF. 2 Compute the initial ordering. 8 / 13

  14. The algorithm 1 Apply simplifications up to the fixed point and convert the formula to the NNF. 2 Compute the initial ordering. 3 Call computeBDD ( ϕ ) . If the root is 0 return unsat , else return sat . 8 / 13

  15. The algorithm 1 Apply simplifications up to the fixed point and convert the formula to the NNF. 2 Compute the initial ordering. 3 Call computeBDD ( ϕ ) . If the root is 0 return unsat , else return sat . 4 If the computation did not finish within 0.1 s, also run in parallel: – Sequentially try solving ϕ with bit-width 1, 2, 4, 6, . . . If any of BDDs has the root distinct from 0 , return sat . – Sequentially try solving ϕ with bit-width 1, 2, 4, 6, . . . If any of BDDs has the root 0 , return unsat . 8 / 13

  16. Experimental evaluation Implemented in a solver called Q3B. Written in C++, using BuDDy to perform BDD operations. Available at https://github.com/martinjonas/Q3B The solver was evaluated on all 191 benchmarks from the BV category of SMT-LIB 5 461 formulas generated by the symbolic model checker SymDivine when run on SV-COMP benchmarks 9 / 13

  17. Experimental evaluation – comparison CVC4 CVC4 100 Z3 Z3 CPU time (s) Q3B Q3B 10 1 0.1 0.01 0.001 0 40 80 120 160 200 0 2000 4000 6000 Solved SMT-LIB benchmarks Solved SymDivine benchmarks 10 / 13

  18. Experimental evaluation – comparison SMT-LIB sat unsat unknown timeout CVC4 29 55 32 75 Z3 71 93 5 22 Q3B 94 94 0 3 SymDivine sat unsat unknown timeout CVC4 1 124 3 845 2 490 Z3 1 135 4 162 22 142 Q3B 1 137 4 202 0 122 11 / 13

  19. SMT competition Q3B is the winner of BV category of SMT-COMP 2016. Known status Unknown status solved avg CPU solved avg CPU avg WALL Boolector 85 1.635 89 11 431 11 422 CVC4 85 1.576 56 29 464 29 453 Q3B 85 0.138 99 12 111 4 059 Z3 85 0.339 78 16 721 16 713 12 / 13

  20. Conclusion and future work Conclusion new algorithm for the SMT solving of quantified bit-vector formulas relies on BDDs, simplifications, tailored initial ordering, and approximations outperforms state-of-the art SMT solvers Z3, CVC4, and Boolector Future work finer refinement of approximations approximate functions and predicates, not only variables add uninterpreted functions and arrays 13 / 13

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend