A Survey of Satisfiability Modulo Theory (for mathematicians) David - - PowerPoint PPT Presentation

a survey of satisfiability modulo theory
SMART_READER_LITE
LIVE PREVIEW

A Survey of Satisfiability Modulo Theory (for mathematicians) David - - PowerPoint PPT Presentation

A Survey of Satisfiability Modulo Theory (for mathematicians) David Monniaux VERIMAG GNCS, Pescara, February 10, 2017 David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 1 / 48 STATOR SMT = SAT + theories SAT =


slide-1
SLIDE 1

STATOR

A Survey of Satisfiability Modulo Theory

(for mathematicians) David Monniaux

VERIMAG

GNCS, Pescara, February 10, 2017

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 1 / 48

slide-2
SLIDE 2

STATOR

SMT = SAT + theories

SAT = say whether a formula over Booleans is satisfiable (and give a model if so) SMT = say whether a formula over Booleans and other types is satisfiable (and give a model if so) (x ≤ 0 ∨ x + y ≤ 0) ∧ y ≥ 1 ∧ x ≥ 1 unsatisfiable for x, y ∈ R (x ≤ 0 ∨ x + y ≤ 0) ∧ y ≥ 1 satisfiable for x, y ∈ Z Here theory = linear real arithmetic (LRA) or linear integer arithmetic (LIA)

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 2 / 48

slide-3
SLIDE 3

STATOR

DPLL and CDCL

Contents

DPLL and CDCL DPLL(T) Natural domain SMT Exponential behaviour of DPLL(T) Abstract CDCL (ACDCL) Model-construction satisfiability calculus (MCSAT) Other topics Conclusion

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 3 / 48

slide-4
SLIDE 4

STATOR

DPLL and CDCL

Propositional satisfiability (SAT)

Input: formula with ∧, ∨ (possibly “if then else”, “exclusive-or” etc.) ( (a ∧ ¯ b ∧ ¯ c) ∨ (b ∧ c ∧ ¯ d) ) ∧ (¯ b ∨ ¯ c) . Output: “unsat” or a model (satisfying assignment)

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 4 / 48

slide-5
SLIDE 5

STATOR

DPLL and CDCL

Conjonction normal form (CNF)

View the SAT formula as a system of constraints = clauses (disjunctions of literals a or ¯ a) convert from arbitrary formula to CNF cannot be done efgiciently keeping only original variables (exponential blowup, per distributivity) (a ∨ b) ∧ (c ∨ d) − → (a ∧ c) ∨ (a ∧ d) ∨ (b ∧ c) ∨ (b ∧ d)

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 5 / 48

slide-6
SLIDE 6

STATOR

DPLL and CDCL

Tseitin encoding

Add extra variables ( (a ∧ ¯ b ∧ ¯ c) ∨ (b ∧ c ∧ ¯ d) ) ∧ (¯ b ∨ ¯ c) . Assign propositional variables to sub-formulas: e ≡ a ∧ ¯ b ∧ ¯ c f ≡ b ∧ c ∧ ¯ d g ≡ e ∨ f h ≡ ¯ b ∨ ¯ c ϕ ≡ g ∧ h ;

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 6 / 48

slide-7
SLIDE 7

STATOR

DPLL and CDCL

Tseitin encoding

e ≡ a ∧ ¯ b ∧ ¯ c f ≡ b ∧ c ∧ ¯ d g ≡ e ∨ f h ≡ ¯ b ∨ ¯ c ϕ ≡ g ∧ h ; turned into clauses ¯ e ∨ a ¯ e ∨ ¯ b ¯ e ∨ ¯ c ¯ a ∨ b ∨ c ∨ e ¯ f ∨ b ¯ f ∨ c ¯ f ∨ d ¯ b ∨ ¯ c ∨ d ∨ f ¯ e ∨ g ¯ f ∨ g ¯ g ∨ e ∨ f b ∨ h c ∨ h ¯ h ∨ ¯ b ∨ ¯ c ¯ ϕ ∨ g ¯ ϕ ∨ h ¯ g ∨ ¯ h ∨ ϕ ϕ

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 7 / 48

slide-8
SLIDE 8

STATOR

DPLL and CDCL

DPLL

