CDCL SAT Solvers & SAT-Based Problem Solving Joao Marques-Silva 1 - - PowerPoint PPT Presentation

cdcl sat solvers sat based problem solving
SMART_READER_LITE
LIVE PREVIEW

CDCL SAT Solvers & SAT-Based Problem Solving Joao Marques-Silva 1 - - PowerPoint PPT Presentation

CDCL SAT Solvers & SAT-Based Problem Solving Joao Marques-Silva 1 , 2 & Mikolas Janota 2 1 University College Dublin, Ireland 2 IST/INESC-ID, Lisbon, Portugal SAT/SMT Summer School 2013 Aalto University, Espoo, Finland The Success of SAT


slide-1
SLIDE 1

CDCL SAT Solvers & SAT-Based Problem Solving

Joao Marques-Silva1,2 & Mikolas Janota2

1University College Dublin, Ireland 2IST/INESC-ID, Lisbon, Portugal

SAT/SMT Summer School 2013 Aalto University, Espoo, Finland

slide-2
SLIDE 2

The Success of SAT

  • Well-known NP-complete decision problem

[C71]

  • In practice, SAT is a success story of Computer Science

– Hundreds (even more?) of practical applications

slide-3
SLIDE 3

Part I CDCL SAT Solvers

slide-4
SLIDE 4

Outline

Basic Definitions DPLL Solvers CDCL Solvers What Next in CDCL Solvers?

slide-5
SLIDE 5

Outline

Basic Definitions DPLL Solvers CDCL Solvers What Next in CDCL Solvers?

slide-6
SLIDE 6

Preliminaries

  • Variables: w, x, y, z, a, b, c, . . .
  • Literals: w, ¯

x, ¯ y, a, . . . , but also ¬w, ¬y, . . .

  • Clauses: disjunction of literals or set of literals
  • Formula: conjunction of clauses or set of clauses
  • Model (satisfying assignment): partial/total mapping from

variables to {0, 1}

  • Formula can be SAT/UNSAT
slide-7
SLIDE 7

Preliminaries

  • Variables: w, x, y, z, a, b, c, . . .
  • Literals: w, ¯

x, ¯ y, a, . . . , but also ¬w, ¬y, . . .

  • Clauses: disjunction of literals or set of literals
  • Formula: conjunction of clauses or set of clauses
  • Model (satisfying assignment): partial/total mapping from

variables to {0, 1}

  • Formula can be SAT/UNSAT
  • Example:

F , (r) ∧ (¯ r ∨ s) ∧ (¯ w ∨ a) ∧ (¯ x ∨ b) ∧ (¯ y ∨ ¯ z ∨ c) ∧ (¯ b ∨ ¯ c ∨ d) – Example models:

I {r, s, a, b, c, d} I {r, s, ¯

x, y, ¯ w, z, ¯ a, b, c, d}

slide-8
SLIDE 8

Resolution

  • Resolution rule:

[DP60,R65]

(α ∨ x) (β ∨ ¯ x) (α ∨ β) – Complete proof system for propositional logic

slide-9
SLIDE 9

Resolution

  • Resolution rule:

[DP60,R65]

(α ∨ x) (β ∨ ¯ x) (α ∨ β) – Complete proof system for propositional logic (x ∨ a) (¯ x ∨ a) (¯ y ∨ ¯ a) (y ∨ ¯ a) (a) (¯ a) ⊥ – Extensively used with (CDCL) SAT solvers

slide-10
SLIDE 10

Resolution

  • Resolution rule:

[DP60,R65]

(α ∨ x) (β ∨ ¯ x) (α ∨ β) – Complete proof system for propositional logic (x ∨ a) (¯ x ∨ a) (¯ y ∨ ¯ a) (y ∨ ¯ a) (a) (¯ a) ⊥ – Extensively used with (CDCL) SAT solvers

  • Self-subsuming resolution (with α0 ⊆ α):

[e.g. SP04,EB05]

(α ∨ x) (α0 ∨ ¯ x) (α) – (α) subsumes (α ∨ x)

slide-11
SLIDE 11

Unit Propagation

F = (r) ∧ (¯ r ∨ s)∧ (¯ w ∨ a) ∧ (¯ x ∨ ¯ a ∨ b) (¯ y ∨ ¯ z ∨ c) ∧ (¯ b ∨ ¯ c ∨ d)

slide-12
SLIDE 12

Unit Propagation

F = (r) ∧ (¯ r ∨ s)∧ (¯ w ∨ a) ∧ (¯ x ∨ ¯ a ∨ b) (¯ y ∨ ¯ z ∨ c) ∧ (¯ b ∨ ¯ c ∨ d)

  • Decisions / Variable Branchings:

