Solvers Principles and Architecture (SPA) Lecture 1 SAT Solvers - - PowerPoint PPT Presentation

solvers principles and architecture spa
SMART_READER_LITE
LIVE PREVIEW

Solvers Principles and Architecture (SPA) Lecture 1 SAT Solvers - - PowerPoint PPT Presentation

Solvers Principles and Architecture (SPA) Lecture 1 SAT Solvers Master Sciences Informatique (Sif) September 25th, 2017 Rennes Khalil Ghorbal k halil.ghorbal@inria.fr K. Ghorbal (INRIA) 1 SIF M2 1 / 42 Automated Theorem Proving


slide-1
SLIDE 1

Solvers Principles and Architecture (SPA)

Lecture 1

SAT Solvers

Master Sciences Informatique (Sif) September 25th, 2017 Rennes

Khalil Ghorbal khalil.ghorbal@inria.fr

  • K. Ghorbal (INRIA)

1 SIF M2 1 / 42

slide-2
SLIDE 2

Automated Theorem Proving

Specification

Formal specification of the system:

  • What the system is expected to do
  • What properties the system has to satisfy

Modeling

Mathematical model describing the behavior of the system:

  • Finite state or hybrid automata
  • Markov chain

Proof

Does the model satisfy the specification? When successful: no corner cases left!

  • K. Ghorbal (INRIA)

2 SIF M2 2 / 42

slide-3
SLIDE 3

Outline

1 Introduction 2 Propositional Logic 3 SAT Solving 4 DPLL-based Algorithms

  • K. Ghorbal (INRIA)

2 SIF M2 2 / 42

slide-4
SLIDE 4

Logic in a Nut Shell

Formally, a logic is a pair of syntax and semantics.

Syntax

  • Alphabet: set of symbols
  • Expressions: sequences of symbols
  • Rules: identifying well-formed expressions

Semantics

  • Meaning: what is meant by well-formed expressions
  • Rules: infer the meaning from subexpressions
  • K. Ghorbal (INRIA)

3 SIF M2 3 / 42

slide-5
SLIDE 5

Alphabet

Syntax

Alphabet

( left parenthesis ) right parenthesis ¬ Negation ∧ Conjunction ∨ Disjunction (inclusive) ← − Implication ← → Equivalence Propositional symbol“False” 1 Propositional symbol“True” si ith propositional symbol

  • K. Ghorbal (INRIA)

4 SIF M2 4 / 42

slide-6
SLIDE 6

Expressions

Syntax

Expression

Sequence of symbols from the alphabet. (, a1, ∧, a2, ) (a1 ∧ a2) (, ), ∨, a1, ¬, a2 () ∨ a1¬a3 We want to further restrict the allowed combinations.

  • K. Ghorbal (INRIA)

5 SIF M2 5 / 42

slide-7
SLIDE 7

Well-Formed Formulas

Syntax

Well-formed formulas (wff) are defined inductively S: the set of expressions with a single propositional symbol S = {0, 1, s1, s2, . . . } W : the set of wffs is freely generated from S as follows w ::= s | (w) | ¬w | w ∧ w| w ∨ w | w − → w | w ← → w So far we only manipulated symbols or wooden pieces!

  • K. Ghorbal (INRIA)

6 SIF M2 6 / 42

slide-8
SLIDE 8

Semantics with Truth Table

s ¬ 1 1

  • K. Ghorbal (INRIA)

7 SIF M2 7 / 42

slide-9
SLIDE 9

Semantics with Truth Table

s ¬ 1 1 s1 s2 ∧ 1 1 1 1 1 s1 s2 ∨ 1 1 1 1 1 1 1

  • K. Ghorbal (INRIA)

7 SIF M2 7 / 42

slide-10
SLIDE 10

Semantics with Truth Table

s ¬ 1 1 s1 s2 ∧ 1 1 1 1 1 s1 s2 ∨ 1 1 1 1 1 1 1 s1 s2 → 1 1 1 1 1 1 1

  • K. Ghorbal (INRIA)

7 SIF M2 7 / 42

slide-11
SLIDE 11

Interpretation Domain

Semantics

Intuition

Given a context, that is a truth value for each propositional symbol, we can determine the truth value of any wff in our context.

Boolean Algebra

  • Field structure: Z /2Z = B = {0, 1}

+” : 0 is the identity, 1 is its own inverse: 1 + 1 = 0

×” : standard multiplication operator, where 1 is the identity element

  • K. Ghorbal (INRIA)

8 SIF M2 8 / 42

slide-12
SLIDE 12

Transfer Functions

Semantics

  • context: σ : S → B. A valuation of all propositional symbols
  • σ satisfies σ(0) = 0 and σ(1) = 1
  • Define σ : W → B
  • σ is well-defined since W is freely generated

Semantics of the Transfer Functions sσ = σ(s) ¬wσ = 1 + wσ w1 ∧ w2σ = w1σ × w2σ w1 ∨ w2σ = w1σ + w2σ + w1σ × w2σ w1 → w2σ = 1 + w1σ + w1σ × w2σ w1 ← → w2σ = 1 + w1σ + w2σ

  • K. Ghorbal (INRIA)

9 SIF M2 9 / 42

slide-13
SLIDE 13

Definitions

  • σ: context, valuation, truth assignment
  • σ satisfies w if and only if wσ = 1
  • w is satisfiable if there exists σ such that σ satisfies w
  • w is unsatisfiable if there is no σ such that σ satisfies w

Example:

  • (s1 ∨ s2) ∧ (¬s1 ∨ ¬s2) is satisfiable
  • (s1 ∨ s2) ∧ (¬s1 ∨ ¬s2) ∧ (s1 ↔ s2) is unsatisfiable
  • K. Ghorbal (INRIA)

10 SIF M2 10 / 42

slide-14
SLIDE 14

Definitions

  • σ: context, valuation, truth assignment
  • σ satisfies w if and only if wσ = 1
  • w is satisfiable if there exists σ such that σ satisfies w
  • w is unsatisfiable if there is no σ such that σ satisfies w

Example:

  • (s1 ∨ s2) ∧ (¬s1 ∨ ¬s2) is satisfiable
  • (s1 ∨ s2) ∧ (¬s1 ∨ ¬s2) ∧ (s1 ↔ s2) is unsatisfiable
  • K. Ghorbal (INRIA)

10 SIF M2 10 / 42

slide-15
SLIDE 15

Definitions

  • σ: context, valuation, truth assignment
  • σ satisfies w if and only if wσ = 1
  • w is satisfiable if there exists σ such that σ satisfies w
  • w is unsatisfiable if there is no σ such that σ satisfies w

Example:

  • (s1 ∨ s2) ∧ (¬s1 ∨ ¬s2) is satisfiable
  • (s1 ∨ s2) ∧ (¬s1 ∨ ¬s2) ∧ (s1 ↔ s2) is unsatisfiable
  • K. Ghorbal (INRIA)

10 SIF M2 10 / 42

slide-16
SLIDE 16