Each clause acts as propagator e.g. assuming a and ¯ b, clause ¯ a ∨ b ∨ c yields c Boolean constraint propagation aka unit propagation: propagate as much as possible

  • nce the value of a variable is known, use it elsewhere

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 8 / 48

slide-9
SLIDE 9

STATOR

DPLL and CDCL

DPLL: Branching

If unit propagation insufgicient to

▶ either find a satisfying assignment ▶ either find an unsatisfiable clause (all literals forced to false)

Then:

▶ pick a variable ▶ do a search subtree for both polarities of the variable

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 9 / 48

slide-10
SLIDE 10

STATOR

DPLL and CDCL

Example

¯ e ∨ a ¯ e ∨ ¯ b ¯ e ∨ ¯ c ¯ a ∨ b ∨ c ∨ e ¯ f ∨ b ¯ f ∨ c ¯ f ∨ d ¯ b ∨ ¯ c ∨ d ∨ f ¯ e ∨ g ¯ f ∨ g ¯ g ∨ e ∨ f b ∨ h c ∨ h ¯ h ∨ ¯ b ∨ ¯ c ¯ ϕ ∨ g ¯ ϕ ∨ h ¯ g ∨ ¯ h ∨ ϕ ϕ From unit clause ϕ ¯ ϕ ∨ g → g ¯ ϕ ∨ h → h ¯ g ∨ ¯ h ∨ ϕ removed Now g and h are t, ¯ e ∨ g removed ¯ f ∨ g removed b ∨ h removed c ∨ h removed ¯ g ∨ e ∨ f → e ∨ f ¯ h ∨ ¯ b ∨ ¯ c → ¯ b ∨ ¯ c

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 10 / 48

slide-11
SLIDE 11

STATOR

DPLL and CDCL

CDCL: clause learning

A DPLL branch gets closed by contradiction: a literal gets forced to both t and f. Both t and f inferred from hypotheses H by unit propagation. Trace back to a subset of hypotheses, sufgicient for contradiction. e.g. a ∧ ¯ b ∧ ¯ c ∧ d ∧ H = ⇒ f Learn clause = negation of bad hypotheses, implies by H: ¯ a ∨ b ∨ c ∨ ¯ d Add this clause (maybe garbage-collected later) to H Used by unit propagation

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 11 / 48

slide-12
SLIDE 12

STATOR

DPLL and CDCL

Proof systems

DPLL Tree resolution CDCL DAG resolution (shared proof subtrees) = linear resolution Some problems have exponentially smaller proofs in DAG than tree resolution. (Independent of search strategy.)

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 12 / 48

slide-13
SLIDE 13

STATOR

DPLL and CDCL

Implementation wise

Clause simplification etc. implemented as two watched literals per clause Pointers to clauses used for deduction Highly optimized proof engines

▶ Minisat ▶ Glucose

Preprocessing

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 13 / 48

slide-14
SLIDE 14

STATOR

DPLL(T)

Contents

DPLL and CDCL DPLL(T) Natural domain SMT Exponential behaviour of DPLL(T) Abstract CDCL (ACDCL) Model-construction satisfiability calculus (MCSAT) Other topics Conclusion

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 14 / 48

slide-15
SLIDE 15

STATOR

DPLL(T)

DPLL(T)

(Improper terminology, should be CDCL(T)) (x ≤ 0 ∨ x + y ≤ 0) ∧ y ≥ 1 ∧ x ≥ 1 ↓ dictionary of theory literals (a ∨ b) ∧ c ∧ d Solve, get (a, b, c, d) = (t, f, t, t). But x ≤ 0 ∧ x ≥ 1 is a contradiction! Add theory lemma ¯ a ∨ ¯ d Solve, get (a, b, c, d) = (f, t, t, t). But x + y ≤ 0∧ ≥ 1 ∧ x ≥ 1 is a contradiction! Add theory lemma ¯ b ∨ ¯ c ∨ ¯ d. The problem is unsatisfiable.

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 15 / 48

slide-16
SLIDE 16

STATOR

DPLL(T)

DPLL(T)

