Owf 2013 rii veri t fontaine speaker4

27
The solver David Déharbe, Pablo Federico Dobal, Pascal Fontaine,... VeriDis 4 octobre 2013 1/7

Transcript of Owf 2013 rii veri t fontaine speaker4

Page 1: Owf 2013 rii veri t fontaine speaker4

The solver

David Déharbe, Pablo Federico Dobal,Pascal Fontaine, . . .

VeriDis

4 octobre 2013 1 / 7

Page 2: Owf 2013 rii veri t fontaine speaker4

SAT and SMT solvers : what can they do for you

Automated reasoning, constraint solvingReason on (reasonably large) sets of factsDepending on the facts, more or less expressivity is requiredE.g. Sudokus can be expressed in SAT logic

Besides solving puzzles, SAT/SMT solvers are used for :planningconfiguration checkingplacementmodel checkingformal verification. . .

4 octobre 2013 2 / 7

Page 3: Owf 2013 rii veri t fontaine speaker4

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

Page 4: Owf 2013 rii veri t fontaine speaker4

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

Page 5: Owf 2013 rii veri t fontaine speaker4

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

Page 6: Owf 2013 rii veri t fontaine speaker4

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

Page 7: Owf 2013 rii veri t fontaine speaker4

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

Page 8: Owf 2013 rii veri t fontaine speaker4

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

Page 9: Owf 2013 rii veri t fontaine speaker4

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

Page 10: Owf 2013 rii veri t fontaine speaker4

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

Page 11: Owf 2013 rii veri t fontaine speaker4

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,4Number “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

Page 12: Owf 2013 rii veri t fontaine speaker4

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 4p1,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

Page 13: Owf 2013 rii veri t fontaine speaker4

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 4p1,2,1 ∨ p1,2,2 ∨ p1,2,3 ∨ p1,2,4Number “1” should be somewhere on line 1

p1,1,1 ∨ p1,2,1 ∨ p1,3,1 ∨ p1,4,1Number “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

Page 14: Owf 2013 rii veri t fontaine speaker4

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 4p1,2,1 ∨ p1,2,2 ∨ p1,2,3 ∨ p1,2,4Number “1” should be somewhere on line 1p1,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

Page 15: Owf 2013 rii veri t fontaine speaker4

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 4p1,2,1 ∨ p1,2,2 ∨ p1,2,3 ∨ p1,2,4Number “1” should be somewhere on line 1p1,1,1 ∨ p1,2,1 ∨ p1,3,1 ∨ p1,4,1Number “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

Page 16: Owf 2013 rii veri t fontaine speaker4

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 4p1,2,1 ∨ p1,2,2 ∨ p1,2,3 ∨ p1,2,4Number “1” should be somewhere on line 1p1,1,1 ∨ p1,2,1 ∨ p1,3,1 ∨ p1,4,1Number “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

Page 17: Owf 2013 rii veri t fontaine speaker4

SMT = SAT + expressiveness

SAT solvers

¬[(p⇒ q)⇒

[(¬p⇒ q)⇒ q

]]Congruence closure (uninterpreted symbols + equality)

a = b ∧[f (a) 6= f (b) ∨ (p(a) ∧ ¬p(b))

]adding arithmetic

a ≤ b ∧ b ≤ a + x ∧ x = 0 ∧[f (a) 6= 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

Page 18: Owf 2013 rii veri t fontaine speaker4

SMT internals

SMT formula

SMT solver

4 octobre 2013 6 / 7

Page 19: Owf 2013 rii veri t fontaine speaker4

SMT internals

SMT formula

SMT solver

SAT solver

4 octobre 2013 6 / 7

Page 20: Owf 2013 rii veri t fontaine speaker4

SMT internals

SMT formula

SMT solver

Boolean Model

SAT solver

4 octobre 2013 6 / 7

Page 21: Owf 2013 rii veri t fontaine speaker4

SMT internals

SMT formula

SMT solver

Boolean Model

Theoryreasoner SAT solver

4 octobre 2013 6 / 7

Page 22: Owf 2013 rii veri t fontaine speaker4

SMT internals

SMT formula

SMT solver

Boolean Model

Conflict clause

Theoryreasoner SAT solver

4 octobre 2013 6 / 7

Page 23: Owf 2013 rii veri t fontaine speaker4

SMT internals

SMT formula

SMT solverQuantifier-free SMT solver

Boolean Model

Conflict clause

Theoryreasoner SAT solver

4 octobre 2013 6 / 7

Page 24: Owf 2013 rii veri t fontaine speaker4

SMT internals

SMT formula

SMT solverQuantifier-free SMT solver

Boolean Model

Conflict clause

Theoryreasoner SAT solver

Model

4 octobre 2013 6 / 7

Page 25: Owf 2013 rii veri t fontaine speaker4

SMT internals

SMT formula

SMT solverQuantifier-free SMT solver

Boolean Model

Conflict clause

Theoryreasoner SAT solver

Instantiationmodule

Instance

Model

4 octobre 2013 6 / 7

Page 26: Owf 2013 rii veri t fontaine speaker4

SMT internals

SMT formula

SMT solverQuantifier-free SMT solver

Boolean Model

Conflict clause

Theoryreasoner SAT solver

Instantiationmodule

Instance

Model

Model UNSAT (proof/core)

4 octobre 2013 6 / 7

Page 27: Owf 2013 rii veri t fontaine speaker4

Conclusion

Reasoning on large formulas with arithmetic, functions, equalities,. . .

Applicationsplanningplacementbounded model-checkingverification. . .

The solver

http://www.verit-solver.org

BSD license

4 octobre 2013 7 / 7