Implications as Satisfiability

Tautological Implication (wi are wffs) w1, . . . , wn | = w if and only if ∀σ.

  • i

wiσ = 1 − → wσ = 1

  • Every truth assignment that satisfies all wi satisfies necessarily w

Definitions

  • |

= w (or 1 | = w): w is a tautology or w is valid

  • w1 ∼ w2: w1 |

= w2 and w2 | = w1 (tautological equivalence)

  • e.g. s1 → s2 ∼ ¬s1 ∨ s2
  • K. Ghorbal (INRIA)

11 SIF M2 11 / 42

slide-17
SLIDE 17

Implications as Satisfiability

Tautological Implication (wi are wffs) w1, . . . , wn | = w if and only if ∀σ.

  • i

wiσ = 1 − → wσ = 1

  • Every truth assignment that satisfies all wi satisfies necessarily w

Definitions

  • |

= w (or 1 | = w): w is a tautology or w is valid

  • w1 ∼ w2: w1 |

= w2 and w2 | = w1 (tautological equivalence)

  • e.g. s1 → s2 ∼ ¬s1 ∨ s2
  • K. Ghorbal (INRIA)

11 SIF M2 11 / 42

slide-18
SLIDE 18

Implications as Satisfiability

Tautological Implication (wi are wffs) w1, . . . , wn | = w if and only if ∀σ.

  • i

wiσ = 1 − → wσ = 1

  • Every truth assignment that satisfies all wi satisfies necessarily w

Definitions

  • |

= w (or 1 | = w): w is a tautology or w is valid

  • w1 ∼ w2: w1 |

= w2 and w2 | = w1 (tautological equivalence)

  • e.g. s1 → s2 ∼ ¬s1 ∨ s2
  • K. Ghorbal (INRIA)

11 SIF M2 11 / 42

slide-19
SLIDE 19

Implications as Satisfiability

Tautological Implication (wi are wffs) w1, . . . , wn | = w if and only if ∀σ.

  • i

wiσ = 1 − → wσ = 1

  • Every truth assignment that satisfies all wi satisfies necessarily w

Definitions

  • |

= w (or 1 | = w): w is a tautology or w is valid

  • w1 ∼ w2: w1 |

= w2 and w2 | = w1 (tautological equivalence)

  • e.g. s1 → s2 ∼ ¬s1 ∨ s2
  • K. Ghorbal (INRIA)

11 SIF M2 11 / 42

slide-20
SLIDE 20

Proving Theorem with SAT

Tautological Implication as Satisfiability Problem w1, . . . , wn | = w if and only if

  • i

wi ∧ ¬w is unsatisfiable Example

  • s1, s1 → s2 |

= s2 iff s1 ∧ (s1 → s2) ∧ ¬s2 is unsat.

  • s, ¬s |

= (s ∧ ¬s) iff s ∧ ¬s ∧ ¬(s ∧ ¬s) is unsat

  • K. Ghorbal (INRIA)

12 SIF M2 12 / 42

slide-21
SLIDE 21

Proving Theorem with SAT

Tautological Implication as Satisfiability Problem w1, . . . , wn | = w if and only if

  • i

wi ∧ ¬w is unsatisfiable Example

  • s1, s1 → s2 |

= s2 iff s1 ∧ (s1 → s2) ∧ ¬s2 is unsat.

  • s, ¬s |

= (s ∧ ¬s) iff s ∧ ¬s ∧ ¬(s ∧ ¬s) is unsat

  • K. Ghorbal (INRIA)

12 SIF M2 12 / 42

slide-22
SLIDE 22

Proving Theorem with SAT

Tautological Implication as Satisfiability Problem w1, . . . , wn | = w if and only if

  • i

wi ∧ ¬w is unsatisfiable Example

  • s1, s1 → s2 |

= s2 iff s1 ∧ (s1 → s2) ∧ ¬s2 is unsat.

  • s, ¬s |

= (s ∧ ¬s) iff s ∧ ¬s ∧ ¬(s ∧ ¬s) is unsat

  • K. Ghorbal (INRIA)

12 SIF M2 12 / 42

slide-23
SLIDE 23

Outline

1 Introduction 2 Propositional Logic 3 SAT Solving 4 DPLL-based Algorithms

  • K. Ghorbal (INRIA)

12 SIF M2 12 / 42

slide-24
SLIDE 24

SAT Decision Problem

Given a well-formed formula w as an input, if there exists a σ that satisfies w return True, otherwise return False

  • K. Ghorbal (INRIA)

13 SIF M2 13 / 42

slide-25
SLIDE 25

Brute Force Algorithm

Example

s1 ∧ (s2 ∨ ¬s1) ∧ (s3 ∨ ¬s2) s1 s2 s3 s1 ∧ ((s2 ∨ ¬s1) ∧ (s3 ∨ ¬s2))

  • K. Ghorbal (INRIA)

14 SIF M2 14 / 42

slide-26
SLIDE 26

Brute Force Algorithm

Example

s1 ∧ (s2 ∨ ¬s1) ∧ (s3 ∨ ¬s2) s1 s2 s3 s1 ∧ ((s2 ∨ ¬s1) ∧ (s3 ∨ ¬s2)) (1) 1 1 1 1 1

  • K. Ghorbal (INRIA)

14 SIF M2 14 / 42

slide-27
SLIDE 27

Brute Force Algorithm

Example

s1 ∧ (s2 ∨ ¬s1) ∧ (s3 ∨ ¬s2) s1 s2 s3 s1 ∧ ((s2 ∨ ¬s1) ∧ (s3 ∨ ¬s2)) (1) 1 1 1 1 1 (2) 1 1 1 1 1 1

  • K. Ghorbal (INRIA)

14 SIF M2 14 / 42

slide-28
SLIDE 28

Brute Force Algorithm

Example

s1 ∧ (s2 ∨ ¬s1) ∧ (s3 ∨ ¬s2) s1 s2 s3 s1 ∧ ((s2 ∨ ¬s1) ∧ (s3 ∨ ¬s2)) (1) 1 1 1 1 1 (2) 1 1 1 1 1 1 (3) 1 1 1

  • K. Ghorbal (INRIA)

14 SIF M2 14 / 42

slide-29
SLIDE 29

Brute Force Algorithm

Example

s1 ∧ (s2 ∨ ¬s1) ∧ (s3 ∨ ¬s2) s1 s2 s3 s1 ∧ ((s2 ∨ ¬s1) ∧ (s3 ∨ ¬s2)) (1) 1 1 1 1 1 (2) 1 1 1 1 1 1 (3) 1 1 1 (4) 1 1 1 1 1 1

  • K. Ghorbal (INRIA)

14 SIF M2 14 / 42

slide-30
SLIDE 30

Brute Force Algorithm

Example