In practice, do not wait for the CDCL solver to provide a full assignment. Check partial assignments for theory feasibility. If during theory processing, a literal becomes known to be t or f, propagate it to CDCL. e.g. x ≥ 0, x ≥ 1 assigned, propagate x + y ≥ 0 Boolean relaxation of the original problem. Lazy expansion of theory.

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 16 / 48

slide-17
SLIDE 17

STATOR

DPLL(T)

Linear real arithmetic

Usually decided by exact precision simplex. Extract from the tableau the contradictory subset of assignments.

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 17 / 48

slide-18
SLIDE 18

STATOR

DPLL(T)

LRA Example

           2 ≤ 2x + y −6 ≤ 2x − 3y −1000 ≤ 2x + 3y ≤ 18 −2 ≤ −2x + 5y 20 ≤ x + y . (1)

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 18 / 48

slide-19
SLIDE 19

STATOR

DPLL(T)

LRA Example

           a = 2x +y 2 ≤ a b = 2x −3y −6 ≤ b c = 2x 3y −1000 ≤ c ≤ 18 d = −2x +5y −2 ≤ d e = x +y 20 ≤ e . (2)

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 19 / 48

slide-20
SLIDE 20

STATOR

DPLL(T)

LRA Example

Gauss-like pivoting until:            e = 7/16c −1/16d a = 3/4c −1/4d b = 1/4c −3/4d x = 5/16c −3/16d y = 1/8c +1/8d . (3)

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 20 / 48

slide-21
SLIDE 21

STATOR

DPLL(T)

LRA Example

e = 7/16c − 1/16d But: c ≤ 18 and d ≥ −2, so −7/16c − 1/16d ≤ 8. But we have e ≥ 20, thus no solution. Relevant original inequalities can be combined into an unsatisfiable

  • ne (thus the theory lemma)

7/16 (−2x −3y) ≥ −7/16 ×18 1/16 (−2x +5y) ≥ −1/16 ×2 1 x +y ≥ 20 ≥ 12 (4)

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 21 / 48

slide-22
SLIDE 22

STATOR

DPLL(T)

Linear integer arithmetic

Linear real arithmetic +

▶ branching: if LRA model x = 4.3, then x ≤ 4 ∨ x ≥ 5 ▶ (sometimes) Gomory cuts

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 22 / 48

slide-23
SLIDE 23

STATOR

DPLL(T)

Uninterpreted functions

f(x) ̸= f(y) ∧ x = z + 1 ∧ z = y − 1 ↓ fx ̸= fy ∧ x = z + 1 ∧ z = y − 1 Get (x, y, z, fx, fy) = (1, 1, 0, 0, 1). But if x = y then fx = fy! Add x = y = ⇒ fx = fy. The problem over (x, y, z, fx, fy) becomes unsatisfiable.

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 23 / 48

slide-24
SLIDE 24

STATOR

DPLL(T)

Arrays

update(f, x0, y0) the function mapping

▶ x ̸= x0 to f[x] ▶ x0 to y0.

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 24 / 48

slide-25
SLIDE 25

STATOR

DPLL(T)

Qvantifiers

Show this formula is true: (∀i 0 ≤ i < j = ⇒ t[i ] = 42) = ⇒ (∀i 0 ≤ i ≤ j = ⇒ update(t, j, 0)[i ] = 42) (5) Equivalently, unsatisfiable: 0 ≤ i0 ≤ j ∧ update(t, j, 0)[i0 ] = 0 ∧ (∀i 0 ≤ i < j = ⇒ t[i ] = 0)

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 25 / 48

slide-26
SLIDE 26

STATOR

DPLL(T)

Instantiation

Prove unsatisfiable: 0 ≤ i0 ≤ j ∧ update(t, j, 0)[i0 ] = 0 ∧ (∀i 0 ≤ i < j = ⇒ t[i ] = 0) By instantiation i = i0: 0 ≤ i0 ≤ j ∧ update(t, j, 0)[i0 ] = 0 ∧ (0 ≤ i0 < j = ⇒ t[i0 ] = 0) Unsatisfiable

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 26 / 48

slide-27
SLIDE 27

STATOR

Natural domain SMT

Contents

DPLL and CDCL DPLL(T) Natural domain SMT Exponential behaviour of DPLL(T) Abstract CDCL (ACDCL) Model-construction satisfiability calculus (MCSAT) Other topics Conclusion

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 27 / 48

