Owf 2013 rii veri t fontaine speaker4

Post on 04-Jun-2015

103 views 1 download

Transcript of Owf 2013 rii veri t fontaine speaker4

The solver

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

VeriDis

4 octobre 2013 1 / 7

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

SMT internals

SMT formula

SMT solver

4 octobre 2013 6 / 7

SMT internals

SMT formula

SMT solver

SAT solver

4 octobre 2013 6 / 7

SMT internals

SMT formula

SMT solver

Boolean Model

SAT solver

4 octobre 2013 6 / 7

SMT internals

SMT formula

SMT solver

Boolean Model

Theoryreasoner SAT solver

4 octobre 2013 6 / 7

SMT internals

SMT formula

SMT solver

Boolean Model

Conflict clause

Theoryreasoner SAT solver

4 octobre 2013 6 / 7

SMT internals

SMT formula

SMT solverQuantifier-free SMT solver

Boolean Model

Conflict clause

Theoryreasoner SAT solver

4 octobre 2013 6 / 7

SMT internals

SMT formula

SMT solverQuantifier-free SMT solver

Boolean Model

Conflict clause

Theoryreasoner SAT solver

Model

4 octobre 2013 6 / 7

SMT internals

SMT formula

SMT solverQuantifier-free SMT solver

Boolean Model

Conflict clause

Theoryreasoner SAT solver

Instantiationmodule

Instance

Model

4 octobre 2013 6 / 7

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

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