s1 ∧ (s2 ∨ ¬s1) ∧ (s3 ∨ ¬s2) s1 s2 s3 s1 ∧ ((s2 ∨ ¬s1) ∧ (s3 ∨ ¬s2)) (1) 1 1 1 1 1 (2) 1 1 1 1 1 1 (3) 1 1 1 (4) 1 1 1 1 1 1 (5) 1 1 1

  • K. Ghorbal (INRIA)

14 SIF M2 14 / 42

slide-31
SLIDE 31

Brute Force Algorithm

Example

s1 ∧ (s2 ∨ ¬s1) ∧ (s3 ∨ ¬s2) s1 s2 s3 s1 ∧ ((s2 ∨ ¬s1) ∧ (s3 ∨ ¬s2)) (1) 1 1 1 1 1 (2) 1 1 1 1 1 1 (3) 1 1 1 (4) 1 1 1 1 1 1 (5) 1 1 1 (6) 1 1 1 1

  • K. Ghorbal (INRIA)

14 SIF M2 14 / 42

slide-32
SLIDE 32

Brute Force Algorithm

Example

s1 ∧ (s2 ∨ ¬s1) ∧ (s3 ∨ ¬s2) s1 s2 s3 s1 ∧ ((s2 ∨ ¬s1) ∧ (s3 ∨ ¬s2)) (1) 1 1 1 1 1 (2) 1 1 1 1 1 1 (3) 1 1 1 (4) 1 1 1 1 1 1 (5) 1 1 1 (6) 1 1 1 1 (7) 1 1 1

  • K. Ghorbal (INRIA)

14 SIF M2 14 / 42

slide-33
SLIDE 33

Brute Force Algorithm

Example

s1 ∧ (s2 ∨ ¬s1) ∧ (s3 ∨ ¬s2) s1 s2 s3 s1 ∧ ((s2 ∨ ¬s1) ∧ (s3 ∨ ¬s2)) (1) 1 1 1 1 1 (2) 1 1 1 1 1 1 (3) 1 1 1 (4) 1 1 1 1 1 1 (5) 1 1 1 (6) 1 1 1 1 (7) 1 1 1 (8) 1 1 1 1 1 1 1

  • K. Ghorbal (INRIA)

14 SIF M2 14 / 42

slide-34
SLIDE 34

SAT Facts

  • Brute force algorithm: exponential complexity:
  • 2n for n propositional symbol
  • SAT is the first problem to be proven to be NP-complete [Cook 1971]
  • SAT solves any decision problem in NP
  • Modern SAT Solvers are arguably efficient, why?
  • SAT expects an input in Conjunctive Normal Form
  • K. Ghorbal (INRIA)

15 SIF M2 15 / 42

slide-35
SLIDE 35

SAT Facts

  • Brute force algorithm: exponential complexity:
  • 2n for n propositional symbol
  • SAT is the first problem to be proven to be NP-complete [Cook 1971]
  • SAT solves any decision problem in NP
  • Modern SAT Solvers are arguably efficient, why?
  • SAT expects an input in Conjunctive Normal Form
  • K. Ghorbal (INRIA)

15 SIF M2 15 / 42

slide-36
SLIDE 36

SAT Facts

  • Brute force algorithm: exponential complexity:
  • 2n for n propositional symbol
  • SAT is the first problem to be proven to be NP-complete [Cook 1971]
  • SAT solves any decision problem in NP
  • Modern SAT Solvers are arguably efficient, why?
  • SAT expects an input in Conjunctive Normal Form
  • K. Ghorbal (INRIA)

15 SIF M2 15 / 42

slide-37
SLIDE 37

SAT Facts

  • Brute force algorithm: exponential complexity:
  • 2n for n propositional symbol
  • SAT is the first problem to be proven to be NP-complete [Cook 1971]
  • SAT solves any decision problem in NP
  • Modern SAT Solvers are arguably efficient, why?
  • SAT expects an input in Conjunctive Normal Form
  • K. Ghorbal (INRIA)

15 SIF M2 15 / 42

slide-38
SLIDE 38

SAT Facts

  • Brute force algorithm: exponential complexity:
  • 2n for n propositional symbol
  • SAT is the first problem to be proven to be NP-complete [Cook 1971]
  • SAT solves any decision problem in NP
  • Modern SAT Solvers are arguably efficient, why?
  • SAT expects an input in Conjunctive Normal Form
  • K. Ghorbal (INRIA)

15 SIF M2 15 / 42

slide-39
SLIDE 39

Converting to CNF

Equivalence versus Equisatisfiability

Recall (Tautological) Equivalence w1 ∼ w2 if and only if ∀σ. (w1σ = 1 ← → w2σ = 1) Equisatisfiability w1 ∼SAT w2 if and only if ∃σ. w1σ = 1 ← → ∃σ. w2σ = 1 Equisatisfiability does not imply tautological equivalence!

  • w1 := s1 ∧ (s1 ↔ s2) and w2 := s1
  • w1 ∼SAT w2 but w1 ∼ w2
  • K. Ghorbal (INRIA)

16 SIF M2 16 / 42

slide-40
SLIDE 40

Converting to CNF

Equivalence versus Equisatisfiability

Recall (Tautological) Equivalence w1 ∼ w2 if and only if ∀σ. (w1σ = 1 ← → w2σ = 1) Equisatisfiability w1 ∼SAT w2 if and only if ∃σ. w1σ = 1 ← → ∃σ. w2σ = 1 Equisatisfiability does not imply tautological equivalence!

  • w1 := s1 ∧ (s1 ↔ s2) and w2 := s1
  • w1 ∼SAT w2 but w1 ∼ w2
  • K. Ghorbal (INRIA)

16 SIF M2 16 / 42

slide-41
SLIDE 41

Converting to CNF

Equivalence versus Equisatisfiability

Recall (Tautological) Equivalence w1 ∼ w2 if and only if ∀σ. (w1σ = 1 ← → w2σ = 1) Equisatisfiability w1 ∼SAT w2 if and only if ∃σ. w1σ = 1 ← → ∃σ. w2σ = 1 Equisatisfiability does not imply tautological equivalence!

  • w1 := s1 ∧ (s1 ↔ s2) and w2 := s1
  • w1 ∼SAT w2 but w1 ∼ w2
  • K. Ghorbal (INRIA)

16 SIF M2 16 / 42

slide-42
SLIDE 42

Converting to CNF

Equivalent CNF is Exponential

Converting a wff w to an equivalent formula in CNF using De Morgan’s Laws and distributivity may increase the number of logical operations (Boolean gates) exponentially. Example

  • w1 := (s1 ∧ s2) ∨ (s3 ∧ s4), by distributivity
  • w2 := (s1 ∨ s3) ∧ (s1 ∨ s4) ∧ (s2 ∨ s3) ∧ (s2 ∨ s4)
  • Add extra pairs to w1, (s1 ∧ s2) ∨ (s3 ∧ s4) ∨ (s5 ∧ s6) . . .
  • The number of the involved logical operations is exponential
  • K. Ghorbal (INRIA)

17 SIF M2 17 / 42

slide-43
SLIDE 43

Converting to CNF

Equivalent CNF is Exponential