slide-28
SLIDE 28

STATOR

Natural domain SMT

DPLL(T) versus natural domain

DPLL(T) Boolean abstraction of the formula Assign only to Boolean variables Then refine abstraction by cubes unsatisfiable wrt theory Natural domain Assign to Boolean and arithmetic variables

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 28 / 48

slide-29
SLIDE 29

STATOR

Natural domain SMT Exponential behaviour of DPLL(T)

Diamonds

D(n) the unsatisfiable formula: for 0 ≤ i < n    xi − ti ≤ 2 yi − ti ≤ 3 (ti+1 − xi ≤ 3) ∨ (ti+1 − yi ≤ 2) tn − t0 > 5n

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 29 / 48

slide-30
SLIDE 30

STATOR

Natural domain SMT Exponential behaviour of DPLL(T)

DPLL(T) on diamonds

Will enumerate each combination of disjuncts = All terms in disjunctive normal form Fundamental limitation: can only use atoms from original formula.

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 30 / 48

slide-31
SLIDE 31

STATOR

Natural domain SMT Abstract CDCL (ACDCL)

Abstract CDCL

DPLL / CDCL assign truth values to Booleans ↓ generalization ACDCL assigns truth values to Booleans and intervals to reals (or elements from an abstract domain) e.g. if current assignment x ∈ [1, +∞) and y = [4, 10] constraint z = x − y ⇝ x ∈ [−9, +∞) If too coarse, split intervals. Akin to constraint programming.

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 31 / 48

slide-32
SLIDE 32

STATOR

Natural domain SMT Abstract CDCL (ACDCL)

Learning in ACDCL

Constraints x ∧ z = x · y ∧ z ≤ −1 Search context x ≤ −4, contradiction. Contradiction ensured by x < 0 weaker than search context. Learn x < 0. Predicate not in original formula. (CDCL-style learning would only learn x > −4.)

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 32 / 48

slide-33
SLIDE 33

STATOR

Natural domain SMT Model-construction satisfiability calculus (MCSAT)

MCSAT

In DPLL(T), assign only to Booleans and atoms from original formula. In MCSAT, assign to propositional atoms and numeric variables x1, . . . , xn, . . . When finding an impossibility when trying to assign to xn+1, derive a general impossibility on x1, . . . , xn (partial projection).

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 33 / 48

slide-34
SLIDE 34

STATOR

Natural domain SMT Model-construction satisfiability calculus (MCSAT)

Example: diamonds

for 0 ≤ i ≤ 2    xi − ti ≤ 2 yi − ti ≤ 3 ti+1 − xi ≤ 3 ∨ ti+1 − yi ≤ 2 t0 = 0 t3 ≥ 16 Pick t0 → 0, t1 − x0 ≤ 3 → t, x0 → 0, t1 → 0, t2 − x1 ≤ 3 → t, x1 → 0, t2 → 0, t3 − x2 ≤ 3 → t, x2 → 0. No way to assign to x3! Because x2 → 0 and t3 − x2 ≤ 3 and t3 ≥ 16.

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 34 / 48

slide-35
SLIDE 35

STATOR

Natural domain SMT Model-construction satisfiability calculus (MCSAT)

Analyze the failure

