Pluggable SAT-Solvers for SMT-Solvers Bas Schaafsma DISI, - - PowerPoint PPT Presentation

pluggable sat solvers for smt solvers
SMART_READER_LITE
LIVE PREVIEW

Pluggable SAT-Solvers for SMT-Solvers Bas Schaafsma DISI, - - PowerPoint PPT Presentation

Introduction The DPLL and DPLL( T ) algorithms Architecture & Implementation Experimental Evaluation Demo Conclusion & Future Work Pluggable SAT-Solvers for SMT-Solvers Bas Schaafsma DISI, University of Trento & Fondazione Bruno


slide-1
SLIDE 1

Introduction The DPLL and DPLL(T ) algorithms Architecture & Implementation Experimental Evaluation Demo Conclusion & Future Work

Pluggable SAT-Solvers for SMT-Solvers

Bas Schaafsma

DISI, University of Trento & Fondazione Bruno Kessler

May 29, 2013

http://mathsat.fbk.eu/ 1

slide-2
SLIDE 2

Introduction The DPLL and DPLL(T ) algorithms Architecture & Implementation Experimental Evaluation Demo Conclusion & Future Work The SAT/SMT problem Applications of SAT/SMT-Solvers Motivation

The SMT problem

The SAT problem Given a Boolean formula F, is there an assignment for which F evaluates to true? The SMT problem SAT extended with a set of theories T1 ∪ T2 · · · ∪ Tn Example (EUF ∪ LA(Z)): (x + 2y = 6 ∨ y = 9) ∧ ¬(f (x) = f (y)) ∧ x = 2

http://mathsat.fbk.eu/ 2

slide-3
SLIDE 3

Introduction The DPLL and DPLL(T ) algorithms Architecture & Implementation Experimental Evaluation Demo Conclusion & Future Work The SAT/SMT problem Applications of SAT/SMT-Solvers Motivation

Some Useful Theories

Theory of Linear Arithmetic (LA) FLA = L(x=) ∧ L(x<) Theory of BitVectors (BV) FBV = L(zext(x)) >u ) Theory of Arrays (ARR) FARR∪LA = L(read(a,)=) ∧ ¬L(read(write(a,,),i)=read(a,i))

http://mathsat.fbk.eu/ 3

slide-4
SLIDE 4

Introduction The DPLL and DPLL(T ) algorithms Architecture & Implementation Experimental Evaluation Demo Conclusion & Future Work The SAT/SMT problem Applications of SAT/SMT-Solvers Motivation

Applications of SMT-Solvers

  • Bounded Model Checking
  • Equivalence Testing [GPB01]
  • Property Driven Reachability Testing [CNR12]
  • Scheduling [ABP+11]
  • Test Case Generation [GLM12]
  • Software model checking through Predicate Abstraction

[FQ02]

  • Program Synthesis [SGCF11]
  • ...

http://mathsat.fbk.eu/ 4

slide-5
SLIDE 5

Introduction The DPLL and DPLL(T ) algorithms Architecture & Implementation Experimental Evaluation Demo Conclusion & Future Work The SAT/SMT problem Applications of SAT/SMT-Solvers Motivation

Pluggable SAT solvers: Motivation

  • Developing a new (allround) SMT solver entails more than a

new SAT solver. → MathSAT5 ∼ 150kloc vs MiniSAT ∼ 6kloc

  • Success of SAT solvers highly dependent on heuristics.
  • Tuning SAT solvers requires investment of time and money.
  • SAT-Solver is a deciding factor for BV & BV ∪ ARR

instances.

  • We want to combine state-of-the-art SAT solvers & SMT

solvers.

  • This is NOT a straight forward bitblasting approach.

http://mathsat.fbk.eu/ 5

slide-6
SLIDE 6

Introduction The DPLL and DPLL(T ) algorithms Architecture & Implementation Experimental Evaluation Demo Conclusion & Future Work The SAT/SMT problem Applications of SAT/SMT-Solvers Motivation

1

Introduction

2

The DPLL and DPLL(T ) algorithms

3

Architecture & Implementation

4

Experimental Evaluation

5

Demo

6

Conclusion & Future Work

http://mathsat.fbk.eu/ 6

