2. SAT and SMT solvers : what can they do for you
Automated reasoning, constraint solving
Reason on (reasonably large) sets of facts
Depending on the facts, more or less expressivity is required
E.g. Sudokus can be expressed in SAT logic
Besides solving puzzles, SAT/SMT solvers are used for :
planning
configuration checking
placement
model checking
formal verification
. . .
4 octobre 2013 2 / 7
3. Using a SAT solver : a toy example
1
3
2
2
“or” : ∨
“and” : ∧
negation : ¬
line i, column j, there is x (pi,j,x)
4 octobre 2013 3 / 7
4. Using a SAT solver : a toy example
1
3
2
2
“or” : ∨
“and” : ∧
negation : ¬
line i, column j, there is x (pi,j,x)
Line 1, column 1, there is “1” :
4 octobre 2013 3 / 7
5. Using a SAT solver : a toy example
1
3
2
2
“or” : ∨
“and” : ∧
negation : ¬
line i, column j, there is x (pi,j,x)
Line 1, column 1, there is “1” : p1,1,1
4 octobre 2013 3 / 7
6. Using a SAT solver : a toy example
1
3
2
2
“or” : ∨
“and” : ∧
negation : ¬
line i, column j, there is x (pi,j,x)
Line 1, column 1, there is “1” : p1,1,1
Line 2, column 4, there is “3” :
4 octobre 2013 3 / 7
7. Using a SAT solver : a toy example
1
3
2
2
“or” : ∨
“and” : ∧
negation : ¬
line i, column j, there is x (pi,j,x)
Line 1, column 1, there is “1” : p1,1,1
Line 2, column 4, there is “3” : p2,4,3
4 octobre 2013 3 / 7
8. Using a SAT solver : a toy example
1
3
2
2
“or” : ∨
“and” : ∧
negation : ¬
line i, column j, there is x (pi,j,x)
Line 1, column 1, there is “1” : p1,1,1
Line 2, column 4, there is “3” : p2,4,3
At position (1, 2), there is only one number
4 octobre 2013 3 / 7
9. Using a SAT solver : a toy example
1
3
2
2
“or” : ∨
“and” : ∧
negation : ¬
line i, column j, there is x (pi,j,x)
Line 1, column 1, there is “1” : p1,1,1
Line 2, column 4, there is “3” : p2,4,3
At position (1, 2), there is only one number
¬p1,2,1 ∨ ¬p1,2,2
¬p1,2,1 ∨ ¬p1,2,3
¬p1,2,1 ∨ ¬p1,2,4
¬p1,2,2 ∨ ¬p1,2,3
¬p1,2,2 ∨ ¬p1,2,4
¬p1,2,3 ∨ ¬p1,2,4
4 octobre 2013 3 / 7
10. Using a SAT solver : a toy example
1
3
2
2
“or” : ∨
“and” : ∧
negation : ¬
line i, column j, there is x (pi,j,x)
4 octobre 2013 4 / 7
11. Using a SAT solver : a toy example
1
3
2
2
“or” : ∨
“and” : ∧
negation : ¬
line i, column j, there is x (pi,j,x)
At position (1, 2), there is either 1, 2, 3, or 4
4 octobre 2013 4 / 7
12. Using a SAT solver : a toy example
1
3
2
2
“or” : ∨
“and” : ∧
negation : ¬
line i, column j, there is x (pi,j,x)
At position (1, 2), there is either 1, 2, 3, or 4
p1,2,1 ∨ p1,2,2 ∨ p1,2,3 ∨ p1,2,4
4 octobre 2013 4 / 7
13. Using a SAT solver : a toy example
1
3
2
2
“or” : ∨
“and” : ∧
negation : ¬
line i, column j, there is x (pi,j,x)
At position (1, 2), there is either 1, 2, 3, or 4
p1,2,1 ∨ p1,2,2 ∨ p1,2,3 ∨ p1,2,4
Number “1” should be somewhere on line 1
4 octobre 2013 4 / 7
14. Using a SAT solver : a toy example
1
3
2
2
“or” : ∨
“and” : ∧
negation : ¬
line i, column j, there is x (pi,j,x)
At position (1, 2), there is either 1, 2, 3, or 4
p1,2,1 ∨ p1,2,2 ∨ p1,2,3 ∨ p1,2,4
Number “1” should be somewhere on line 1
p1,1,1 ∨ p1,2,1 ∨ p1,3,1 ∨ p1,4,1
4 octobre 2013 4 / 7
15. Using a SAT solver : a toy example
1
3
2
2
“or” : ∨
“and” : ∧
negation : ¬
line i, column j, there is x (pi,j,x)
At position (1, 2), there is either 1, 2, 3, or 4
p1,2,1 ∨ p1,2,2 ∨ p1,2,3 ∨ p1,2,4
Number “1” should be somewhere on line 1
p1,1,1 ∨ p1,2,1 ∨ p1,3,1 ∨ p1,4,1
Number “1” should be at most once on line 1
4 octobre 2013 4 / 7
16. Using a SAT solver : a toy example
1
3
2
2
“or” : ∨
“and” : ∧
negation : ¬
line i, column j, there is x (pi,j,x)
At position (1, 2), there is either 1, 2, 3, or 4
p1,2,1 ∨ p1,2,2 ∨ p1,2,3 ∨ p1,2,4
Number “1” should be somewhere on line 1
p1,1,1 ∨ p1,2,1 ∨ p1,3,1 ∨ p1,4,1
Number “1” should be at most once on line 1
¬p1,1,1 ∨ ¬p1,2,1
¬p1,1,1 ∨ ¬p1,3,1
¬p1,1,1 ∨ ¬p1,4,1
¬p1,2,1 ∨ ¬p1,3,1
¬p1,2,1 ∨ ¬p1,4,1
¬p1,3,1 ∨ ¬p1,4,1
4 octobre 2013 4 / 7
17. SMT = SAT + expressiveness
SAT solvers
¬ (p ⇒ q) ⇒ (¬p ⇒ q) ⇒ q
Congruence closure (uninterpreted symbols + equality)
a = b ∧ f(a) = f(b) ∨ (p(a) ∧ ¬p(b))
adding arithmetic
a ≤ b ∧ b ≤ a + x ∧ x = 0 ∧ f(a) = f(b) ∨ (p(a) ∧ ¬p(b + x))
. . .
Some examples : Barcelogic, CVC4 (SVC, CVC, CVC-lite, CVC3),
MathSAT, OpenSMT, Yices, Z3 . . .
The solver
4 octobre 2013 5 / 7
23. SMT internals
SMT formula
SMT solver
Quantifier-free SMT solver
Boolean Model
Conflict clause
Theory
reasoner
SAT solver
4 octobre 2013 6 / 7
24. SMT internals
SMT formula
SMT solver
Quantifier-free SMT solver
Boolean Model
Conflict clause
Theory
reasoner
SAT solver
Model
4 octobre 2013 6 / 7
25. SMT internals
SMT formula
SMT solver
Quantifier-free SMT solver
Boolean Model
Conflict clause
Theory
reasoner
SAT solver
Instantiation
module
Instance
Model
4 octobre 2013 6 / 7
26. SMT internals
SMT formula
SMT solver
Quantifier-free SMT solver
Boolean Model
Conflict clause
Theory
reasoner
SAT solver
Instantiation
module
Instance
Model
Model UNSAT (proof/core)
4 octobre 2013 6 / 7
27. Conclusion
Reasoning on large formulas with arithmetic, functions, equalities,. . .
Applications
planning
placement
bounded model-checking
verification
. . .
The solver
http://www.verit-solver.org
BSD license
4 octobre 2013 7 / 7