x2 → 0 fails due to a more general reason (Fourier-Motzkin) { t3 − x2 ≤ 3 t3 ≥ 16 = ⇒ x2 ≥ 13 Possible to learn t3 − x2 > 3 ∨ x2 ≥ 13 Retract x2 → 0.

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 35 / 48

slide-36
SLIDE 36

STATOR

Natural domain SMT Model-construction satisfiability calculus (MCSAT)

Backtracking

We have learnt t3 − x2 > 3 ∨ x2 ≥ 13. t3 − x2 ≤ 3 still assigned. { x2 ≥ 13x2 − t2 ≤ 2 = ⇒ t2 ≥ 11 Thus learn t3 − x2 > 3 ∨ t2 ≥ 11 t3 − x2 ≤ 3 → t retracted.

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 36 / 48

slide-37
SLIDE 37

STATOR

Natural domain SMT Model-construction satisfiability calculus (MCSAT)

Continuation

Same reasoning for t3 − x2 ≤ 3 → f yields by learning t3 − x2 ≤ 3 ∨ t2 ≥ 11 Thus { t3 − x2 > 3 ∨ t2 ≥ 11 t3 − x2 ≤ 3 ∨ t2 ≥ 11 = ⇒ t2 ≥ 11 One learns t2 ≥ 11. Then t1 ≥ 6 similarly. But then no satisfying assignment to t0!

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 37 / 48

slide-38
SLIDE 38

STATOR

Natural domain SMT Model-construction satisfiability calculus (MCSAT)

NLSAT

(Dejan Jovanović, Leonardo De Moura) MCSAT for non-linear arithmetic Partial projection: Fourier-Motzkin replaced by partial cylindrical algebraic decomposition.

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 38 / 48

slide-39
SLIDE 39

STATOR

Other topics

Contents

DPLL and CDCL DPLL(T) Natural domain SMT Exponential behaviour of DPLL(T) Abstract CDCL (ACDCL) Model-construction satisfiability calculus (MCSAT) Other topics Conclusion

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 39 / 48

slide-40
SLIDE 40

STATOR

Other topics

Optimization

Basic SMT: “no solution” vs “here is a solution” Optimization: here is a solution maximizing f

▶ binary search ▶ local optimization: ∧ li =

⇒ ϕ linear programming in ∧ li and even done for nonlinear arithmetic!

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 40 / 48

slide-41
SLIDE 41

STATOR

Other topics

Qvantifier elimination

F with quantifiers ≡ G without quantifiers Use SMT to prune out / simplify inside quantifier elimination (do not generate partial solutions already covered etc.)

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 41 / 48

slide-42
SLIDE 42

STATOR

Other topics

Formula simplification

F complicated ≡ G “simpler” Use SMT to prune out / simplify

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 42 / 48

slide-43
SLIDE 43

STATOR

Other topics

Craig interpolation

From F(⃗ x,⃗ y) = ⇒ G(⃗ y,⃗ z) get F(⃗ x,⃗ y) = ⇒ I(⃗ y) = ⇒ G(⃗ y,⃗ z) I can be obtained by quantifier elimination but may be much simpler! In fact ofuen needs I “simple”.

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 43 / 48

slide-44
SLIDE 44

STATOR

Conclusion

Contents

DPLL and CDCL DPLL(T) Natural domain SMT Exponential behaviour of DPLL(T) Abstract CDCL (ACDCL) Model-construction satisfiability calculus (MCSAT) Other topics Conclusion

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 44 / 48

slide-45
SLIDE 45

STATOR

Conclusion

Basic idea

▶ relax the problem ▶ solve relaxed problem ▶ if spurious solution, refine the problem

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 45 / 48

slide-46
SLIDE 46

STATOR

Conclusion

Nonexhaustive list of SMT-solvers

See also http://smtlib.cs.uiowa.edu/

http://smtlib.cs.uiowa.edu/solvers.shtml

Free

▶ Z3 (Microsofu Research) https://github.com/Z3Prover ▶ Yices (SRI International) http://yices.csl.sri.com/ ▶ CVC4 http://cvc4.cs.nyu.edu/web/

Non-free

▶ MathSAT (Fundazione Bruno Kessler)

http://mathsat.fbk.eu/

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 46 / 48

slide-47
SLIDE 47

STATOR

Conclusion

VERIMAG

Joint research unit between

▶ Université Grenoble-Alpes ▶ Grenoble institute of technology (Grenoble-INP) ▶ CNRS

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 47 / 48

slide-48
SLIDE 48

STATOR

Conclusion

Gratuitous advertisements

▶ (Static analysis) ▶ Improvements to SMT. ▶ Relaxation of nonlinear constraints. ▶ Polyhedra library (like E. Zafganella)

http://verasco.imag.fr/wiki/VPL https://github.com/VERIMAG-Polyhedra/VPL

▶ Assistant professor position open at VERIMAG (some conditions

apply, check with me)

▶ Ask me about our master scholarship and PhD program

David Monniaux (VERIMAG) A Survey of Satisfiability Modulo Theory 2017-02-10 48 / 48