slide-7
SLIDE 7

Introduction The DPLL and DPLL(T ) algorithms Architecture & Implementation Experimental Evaluation Demo Conclusion & Future Work The DPLL algorithm The DPLL(T ) algorithm

The DPLL algorithm

1: Preprocess(F) 2: while true do 3:

BCP(F)

4:

if not conflict then

5:

if all variables assigned then

6:

return SAT

7:

end if

8:

decide()

9:

else

10:

Cconflict ←analyze()

11:

if top level conflict found then

12:

return UNSAT

13:

end if

14:

backtrack(Cconflict)

15:

end if

16: end while

http://mathsat.fbk.eu/ 7

slide-8
SLIDE 8

Introduction The DPLL and DPLL(T ) algorithms Architecture & Implementation Experimental Evaluation Demo Conclusion & Future Work The DPLL algorithm The DPLL(T ) algorithm

DPLL(T ) = DPLL + ..

  • For correctness:

Theory consistency checks. Case splitting.

  • For optimization:

Early pruning. Theory deductions.

  • (Incrementality)

For specific details check [ST09].

http://mathsat.fbk.eu/ 8

slide-9
SLIDE 9

Introduction The DPLL and DPLL(T ) algorithms Architecture & Implementation Experimental Evaluation Demo Conclusion & Future Work The DPLL algorithm The DPLL(T ) algorithm

(Simplified) DPLL(T ) algorithm

1: Preprocess(F) 2: while true do 3:

BCP(F)

4:

if not conflict and theories consistent then

5:

if all variables assigned and no case splitting needed. then

6:

return SAT

7:

end if

8:

decide()

9:

else

10:

Cconflict ←analyze()

11:

if top level conflict found then

12:

return UNSAT

13:

end if

14:

backtrack(Cconflict)

15:

end if

16: end while

http://mathsat.fbk.eu/ 9

slide-10
SLIDE 10

Introduction The DPLL and DPLL(T ) algorithms Architecture & Implementation Experimental Evaluation Demo Conclusion & Future Work Architectural Overview Communication Protocols Case Studies

DPLL(T ) Architectural Overview

Theory Manager T -Solver1 T -Solvern

..

SAT/UNSAT Predicate Assignments Conflicts/ Generated Lemmas Finput UNSAT Core / Interpolant / Model Internal SAT-Solver

API

Theory Solvers

http://mathsat.fbk.eu/ 10

slide-11
SLIDE 11

Introduction The DPLL and DPLL(T ) algorithms Architecture & Implementation Experimental Evaluation Demo Conclusion & Future Work Architectural Overview Communication Protocols Case Studies

DPLL(T ) + Pluggable Solver Architectural Overview

Theory Manager T -Solver1 T -Solvern

..

SAT/UNSAT Predicate Assignments Conflicts/ Generated Lemmas Finput UNSAT Core / Interpolant / Model SAT-Solver Stub

API

Theory Solvers Pluggable Solver Callback functions SAT API calls

http://mathsat.fbk.eu/ 11

slide-12
SLIDE 12

Introduction The DPLL and DPLL(T ) algorithms Architecture & Implementation Experimental Evaluation Demo Conclusion & Future Work Architectural Overview Communication Protocols Case Studies

Pluggable SAT solvers: A quick overview

  • 3rd Party SAT solvers can be plugged in MathSAT5 by:

Implementing a worker interface. Invoking required callback functions during search.

  • The worker interface allows MathSAT5 to:

Specify the problem for the SAT solver to solve. Communicate deduced values.

  • Callbacks allow the SAT solver to:

Communicate found (partial) models to MathSAT5 Invoke T -consistency checks.

http://mathsat.fbk.eu/ 12

slide-13
SLIDE 13

Introduction The DPLL and DPLL(T ) algorithms Architecture & Implementation Experimental Evaluation Demo Conclusion & Future Work Architectural Overview Communication Protocols Case Studies

Pluggable SAT solvers: Requirements

  • Must be able to act as an enumerator.
  • Should support, solving under assumptions.
  • Able to create new variables, add new clauses during search.
  • Support variable freezing and reintroduction of eliminated

variables.

  • In order to support popping, must be able to delete all clauses