w = 1, x = 1, y = 1, z = 1

slide-13
SLIDE 13

Unit Propagation

F = (r) ∧ (¯ r ∨ s)∧ (¯ w ∨ a) ∧ (¯ x ∨ ¯ a ∨ b) (¯ y ∨ ¯ z ∨ c) ∧ (¯ b ∨ ¯ c ∨ d)

  • Decisions / Variable Branchings:

w = 1, x = 1, y = 1, z = 1

Level Dec. Unit Prop. 1 2 3 4 ∅ w x y z a b c d r s

slide-14
SLIDE 14

Unit Propagation

F = (r) ∧ (¯ r ∨ s)∧ (¯ w ∨ a) ∧ (¯ x ∨ ¯ a ∨ b) (¯ y ∨ ¯ z ∨ c) ∧ (¯ b ∨ ¯ c ∨ d)

  • Decisions / Variable Branchings:

w = 1, x = 1, y = 1, z = 1

Level Dec. Unit Prop. 1 2 3 4 ∅ w x y z a b c d r s

  • Additional definitions:

– Antecedent (or reason) of an implied assignment

I (¯

b ∨ ¯ c ∨ d) for d

– Associate assignment with decision levels

I w = 1 @ 1, x = 1 @ 2, y = 1 @ 3, z = 1 @ 4 I r = 1 @ 0, d = 1 @ 4, ...

slide-15
SLIDE 15

Outline

Basic Definitions DPLL Solvers CDCL Solvers What Next in CDCL Solvers?

slide-16
SLIDE 16

The DPLL Algorithm

Assign value to variable Unassigned variables ? Unit propagation Conflict ? Can undo decision ? Backtrack & flip variable Unsatisfiable Satisfiable Y N Y N Y N

  • Optional: pure literal rule
slide-17
SLIDE 17

The DPLL Algorithm

Assign value to variable Unassigned variables ? Unit propagation Conflict ? Can undo decision ? Backtrack & flip variable Unsatisfiable Satisfiable Y N Y N Y N

  • Optional: pure literal rule

F = (x∨y)∧(a∨b)∧(¯ a∨b)∧(a∨¯ b)∧(¯ a∨¯ b)

slide-18
SLIDE 18

The DPLL Algorithm

Assign value to variable Unassigned variables ? Unit propagation Conflict ? Can undo decision ? Backtrack & flip variable Unsatisfiable Satisfiable Y N Y N Y N

  • Optional: pure literal rule

F = (x∨y)∧(a∨b)∧(¯ a∨b)∧(a∨¯ b)∧(¯ a∨¯ b)

Level Dec. Unit Prop. 1 2 3 ∅ x y a b ⊥ a ¯ a y a ¯ a ¯ y x a ¯ a ¯ x

slide-19
SLIDE 19

The DPLL Algorithm

Assign value to variable Unassigned variables ? Unit propagation Conflict ? Can undo decision ? Backtrack & flip variable Unsatisfiable Satisfiable Y N Y N Y N

  • Optional: pure literal rule

F = (x∨y)∧(a∨b)∧(¯ a∨b)∧(a∨¯ b)∧(¯ a∨¯ b)

Level Dec. Unit Prop. 1 2 3 ∅ x y ¯ a ¯ b ⊥ a ¯ a y a ¯ a ¯ y x a ¯ a ¯ x

slide-20
SLIDE 20

The DPLL Algorithm

Assign value to variable Unassigned variables ? Unit propagation Conflict ? Can undo decision ? Backtrack & flip variable Unsatisfiable Satisfiable Y N Y N Y N

  • Optional: pure literal rule

F = (x∨y)∧(a∨b)∧(¯ a∨b)∧(a∨¯ b)∧(¯ a∨¯ b)

Level Dec. Unit Prop. 1 2 3 ∅ x ¯ y a b ⊥ a ¯ a y a ¯ a ¯ y x a ¯ a ¯ x

slide-21
SLIDE 21

The DPLL Algorithm

Assign value to variable Unassigned variables ? Unit propagation Conflict ? Can undo decision ? Backtrack & flip variable Unsatisfiable Satisfiable Y N Y N Y N

  • Optional: pure literal rule

F = (x∨y)∧(a∨b)∧(¯ a∨b)∧(a∨¯ b)∧(¯ a∨¯ b)

Level Dec. Unit Prop. 1 2 3 ∅ x ¯ y ¯ a ¯ b ⊥ a ¯ a y a ¯ a ¯ y x a ¯ a ¯ x

slide-22
SLIDE 22

The DPLL Algorithm

Assign value to variable Unassigned variables ? Unit propagation Conflict ? Can undo decision ? Backtrack & flip variable Unsatisfiable Satisfiable Y N Y N Y N

  • Optional: pure literal rule