Converting a wff w to an equivalent formula in CNF using De Morgan’s Laws and distributivity may increase the number of logical operations (Boolean gates) exponentially. Example

  • w1 := (s1 ∧ s2) ∨ (s3 ∧ s4), by distributivity
  • w2 := (s1 ∨ s3) ∧ (s1 ∨ s4) ∧ (s2 ∨ s3) ∧ (s2 ∨ s4)
  • Add extra pairs to w1, (s1 ∧ s2) ∨ (s3 ∧ s4) ∨ (s5 ∧ s6) . . .
  • The number of the involved logical operations is exponential
  • K. Ghorbal (INRIA)

17 SIF M2 17 / 42

slide-44
SLIDE 44

Converting to CNF

Equivalent CNF is Exponential

Converting a wff w to an equivalent formula in CNF using De Morgan’s Laws and distributivity may increase the number of logical operations (Boolean gates) exponentially. Example

  • w1 := (s1 ∧ s2) ∨ (s3 ∧ s4), by distributivity
  • w2 := (s1 ∨ s3) ∧ (s1 ∨ s4) ∧ (s2 ∨ s3) ∧ (s2 ∨ s4)
  • Add extra pairs to w1, (s1 ∧ s2) ∨ (s3 ∧ s4) ∨ (s5 ∧ s6) . . .
  • The number of the involved logical operations is exponential
  • K. Ghorbal (INRIA)

17 SIF M2 17 / 42

slide-45
SLIDE 45

Converting to CNF

Equivalent CNF is Exponential

Converting a wff w to an equivalent formula in CNF using De Morgan’s Laws and distributivity may increase the number of logical operations (Boolean gates) exponentially. Example

  • w1 := (s1 ∧ s2) ∨ (s3 ∧ s4), by distributivity
  • w2 := (s1 ∨ s3) ∧ (s1 ∨ s4) ∧ (s2 ∨ s3) ∧ (s2 ∨ s4)
  • Add extra pairs to w1, (s1 ∧ s2) ∨ (s3 ∧ s4) ∨ (s5 ∧ s6) . . .
  • The number of the involved logical operations is exponential
  • K. Ghorbal (INRIA)

17 SIF M2 17 / 42

slide-46
SLIDE 46

Converting to CNF

Tseytin Transformation [Tseytin 1970]

Idea: Converting a w by adding new propositional variables and substitute for nested operations. Example (s1 ∧ s2)

  • p1

∨ (s3 ∧ s4)

  • p2
  • p3
  • p1 ↔ (s1 ∧ s2)
  • p2 ↔ (s3 ∧ s4)
  • p3 ↔ p1 ∨ p2
  • CNF: (p1 ↔ (s1 ∧ s2)) ∧ (p2 ↔ (s3 ∧ s4)) ∧ (p3 ↔ p1 ∨ p2) ∧ p3
  • K. Ghorbal (INRIA)

18 SIF M2 18 / 42

slide-47
SLIDE 47

Converting to CNF

Tseytin Transformation [Tseytin 1970]

Idea: Converting a w by adding new propositional variables and substitute for nested operations. Example (s1 ∧ s2)

  • p1

∨ (s3 ∧ s4)

  • p2
  • p3
  • p1 ↔ (s1 ∧ s2)
  • p2 ↔ (s3 ∧ s4)
  • p3 ↔ p1 ∨ p2
  • CNF: (p1 ↔ (s1 ∧ s2)) ∧ (p2 ↔ (s3 ∧ s4)) ∧ (p3 ↔ p1 ∨ p2) ∧ p3
  • K. Ghorbal (INRIA)

18 SIF M2 18 / 42

slide-48
SLIDE 48

Converting to CNF

Tseytin Transformation [Tseytin 1970]

  • p ↔ (s1 ◦ s2) has at most 3 clauses for any ◦ ∈ {¬, ∧, ∨, ¯

∧, ¯ ∨}

  • For n logical operation, the increase is linear O(n)
  • Drawback: the number of propositional variables increases (linearly)!
  • K. Ghorbal (INRIA)

19 SIF M2 19 / 42

slide-49
SLIDE 49

Converting to CNF

Tseytin Transformation [Tseytin 1970]

  • p ↔ (s1 ◦ s2) has at most 3 clauses for any ◦ ∈ {¬, ∧, ∨, ¯

∧, ¯ ∨}

  • For n logical operation, the increase is linear O(n)
  • Drawback: the number of propositional variables increases (linearly)!
  • K. Ghorbal (INRIA)

19 SIF M2 19 / 42

slide-50
SLIDE 50

Converting to CNF

Tseytin Transformation [Tseytin 1970]

  • p ↔ (s1 ◦ s2) has at most 3 clauses for any ◦ ∈ {¬, ∧, ∨, ¯

∧, ¯ ∨}

  • For n logical operation, the increase is linear O(n)
  • Drawback: the number of propositional variables increases (linearly)!
  • K. Ghorbal (INRIA)

19 SIF M2 19 / 42

slide-51
SLIDE 51

DiMaCS Standard

  • Each propositional variable is represented by a positive integer
  • A negative integer refers to negative occurrences
  • Clauses are given as sequences of integers separated by spaces
  • A 0 terminates the clause

Example:

  • (s1 ∨ ¬s3) ∧ (¬s2 ∨ s3 ∨ s4)
  • 1 -3 0
  • 2 3 4 0
  • K. Ghorbal (INRIA)

20 SIF M2 20 / 42

slide-52
SLIDE 52

DiMaCS Standard

  • Each propositional variable is represented by a positive integer
  • A negative integer refers to negative occurrences
  • Clauses are given as sequences of integers separated by spaces
  • A 0 terminates the clause

Example:

  • (s1 ∨ ¬s3) ∧ (¬s2 ∨ s3 ∨ s4)
  • 1 -3 0
  • 2 3 4 0
  • K. Ghorbal (INRIA)

20 SIF M2 20 / 42

slide-53
SLIDE 53

Outline

1 Introduction 2 Propositional Logic 3 SAT Solving 4 DPLL-based Algorithms

  • K. Ghorbal (INRIA)

20 SIF M2 20 / 42

slide-54
SLIDE 54

Definitions

  • Literal: propositional symbol (atomic formula) or its negation
  • Clause: disjunction of one or more literals
  • Conjunctive Normal Form (CNF): conjunction of clauses
  • Positive Occurrence: if the symbol occurs unnegated in a clause
  • Negative Occurrence: if the symbol occurs negated in a clause

(s1 ∨ ¬s3) ∧ (¬s2 ∨ s3 ∨ s4)

  • K. Ghorbal (INRIA)

21 SIF M2 21 / 42

slide-55
SLIDE 55

Definitions

  • Literal: propositional symbol (atomic formula) or its negation
  • Clause: disjunction of one or more literals
  • Conjunctive Normal Form (CNF): conjunction of clauses
  • Positive Occurrence: if the symbol occurs unnegated in a clause
  • Negative Occurrence: if the symbol occurs negated in a clause