containing certain variables.

http://mathsat.fbk.eu/ 13

slide-14
SLIDE 14

Introduction The DPLL and DPLL(T ) algorithms Architecture & Implementation Experimental Evaluation Demo Conclusion & Future Work Architectural Overview Communication Protocols Case Studies

Worker Interface Functions

void s o l v e ( std : : vector <int >& assump , std : : vector <int >& c assump ) ; bool add clause ( std : : vector <int >& clause , bool permanent , bool d u r i n g c a l l b a c k ) ; void s e t f r o z e n ( i n t var , bool b ) ; i n t new var ( bool p o l a r i t y , bool dvar ) ; void enqueue assignment ( i n t assignment ) ; void r em ov e cl a u s es con t a i n i n g ( i n t v ) ;

http://mathsat.fbk.eu/ 14

slide-15
SLIDE 15

Introduction The DPLL and DPLL(T ) algorithms Architecture & Implementation Experimental Evaluation Demo Conclusion & Future Work Architectural Overview Communication Protocols Case Studies

Callback functions

TCODE n o c o n f l i c t a t e r b c p ( std : : vector <int >& conf ) ; TCODE model found ( std : : vector <int >& c o n f l i c t ) ; void inform hook of assignment ( i n t assignment ) ; void i n f or m h ook of n e w l e v e l ( ) ; void i n f or m h ook of b a c k t r a c k ( i n t l e v e l ) ; void a s k h o o k f o r t r e a s o n ( i n t assignment , std : : vector <int >& r ) ;

http://mathsat.fbk.eu/ 15

slide-16
SLIDE 16

Introduction The DPLL and DPLL(T ) algorithms Architecture & Implementation Experimental Evaluation Demo Conclusion & Future Work Architectural Overview Communication Protocols Case Studies

Pluggable SAT solvers: Two Case Studies

  • Extending Minisat (& Cleaneling).
  • Extending Fiver.

http://mathsat.fbk.eu/ 16

slide-17
SLIDE 17

Introduction The DPLL and DPLL(T ) algorithms Architecture & Implementation Experimental Evaluation Demo Conclusion & Future Work Architectural Overview Communication Protocols Case Studies

Case Study A: Extending Minisat

  • The internal addClause method should be changed such that:

Clauses are added at the correct level. For conflicts, jump back to the level, the conflict was introduced.

  • The analyze method must take into account that assignments

can be from deductions, asking the reason if necessary.

  • After each round of BCP, in search which does not result in,

theory propagation should be called -until fixpoint-.

http://mathsat.fbk.eu/ 17

slide-18
SLIDE 18

Introduction The DPLL and DPLL(T ) algorithms Architecture & Implementation Experimental Evaluation Demo Conclusion & Future Work Architectural Overview Communication Protocols Case Studies

  • Once a complete model has been found a complete theory

check should be called.

  • Changing cleaneling is pretty similar!
  • Example implementations for pluggable versions of Minisat &

Cleaneling are available @ http://mathsat.fbk.eu.

  • The changes required for each solver are around 180 lines of

code.

  • Does not support variable elimination.

http://mathsat.fbk.eu/ 18

slide-19
SLIDE 19

Introduction The DPLL and DPLL(T ) algorithms Architecture & Implementation Experimental Evaluation Demo Conclusion & Future Work Architectural Overview Communication Protocols Case Studies

Case Study B: Extending Fiver

  • Done completely at Intel. -minus some help in debugging-
  • Supports preprocessing!

http://mathsat.fbk.eu/ 19

slide-20
SLIDE 20

Introduction The DPLL and DPLL(T ) algorithms Architecture & Implementation Experimental Evaluation Demo Conclusion & Future Work Industrial BV instances SMT-Comp BV ∪ ARR instances

Analysis of pluggable solver performance on Intel BV instances

10 20 30 40 50 60 70 10 20 30 40 50 60 70 80 Reached bound Instance # MathSAT MathSAT + Fiver

http://mathsat.fbk.eu/ 20

slide-21
SLIDE 21

Introduction The DPLL and DPLL(T ) algorithms Architecture & Implementation Experimental Evaluation Demo Conclusion & Future Work Industrial BV instances SMT-Comp BV ∪ ARR instances