F = (x∨y)∧(a∨b)∧(¯ a∨b)∧(a∨¯ b)∧(¯ a∨¯ b)

Level Dec. Unit Prop. 1 2 ∅ ¯ x a y b ⊥ a ¯ a y a ¯ a ¯ y x a ¯ a ¯ x

slide-23
SLIDE 23

The DPLL Algorithm

Assign value to variable Unassigned variables ? Unit propagation Conflict ? Can undo decision ? Backtrack & flip variable Unsatisfiable Satisfiable Y N Y N Y N

  • Optional: pure literal rule

F = (x∨y)∧(a∨b)∧(¯ a∨b)∧(a∨¯ b)∧(¯ a∨¯ b)

Level Dec. Unit Prop. 1 2 ∅ ¯ x ¯ a y ¯ b ⊥ a ¯ a y a ¯ a ¯ y x a ¯ a ¯ x

slide-24
SLIDE 24

Outline

Basic Definitions DPLL Solvers CDCL Solvers What Next in CDCL Solvers?

slide-25
SLIDE 25

What is a CDCL SAT Solver?

  • Extend DPLL SAT solver with:

[DP60,DLL62]

– Clause learning & non-chronological backtracking

[MSS96,BS97,Z97] I Exploit UIPs [MSS96,SSS12] I Minimize learned clauses [SB09,VG09] I Opportunistically delete clauses [MSS96,MSS99,GN02]

– Search restarts

[GSK98,BMS00,H07,B08]

– Lazy data structures

I Watched literals [MMZZM01]

– Conflict-guided branching

I Lightweight branching heuristics [MMZZM01] I Phase saving [PD07]

– ...

slide-26
SLIDE 26

How Significant are CDCL SAT Solvers?

200 400 600 800 1000 1200 20 40 60 80 100 120 140 160 180 200 CPU Time (in seconds) Number of problems solved Results of the SAT competition/race winners on the SAT 2009 application benchmarks, 20mn timeout Limmat (2002) Zchaff (2002) Berkmin (2002) Forklift (2003) Siege (2003) Zchaff (2004) SatELite (2005) Minisat 2 (2006) Picosat (2007) Rsat (2007) Minisat 2.1 (2008) Precosat (2009) Glucose (2009) Clasp (2009) Cryptominisat (2010) Lingeling (2010) Minisat 2.2 (2010) Glucose 2 (2011) Glueminisat (2011) Contrasat (2011) Lingeling 587f (2011)

GRASP DPLL

? ?

slide-27
SLIDE 27

Outline

Basic Definitions DPLL Solvers CDCL Solvers Clause Learning, UIPs & Minimization Search Restarts & Lazy Data Structures What Next in CDCL Solvers?

slide-28
SLIDE 28

Clause Learning

Level Dec. Unit Prop. 1 2 3 ∅ x x y z z a b ⊥

slide-29
SLIDE 29

Clause Learning

Level Dec. Unit Prop. 1 2 3 ∅ x y z a b ⊥ (¯ a ∨ ¯ b) (¯ z ∨ b) (¯ x ∨ ¯ z ∨ a) (¯ a ∨ ¯ z) (¯ x ∨ ¯ z)

  • Analyze conflict

– Reasons: x and z

I Decision variable & literals assigned at lower decision levels

– Create new clause: (¯ x ∨ ¯ z)

  • Can relate clause learning with resolution

ab -> false = !(ab) + false = !a + !b z -> b = !z + b xz -> a. =. !(xz) + a =. !x + !z + a

slide-30
SLIDE 30

Clause Learning – After Bracktracking

Level Dec. Unit Prop. 1 2 3 ∅ x y z z a b ⊥ z

slide-31
SLIDE 31

Clause Learning – After Bracktracking

Level Dec. Unit Prop. 1 2 3 ∅ x y z a b ⊥ z

  • Clause (¯

x ∨ ¯ z) is asserting at decision level 1

slide-32
SLIDE 32

Clause Learning – After Bracktracking

Level Dec. Unit Prop. 1 2 3 ∅ x y z a b ⊥ z Level Dec. Unit Prop. 1 ∅ x ¯ z

  • Clause (¯

x ∨ ¯ z) is asserting at decision level 1

slide-33
SLIDE 33

Clause Learning – After Bracktracking

Level Dec. Unit Prop. 1 2 3 ∅ x y z a b ⊥ z Level Dec. Unit Prop. 1 ∅ x ¯ z

  • Clause (¯

x ∨ ¯ z) is asserting at decision level 1

  • Learned clauses are always asserting

[MSS96,MSS99]

  • Backtracking differs from plain DPLL:

– Always bactrack after a conflict

[MMZZM01]