(s1 ∨ ¬s3) ∧ (¬s2 ∨ s3 ∨ s4)

  • K. Ghorbal (INRIA)

21 SIF M2 21 / 42

slide-56
SLIDE 56

Definitions

  • Literal: propositional symbol (atomic formula) or its negation
  • Clause: disjunction of one or more literals
  • Conjunctive Normal Form (CNF): conjunction of clauses
  • Positive Occurrence: if the symbol occurs unnegated in a clause
  • Negative Occurrence: if the symbol occurs negated in a clause

(s1 ∨ ¬s3) ∧ (¬s2 ∨ s3 ∨ s4)

  • K. Ghorbal (INRIA)

21 SIF M2 21 / 42

slide-57
SLIDE 57

Definitions

  • Literal: propositional symbol (atomic formula) or its negation
  • Clause: disjunction of one or more literals
  • Conjunctive Normal Form (CNF): conjunction of clauses
  • Positive Occurrence: if the symbol occurs unnegated in a clause
  • Negative Occurrence: if the symbol occurs negated in a clause

(s1 ∨ ¬s3) ∧ (¬s2 ∨ s3 ∨ s4)

  • K. Ghorbal (INRIA)

21 SIF M2 21 / 42

slide-58
SLIDE 58

Definitions

  • Literal: propositional symbol (atomic formula) or its negation
  • Clause: disjunction of one or more literals
  • Conjunctive Normal Form (CNF): conjunction of clauses
  • Positive Occurrence: if the symbol occurs unnegated in a clause
  • Negative Occurrence: if the symbol occurs negated in a clause

(s1 ∨ ¬s3) ∧ (¬s2 ∨ s3 ∨ s4)

  • K. Ghorbal (INRIA)

21 SIF M2 21 / 42

slide-59
SLIDE 59

DP Algorithm

Davis, Putnam, 1960

Satisfiability-Preserving Transformations

  • Pure literal rule or affirmative-negative rule
  • Unit propagation or 1-literal rule
  • Resolution rule or rule for eliminating literals (atomic formulas)

DP Algorithm Iteratively apply the rules till reducing the problem to a unique clause

  • if the clause has the form s ∧ ¬s the problem is unsat
  • otherwise, the problem is sat
  • K. Ghorbal (INRIA)

22 SIF M2 22 / 42

slide-60
SLIDE 60

DP Algorithm

Davis, Putnam, 1960

Satisfiability-Preserving Transformations

  • Pure literal rule or affirmative-negative rule
  • Unit propagation or 1-literal rule
  • Resolution rule or rule for eliminating literals (atomic formulas)

DP Algorithm Iteratively apply the rules till reducing the problem to a unique clause

  • if the clause has the form s ∧ ¬s the problem is unsat
  • otherwise, the problem is sat
  • K. Ghorbal (INRIA)

22 SIF M2 22 / 42

slide-61
SLIDE 61

Pure Literal Rule

Pure literal i.e. appears only positively or only negatively, ℓ say Delete all clauses containing that literal

  • A clause containing ℓ has the form ℓ ∨ w
  • (ℓ ↔ 1) ∧ (ℓ ∨ w1) ∧ w2

∼SAT w2

  • Repeat till no more clauses contain ℓ

➻ Augment σ such that ℓσ = 1 Nota: not used dynamically while solving as expensive to detect.

  • K. Ghorbal (INRIA)

23 SIF M2 23 / 42

slide-62
SLIDE 62

Example of Preprocessing with Pure Literal Rule

(1 and 7) 1 ∨ 2 1 ∨ 3 ∨ 8 ¯ 2 ∨ ¯ 3 ∨ 4 ¯ 4 ∨ 5 ∨ 7 ¯ 4 ∨ 6 ∨ 8 ¯ 5 ∨ ¯ 6 7 ∨ ¯ 8 7 ∨ ¯ 9 ∨ 10 (¯ 2) 1 ∨ 2 1 ∨ 3 ∨ 8 ¯ 2 ∨ ¯ 3 ∨ 4 ¯ 4 ∨ 5 ∨ 7 ¯ 4 ∨ 6 ∨ 8 ¯ 5 ∨ ¯ 6 7 ∨ ¯ 8 7 ∨ ¯ 9 ∨ 10 (¯ 4 and ¯ 5) 1 ∨ 2 1 ∨ 3 ∨ 8 ¯ 2 ∨ ¯ 3 ∨ 4 ¯ 4 ∨ 5 ∨ 7 ¯ 4 ∨ 6 ∨ 8 ¯ 5 ∨ ¯ 6 7 ∨ ¯ 8 7 ∨ ¯ 9 ∨ 10 ➻ SAT! σ = {1, 7, ¯ 2, ¯ 4, ¯ 5}

  • K. Ghorbal (INRIA)

24 SIF M2 24 / 42

slide-63
SLIDE 63

Unit Propagation

Unit clause is a clause with only one literal, ℓ say Remove all the clauses containing ℓ

  • A clause containing ℓ has the form ℓ ∨ w
  • (ℓ ↔ 1) ∧ (ℓ ∨ w)

∼SAT 1

  • Repeat till no more clauses contain ℓ

Remove all instances of ¬ℓ from all the clauses

  • A clause containing ¬ℓ has the form ℓ ∨ w
  • ¬ℓσ = 0
  • (ℓ ↔ 1) ∧ (¬ℓ ∨ w)

∼SAT w

  • Repeat till no more clauses contain ¬ℓ

➻ Augment σ such that ℓσ = 1

  • K. Ghorbal (INRIA)

25 SIF M2 25 / 42

slide-64
SLIDE 64

Boolean Constraint Propagation (BCP)

  • Unit propagation is a typical instance of BCP
  • Consumes the most significant runtime of modern solvers

Several heuristics proved efficient

  • Counter-based (GRASP) [Marques-Silva, Sakallah, 1996]
  • Head/Tail lists (SATO) [Zhang, Stickel, 1996]
  • 2-literal watching (Chaff) [Moskewicz et al. 2001]
  • K. Ghorbal (INRIA)

26 SIF M2 26 / 42

slide-65
SLIDE 65

Counter-Based Algorithm for BCP

  • Denote by |C| the total number of literals in C
  • Each clause C has two counters:
  • C(ℓ = 0) := #ℓ such that ℓσ = 0
  • C(ℓ = 1) := #ℓ such that ℓσ = 0
  • Each variable s has two lists of clauses:
  • Ps: set of clauses where the variable occurs positively
  • Ns: set of clauses where the variable occurs negatively

If s is assigned, C(ℓ = 0) and C(ℓ = 1) for all C in Ps ∪ Ns are updated

  • If C(ℓ = 0) = |C| then C is a conflicting clause (more later)
  • If C(ℓ = 0) = −1 + |C| and C(ℓ = 1) = 0 then it is a unit clause
  • K. Ghorbal (INRIA)

27 SIF M2 27 / 42

slide-66
SLIDE 66