Analysis of pluggable solver performance on BV ∪ ARR instances

Benchmark Family Size MathSAT5MiniSat #Solved RT (sec) #TO #MO brummayerbiere2 22 15 1831 5 2 brummayerbiere 293 184 17044 97 12 calc2 36 36 4183 stp 40 29 1765 3 8 Benchmark Family Size MathSAT5 #Solved RT (sec) #TO #MO brummayerbiere2 22 15 2218 5 2 brummayerbiere 293 229 25698 64 calc2 36 30 7855 6 stp 40 26 2659 6 8

http://mathsat.fbk.eu/ 21

slide-22
SLIDE 22

Introduction The DPLL and DPLL(T ) algorithms Architecture & Implementation Experimental Evaluation Demo Conclusion & Future Work

DEMO

http://mathsat.fbk.eu/ 22

slide-23
SLIDE 23

Introduction The DPLL and DPLL(T ) algorithms Architecture & Implementation Experimental Evaluation Demo Conclusion & Future Work Conclusion Future Work

Conclusion

We have presented a framework with which SAT-Solvers can be plugged in MathSAT5 and used transparently. Next we have demonstrated the utility of such an approach on different instances.

http://mathsat.fbk.eu/ 23

slide-24
SLIDE 24

Introduction The DPLL and DPLL(T ) algorithms Architecture & Implementation Experimental Evaluation Demo Conclusion & Future Work Conclusion Future Work

Future Work

  • Provide support for proof logging, needed for other MathSAT

functionalities such as Interpolation.

  • Experiment with different type enumerators such as

look-ahead Solvers.

  • Experiment with pluggable Theory Solvers.

http://mathsat.fbk.eu/ 24

slide-25
SLIDE 25

Introduction The DPLL and DPLL(T ) algorithms Architecture & Implementation Experimental Evaluation Demo Conclusion & Future Work Conclusion Future Work

Questions?

http://mathsat.fbk.eu

http://mathsat.fbk.eu/ 25

slide-26
SLIDE 26

Introduction The DPLL and DPLL(T ) algorithms Architecture & Implementation Experimental Evaluation Demo Conclusion & Future Work Conclusion Future Work

References I

[ABP+11] Carlos Ans´

  • tegui, Miquel Bofill, Miquel Palah´

ı, Josep Suy, and Mateu Villaret. Satisfiability modulo theories: An efficient approach for the resource-constrained project scheduling problem. In SARA, 2011. [CNR12] Alessandro Cimatti, Iman Narasamdya, and Marco Roveri. Verification of Parametric System Designs. In Proc. FMCAD. FMCAD, 2012.

http://mathsat.fbk.eu/ 26

slide-27
SLIDE 27

Introduction The DPLL and DPLL(T ) algorithms Architecture & Implementation Experimental Evaluation Demo Conclusion & Future Work Conclusion Future Work

References II

[FQ02] Cormac Flanagan and Shaz Qadeer. Predicate abstraction for software verification. In Proceedings of the 29th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, POPL ’02, pages 191–202, New York, NY, USA, 2002. ACM. [GLM12] Patrice Godefroid, Michael Y. Levin, and David Molnar. Sage: Whitebox fuzzing for security testing. Queue, 10(1):20:20–20:27, January 2012. [GPB01] Evgueni Goldberg, Mukul R. Prasad, and Robert K. Brayton. Using sat for combinational equivalence checking, 2001.

http://mathsat.fbk.eu/ 27

slide-28
SLIDE 28

Introduction The DPLL and DPLL(T ) algorithms Architecture & Implementation Experimental Evaluation Demo Conclusion & Future Work Conclusion Future Work

References III

[SGCF11] Saurabh Srivastava, Sumit Gulwani, Swarat Chaudhuri, and Jeffrey S. Foster. Path-based inductive synthesis for program inversion. In PLDI, pages 492–503, 2011. [ST09] Roberto Sebastiani and Armando Tacchella. SAT Techniques for Modal and Description Logics. In Handbook of Satisfiability, chapter 25, pages 781–824. IOS Press, 2009.

http://mathsat.fbk.eu/ 28