Counter-Based Algorithm for BCP

  • Denote by |C| the total number of literals in C
  • Each clause C has two counters:
  • C(ℓ = 0) := #ℓ such that ℓσ = 0
  • C(ℓ = 1) := #ℓ such that ℓσ = 0
  • Each variable s has two lists of clauses:
  • Ps: set of clauses where the variable occurs positively
  • Ns: set of clauses where the variable occurs negatively

If s is assigned, C(ℓ = 0) and C(ℓ = 1) for all C in Ps ∪ Ns are updated

  • If C(ℓ = 0) = |C| then C is a conflicting clause (more later)
  • If C(ℓ = 0) = −1 + |C| and C(ℓ = 1) = 0 then it is a unit clause
  • K. Ghorbal (INRIA)

27 SIF M2 27 / 42

slide-67
SLIDE 67

Counter-Based Algorithm for BCP

  • Denote by |C| the total number of literals in C
  • Each clause C has two counters:
  • C(ℓ = 0) := #ℓ such that ℓσ = 0
  • C(ℓ = 1) := #ℓ such that ℓσ = 0
  • Each variable s has two lists of clauses:
  • Ps: set of clauses where the variable occurs positively
  • Ns: set of clauses where the variable occurs negatively

If s is assigned, C(ℓ = 0) and C(ℓ = 1) for all C in Ps ∪ Ns are updated

  • If C(ℓ = 0) = |C| then C is a conflicting clause (more later)
  • If C(ℓ = 0) = −1 + |C| and C(ℓ = 1) = 0 then it is a unit clause
  • K. Ghorbal (INRIA)

27 SIF M2 27 / 42

slide-68
SLIDE 68

Counter-Based Algorithm for BCP

  • Denote by |C| the total number of literals in C
  • Each clause C has two counters:
  • C(ℓ = 0) := #ℓ such that ℓσ = 0
  • C(ℓ = 1) := #ℓ such that ℓσ = 0
  • Each variable s has two lists of clauses:
  • Ps: set of clauses where the variable occurs positively
  • Ns: set of clauses where the variable occurs negatively

If s is assigned, C(ℓ = 0) and C(ℓ = 1) for all C in Ps ∪ Ns are updated

  • If C(ℓ = 0) = |C| then C is a conflicting clause (more later)
  • If C(ℓ = 0) = −1 + |C| and C(ℓ = 1) = 0 then it is a unit clause
  • K. Ghorbal (INRIA)

27 SIF M2 27 / 42

slide-69
SLIDE 69

Counter-Based Algorithm for BCP

  • Denote by |C| the total number of literals in C
  • Each clause C has two counters:
  • C(ℓ = 0) := #ℓ such that ℓσ = 0
  • C(ℓ = 1) := #ℓ such that ℓσ = 0
  • Each variable s has two lists of clauses:
  • Ps: set of clauses where the variable occurs positively
  • Ns: set of clauses where the variable occurs negatively

If s is assigned, C(ℓ = 0) and C(ℓ = 1) for all C in Ps ∪ Ns are updated

  • If C(ℓ = 0) = |C| then C is a conflicting clause (more later)
  • If C(ℓ = 0) = −1 + |C| and C(ℓ = 1) = 0 then it is a unit clause
  • K. Ghorbal (INRIA)

27 SIF M2 27 / 42

slide-70
SLIDE 70

Counter-Based Algorithm for BCP

  • Denote by |C| the total number of literals in C
  • Each clause C has two counters:
  • C(ℓ = 0) := #ℓ such that ℓσ = 0
  • C(ℓ = 1) := #ℓ such that ℓσ = 0
  • Each variable s has two lists of clauses:
  • Ps: set of clauses where the variable occurs positively
  • Ns: set of clauses where the variable occurs negatively

If s is assigned, C(ℓ = 0) and C(ℓ = 1) for all C in Ps ∪ Ns are updated

  • If C(ℓ = 0) = |C| then C is a conflicting clause (more later)
  • If C(ℓ = 0) = −1 + |C| and C(ℓ = 1) = 0 then it is a unit clause
  • K. Ghorbal (INRIA)

27 SIF M2 27 / 42

slide-71
SLIDE 71

Counter-Based Algorithm for BCP

  • Denote by |C| the total number of literals in C
  • Each clause C has two counters:
  • C(ℓ = 0) := #ℓ such that ℓσ = 0
  • C(ℓ = 1) := #ℓ such that ℓσ = 0
  • Each variable s has two lists of clauses:
  • Ps: set of clauses where the variable occurs positively
  • Ns: set of clauses where the variable occurs negatively

If s is assigned, C(ℓ = 0) and C(ℓ = 1) for all C in Ps ∪ Ns are updated

  • If C(ℓ = 0) = |C| then C is a conflicting clause (more later)
  • If C(ℓ = 0) = −1 + |C| and C(ℓ = 1) = 0 then it is a unit clause
  • K. Ghorbal (INRIA)

27 SIF M2 27 / 42

slide-72
SLIDE 72

Counter-Based Algorithm for BCP

  • Denote by |C| the total number of literals in C
  • Each clause C has two counters:
  • C(ℓ = 0) := #ℓ such that ℓσ = 0
  • C(ℓ = 1) := #ℓ such that ℓσ = 0
  • Each variable s has two lists of clauses:
  • Ps: set of clauses where the variable occurs positively
  • Ns: set of clauses where the variable occurs negatively

If s is assigned, C(ℓ = 0) and C(ℓ = 1) for all C in Ps ∪ Ns are updated

  • If C(ℓ = 0) = |C| then C is a conflicting clause (more later)
  • If C(ℓ = 0) = −1 + |C| and C(ℓ = 1) = 0 then it is a unit clause
  • K. Ghorbal (INRIA)

27 SIF M2 27 / 42

slide-73
SLIDE 73

Watched 2-Literal

Empirical fact: Find and perform literal prorogation is expensive Watched Literals

  • For every clause, pick two literals to be watched
  • If a literal is assigned, check only those clauses in which the literal is

watched

  • When inspecting, if the propagation is not triggered, pick a new literal

to watch

  • K. Ghorbal (INRIA)

28 SIF M2 28 / 42

slide-74
SLIDE 74

Watched 2-Literal

Empirical fact: Find and perform literal prorogation is expensive Watched Literals

  • For every clause, pick two literals to be watched
  • If a literal is assigned, check only those clauses in which the literal is

watched

  • When inspecting, if the propagation is not triggered, pick a new literal

to watch

  • K. Ghorbal (INRIA)

28 SIF M2 28 / 42

slide-75
SLIDE 75

Watched 2-Literal

Empirical fact: Find and perform literal prorogation is expensive Watched Literals

  • For every clause, pick two literals to be watched
  • If a literal is assigned, check only those clauses in which the literal is

watched

  • When inspecting, if the propagation is not triggered, pick a new literal

to watch

  • K. Ghorbal (INRIA)

28 SIF M2 28 / 42

slide-76
SLIDE 76

Watched 2-Literal

Empirical fact: Find and perform literal prorogation is expensive Watched Literals

  • For every clause, pick two literals to be watched
  • If a literal is assigned, check only those clauses in which the literal is

watched

  • When inspecting, if the propagation is not triggered, pick a new literal

to watch

  • K. Ghorbal (INRIA)

28 SIF M2 28 / 42

slide-77
SLIDE 77

Resolution Rule

If s does not appear in the wff w, then (s ∨ a) ∧ (¬s ∨ b) ∧ w ∼SAT (a ∨ b)

resolvent

∧w

  • i

(s ∨ ai) ∧

  • j

(¬s ∨ bj) ∧ w ∼SAT  

i

ai ∨

  • j

bj   ∧ w  

i

ai ∨

  • j

bj   ∧ w ∼  

i

  • j

(ai ∨ bj)   ∧ w Resolution Rule

  • Simplifies by s. No explicit assignment for s!
  • K. Ghorbal (INRIA)

29 SIF M2 29 / 42

slide-78
SLIDE 78

Resolution Rule

If s does not appear in the wff w, then (s ∨ a) ∧ (¬s ∨ b) ∧ w ∼SAT (a ∨ b)

resolvent

∧w

  • i

(s ∨ ai) ∧

  • j

(¬s ∨ bj) ∧ w ∼SAT  

i

ai ∨

  • j

bj   ∧ w  

i

ai ∨

  • j

bj   ∧ w ∼  

i

  • j

(ai ∨ bj)   ∧ w Resolution Rule

  • Simplifies by s. No explicit assignment for s!
  • K. Ghorbal (INRIA)

29 SIF M2 29 / 42

slide-79
SLIDE 79

Resolution Rule

If s does not appear in the wff w, then (s ∨ a) ∧ (¬s ∨ b) ∧ w ∼SAT (a ∨ b)

resolvent

∧w

  • i

(s ∨ ai) ∧

  • j

(¬s ∨ bj) ∧ w ∼SAT  

i

ai ∨

  • j

bj   ∧ w  

i

ai ∨

  • j

bj   ∧ w ∼  

i

  • j

(ai ∨ bj)   ∧ w Resolution Rule

  • Simplifies by s. No explicit assignment for s!
  • K. Ghorbal (INRIA)

29 SIF M2 29 / 42

slide-80
SLIDE 80

Resolution Rule

If s does not appear in the wff w, then (s ∨ a) ∧ (¬s ∨ b) ∧ w ∼SAT (a ∨ b)

resolvent

∧w

  • i

(s ∨ ai) ∧

  • j

(¬s ∨ bj) ∧ w ∼SAT  

i

ai ∨

  • j

bj   ∧ w  

i

ai ∨

  • j

bj   ∧ w ∼  

i

  • j

(ai ∨ bj)   ∧ w Resolution Rule

  • Simplifies by s. No explicit assignment for s!
  • K. Ghorbal (INRIA)

29 SIF M2 29 / 42

slide-81
SLIDE 81

Splitting (or Branching) Rule

Davis-Logemann-Loveland 1962

Memory Consumption The resolution rule can cause a quadratic expansion every time it is applied exhausting rapidly the available memory The DLL algorithm replaces the resolution rule with a Splitting Rule

1 Simplify by Unit Propagation and Pure Literals 2 Recursively pick a hard core variable s 3 Test if (w ∧ s) is SAT 4 Otherwise return the result for (w ∧ ¬s)

  • K. Ghorbal (INRIA)

30 SIF M2 30 / 42

slide-82
SLIDE 82

Splitting (or Branching) Rule

Davis-Logemann-Loveland 1962

Memory Consumption The resolution rule can cause a quadratic expansion every time it is applied exhausting rapidly the available memory The DLL algorithm replaces the resolution rule with a Splitting Rule

1 Simplify by Unit Propagation and Pure Literals 2 Recursively pick a hard core variable s 3 Test if (w ∧ s) is SAT 4 Otherwise return the result for (w ∧ ¬s)

  • K. Ghorbal (INRIA)

30 SIF M2 30 / 42

slide-83
SLIDE 83

Splitting (or Branching) Rule

Davis-Logemann-Loveland 1962

Memory Consumption The resolution rule can cause a quadratic expansion every time it is applied exhausting rapidly the available memory The DLL algorithm replaces the resolution rule with a Splitting Rule

1 Simplify by Unit Propagation and Pure Literals 2 Recursively pick a hard core variable s 3 Test if (w ∧ s) is SAT 4 Otherwise return the result for (w ∧ ¬s)

  • K. Ghorbal (INRIA)

30 SIF M2 30 / 42

slide-84
SLIDE 84

Splitting (or Branching) Rule

Davis-Logemann-Loveland 1962

Memory Consumption The resolution rule can cause a quadratic expansion every time it is applied exhausting rapidly the available memory The DLL algorithm replaces the resolution rule with a Splitting Rule

1 Simplify by Unit Propagation and Pure Literals 2 Recursively pick a hard core variable s 3 Test if (w ∧ s) is SAT 4 Otherwise return the result for (w ∧ ¬s)

  • K. Ghorbal (INRIA)

30 SIF M2 30 / 42

slide-85
SLIDE 85

Splitting (or Branching) Rule

Davis-Logemann-Loveland 1962

Memory Consumption The resolution rule can cause a quadratic expansion every time it is applied exhausting rapidly the available memory The DLL algorithm replaces the resolution rule with a Splitting Rule

1 Simplify by Unit Propagation and Pure Literals 2 Recursively pick a hard core variable s 3 Test if (w ∧ s) is SAT 4 Otherwise return the result for (w ∧ ¬s)

  • K. Ghorbal (INRIA)

30 SIF M2 30 / 42

slide-86
SLIDE 86

Splitting (or Branching) Rule

Davis-Logemann-Loveland 1962

Memory Consumption The resolution rule can cause a quadratic expansion every time it is applied exhausting rapidly the available memory The DLL algorithm replaces the resolution rule with a Splitting Rule

1 Simplify by Unit Propagation and Pure Literals 2 Recursively pick a hard core variable s 3 Test if (w ∧ s) is SAT 4 Otherwise return the result for (w ∧ ¬s)

  • K. Ghorbal (INRIA)

30 SIF M2 30 / 42

slide-87
SLIDE 87

DPLL Modern Decision Procedure

Zhang, Malik, 2002

s t a t u s = p r e p r o c e s s ( ) ; i f ( s t a t u s !=UNKNOWN) return s t a t u s ; while ( true ) { decide next branch ( ) ; while ( true ) { s t a t u s = deduce ( ) ; i f ( s t a t u s == CONFLICT) { b l e v e l = a n a l y z e c o n f l i c t ( ) ; i f ( b l e v e l == 0) return UNSATISFIABLE ; else backtrack ( b l e v e l ) ; } else i f ( s t a t u s == SATISFIABLE ) return SATISFIABLE ; else break ; } }

  • K. Ghorbal (INRIA)

31 SIF M2 31 / 42

slide-88
SLIDE 88

Branching Heuristics

Which variable to branch with ? Greedy Algorithms

  • Exploit the statistics of the clause database
  • Estimate the branching effect on each variable (cost function)
  • Ex1: Generate the largest number of implications
  • Ex2: Satisfy most clauses

Heuristcs

  • Maximum occurences on minimum sized clauses (MOM)
  • Literal Count Heuristcs

Dynamic Largest Individual Sum (DLIS) [Marques-Silva, 1999]

  • Counts the number of unresolved clauses for each free variable
  • Chooses the variable with the largest number
  • State-dependent (recalculated each time before branching)
  • K. Ghorbal (INRIA)

32 SIF M2 32 / 42

slide-89
SLIDE 89

Variable State Independent Decaying Sum

  • VSIDS. [Moskewicz et al., 2001]
  • Keeps two scores for each variable
  • (# of pos occurences, # of neg occurences)
  • Increases the score of a variable by a constant if it appears in a

learned conflicting-clause

  • Periodically, all the scores are divided by a constant
  • Branch with the variable with the highest combined score

➻ Cheap to maintain (State Independent) ➻ Captures the recently active variables

  • K. Ghorbal (INRIA)

33 SIF M2 33 / 42

slide-90
SLIDE 90

Conflict-Driven Clause Learning (CDCL)

Marques-Silva,Sakallah,1996 and Bayardo,Schrag,1997

Modern SAT solvers essentially implements a backtracking-based search algorithm Two graphs are built iteratively

  • Search graph
  • Implication graph
  • K. Ghorbal (INRIA)

34 SIF M2 34 / 42

slide-91
SLIDE 91

Search Graph

DPLL related Graphs

s3 s1 s4 s2

BCP Next Branch BCP

  • K. Ghorbal (INRIA)

35 SIF M2 35 / 42

slide-92
SLIDE 92

Backtracking

Conflicting Clause: a clause with all its literals assigned to 0 Backtrack when a conflict occurs

  • No future decisions are possible
  • Backtrack to the immediately previous decision made
  • Flip the assignement and continue
  • If decision level 0 reached, return unsat
  • K. Ghorbal (INRIA)

36 SIF M2 36 / 42

slide-93
SLIDE 93

Backtracking

Conflicting Clause: a clause with all its literals assigned to 0 Backtrack when a conflict occurs

  • No future decisions are possible
  • Backtrack to the immediately previous decision made
  • Flip the assignement and continue
  • If decision level 0 reached, return unsat
  • K. Ghorbal (INRIA)

36 SIF M2 36 / 42

slide-94
SLIDE 94

Implication Graph

Gomes et al. Handbook of Knowledge Representation, Chapter2. 2008

No incident edges for decision nodes!

a cut corresponding to clause (¬ a ∨ ¬ b) ¬ p ¬ q b a ¬ t ¬ x1 ¬ x2 ¬ x3 y ¬ ¬ ¬ ¬ y Λ reason side conflict side conflict variable

Figure 2.1: A conflict graph

  • K. Ghorbal (INRIA)

37 SIF M2 37 / 42

slide-95
SLIDE 95

DPLL: Backjump and Learn

Backjump

  • Jump to a past decision that caused the conflict
  • (not necessarily the latest like in backtracking)
  • Not unique in general (heuristics)

Learn

  • Add a new clause to avoid reaching the same conflict again
  • Not unique in general (heuristics)

Example: ¯ 1 ∨ 2, 3 ∨ 4, ¯ 5 ∨ ¯ 6, ¯ 2 ∨ ¯ 5 ∨ 6 (Satisfiable)

  • K. Ghorbal (INRIA)

38 SIF M2 38 / 42

slide-96
SLIDE 96

DPLL: Backjump and Learn

Backjump

  • Jump to a past decision that caused the conflict
  • (not necessarily the latest like in backtracking)
  • Not unique in general (heuristics)

Learn

  • Add a new clause to avoid reaching the same conflict again
  • Not unique in general (heuristics)

Example: ¯ 1 ∨ 2, 3 ∨ 4, ¯ 5 ∨ ¯ 6, ¯ 2 ∨ ¯ 5 ∨ 6 (Satisfiable)

  • K. Ghorbal (INRIA)

38 SIF M2 38 / 42

slide-97
SLIDE 97

DPLL: Backjump and Learn

Backjump

  • Jump to a past decision that caused the conflict
  • (not necessarily the latest like in backtracking)
  • Not unique in general (heuristics)

Learn

  • Add a new clause to avoid reaching the same conflict again
  • Not unique in general (heuristics)

Example: ¯ 1 ∨ 2, 3 ∨ 4, ¯ 5 ∨ ¯ 6, ¯ 2 ∨ ¯ 5 ∨ 6 (Satisfiable)

  • K. Ghorbal (INRIA)

38 SIF M2 38 / 42

slide-98
SLIDE 98

DPLL: Forget and Restart

Mostly used in SMT Solvers

Forget

  • When too much clauses are learned
  • heuristics: those not frequently used by literal propagations

Restart

  • If stuck, restart from the beginning (extreme backjumping)
  • Keep the learned clauses
  • K. Ghorbal (INRIA)

39 SIF M2 39 / 42

slide-99
SLIDE 99

DPLL: Forget and Restart

Mostly used in SMT Solvers

Forget

  • When too much clauses are learned
  • heuristics: those not frequently used by literal propagations

Restart

  • If stuck, restart from the beginning (extreme backjumping)
  • Keep the learned clauses
  • K. Ghorbal (INRIA)

39 SIF M2 39 / 42

slide-100
SLIDE 100

Summary

SAT Problem

  • Equisatisfiability
  • SAT for proving tautological implications/equivalences
  • CNF transformation

CDCL-DPLL Algorithm

  • Unit Propagation
  • Pure Literal
  • Resolution/Splitting/Conflict Learning
  • K. Ghorbal (INRIA)

40 SIF M2 40 / 42

slide-101
SLIDE 101

Alternative Approaches: Stalmarck’s method

  • Designed to detect unsat formulas
  • Works on conjunctions of triplet of the form p ↔ q ∧ r
  • The transformation works like CNF, but we leave them as equivalences
  • Saturation by deduction is performed till reaching a contradiction

(0 ↔ 1)

  • Otherwise, Split for each variable to deduce new equivalences
  • Continue with higher level of saturations
  • K. Ghorbal (INRIA)

41 SIF M2 41 / 42

slide-102
SLIDE 102

Saturation Rules (example)

Works on triplet of the form p ↔ q ∧ r

  • If r ↔ 1, then p ↔ q
  • If p ↔ 1, then q ↔ 1 and r ↔ 1
  • If q ↔ 0, then p ↔ 0
  • If q ↔ r, then p ↔ q and p ↔ r
  • If p ↔ ¬q, then q ↔ 1 and r ↔ 0
  • K. Ghorbal (INRIA)

42 SIF M2 42 / 42