sat solving – algorithms
TRANSCRIPT
I DPLL
I CDCL
I A solving abstraction
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 1
SAT Solving – Algorithms
Steffen Holldobler and Norbert MantheyInternational Center for Computational LogicTechnische Universitat DresdenGermany
Warm Up
I Used programming languages
I Size of implemented projects
I Parallel computing (multi-core, GPGPU, cluster)
I Interest in computer architecture
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 2
Warm Up
I Used programming languages
I Size of implemented projects
I Parallel computing (multi-core, GPGPU, cluster)
I Interest in computer architecture
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 3
Warm Up
I Used programming languages
I Size of implemented projects
I Parallel computing (multi-core, GPGPU, cluster)
I Interest in computer architecture
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 4
Warm Up
I Used programming languages
I Size of implemented projects
I Parallel computing (multi-core, GPGPU, cluster)
I Interest in computer architecture
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 5
Revision
I Used Data Types
I Semantics
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 6
Formulas and Interpretations
I Let F be a formulas an I be an interpretation
I I can. satisfy F , if F |I ≡ >. falsify F , if F |I ≡ ⊥
I A formula can be. unsatisfiable, F ≡ ⊥. satisfiable. tautologic, F ≡ >
I Property: F ≡ >, then ¬F ≡ ⊥.
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 7
Formulas and Interpretations
I Let F be a formulas an I be an interpretation
I I can. satisfy F , if F |I ≡ >. falsify F , if F |I ≡ ⊥
I A formula can be. unsatisfiable, F ≡ ⊥. satisfiable. tautologic, F ≡ >
I Property: F ≡ >, then ¬F ≡ ⊥.
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 8
Formulas and Interpretations
I Let F be a formulas an I be an interpretation
I I can. satisfy F , if F |I ≡ >. falsify F , if F |I ≡ ⊥
I A formula can be. unsatisfiable, F ≡ ⊥. satisfiable. tautologic, F ≡ >
I Property: F ≡ >, then ¬F ≡ ⊥.
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 9
Clauses and Conjunctive Normal Forms
I Definition
. A clause is a generalized disjunction [L1, . . . , Ln], n ≥ 0,where every Li , 1 ≤ i ≤ n, is a literal
. A clause is a unit clause if it contains precisely one literal
. A clause is a binary clause if it contains precisely two literals
I Definition
. A formula is in conjunctive normal form (clause form, CNF) iffit is of the form 〈C1, . . . , Cm〉, m ≥ 0, and every Cj , 1 ≤ j ≤ m, is a clause
I Implementation and working assumptions
. A clause is an array of literals
II Maintained to be a set of literals (no duplicates)
II Clauses are no tautologies (excluded during parsing)
. A formula is an array of (pointers/references to) clauses
II Maintained to be a multi set
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 10
Clauses and Conjunctive Normal Forms
I Definition
. A clause is a generalized disjunction [L1, . . . , Ln], n ≥ 0,where every Li , 1 ≤ i ≤ n, is a literal
. A clause is a unit clause if it contains precisely one literal
. A clause is a binary clause if it contains precisely two literals
I Definition
. A formula is in conjunctive normal form (clause form, CNF) iffit is of the form 〈C1, . . . , Cm〉, m ≥ 0, and every Cj , 1 ≤ j ≤ m, is a clause
I Implementation and working assumptions
. A clause is an array of literals
II Maintained to be a set of literals (no duplicates)
II Clauses are no tautologies (excluded during parsing)
. A formula is an array of (pointers/references to) clauses
II Maintained to be a multi set
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 11
Propositional Resolution
I Remind: clauses are considered to be sets
I Definition Let C1 be a clause containing L and C2 be a clause containing L;The (propositional) resolvent of C1 and C2 with respect to L is the clause
(C1 \ {L}) ∪ (C2 \ {L})
C is said to be a resolvent of C1 and C2 iffthere exists a literal L such that C is the resolvent of C1 and C2 wrt L
I Examples when resolving on a
I (a ∨ ¬a)⊗ (¬a ∨ a) = (a ∨ ¬a)
I (a ∨ ¬b)⊗ (¬a ∨ b) = (b ∨ ¬b)
I (a ∨ b)⊗ (¬a ∨ b) = (b)
I Resolvents can subsume antecedents
I Usually, resolvents have more literals than antecedents
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 12
Propositional Resolution
I Remind: clauses are considered to be sets
I Definition Let C1 be a clause containing L and C2 be a clause containing L;The (propositional) resolvent of C1 and C2 with respect to L is the clause
(C1 \ {L}) ∪ (C2 \ {L})
C is said to be a resolvent of C1 and C2 iffthere exists a literal L such that C is the resolvent of C1 and C2 wrt L
I Examples when resolving on a
I (a ∨ ¬a)⊗ (¬a ∨ a) = (a ∨ ¬a)
I (a ∨ ¬b)⊗ (¬a ∨ b) = (b ∨ ¬b)
I (a ∨ b)⊗ (¬a ∨ b) = (b)
I Resolvents can subsume antecedents
I Usually, resolvents have more literals than antecedents
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 13
Propositional Resolution
I Remind: clauses are considered to be sets
I Definition Let C1 be a clause containing L and C2 be a clause containing L;The (propositional) resolvent of C1 and C2 with respect to L is the clause
(C1 \ {L}) ∪ (C2 \ {L})
C is said to be a resolvent of C1 and C2 iffthere exists a literal L such that C is the resolvent of C1 and C2 wrt L
I Examples when resolving on a
I (a ∨ ¬a)⊗ (¬a ∨ a) = (a ∨ ¬a)
I (a ∨ ¬b)⊗ (¬a ∨ b) = (b ∨ ¬b)
I (a ∨ b)⊗ (¬a ∨ b) = (b)
I Resolvents can subsume antecedents
I Usually, resolvents have more literals than antecedents
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 14
SAT Solving
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 15
SAT Solving - Example
I Given: Conjunction of clauses
I Task: Find satisfying interpretation for variables if possible!
F = (a ∨ c) ∧ (b ∨ e ∨ f ) ∧ (a ∨ d ∨ f ) ∧ (a ∨ b ∨ d ∨ e) ∧ (a ∨ b)
I How to find a solution?
I Some questions:
1. How many combinations (solution candidates) exist for 6 Boolean variables?
2. How many percent of the candidates are cut by a unit clause?
3. How many percent of the candidates are cut by a binary, ternary, ... clause?
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 16
SAT Solving - Example
I Given: Conjunction of clauses
I Task: Find satisfying interpretation for variables if possible!
F = (a ∨ c) ∧ (b ∨ e ∨ f ) ∧ (a ∨ d ∨ f ) ∧ (a ∨ b ∨ d ∨ e) ∧ (a ∨ b)
I How to find a solution?
I Some questions:
1. How many combinations (solution candidates) exist for 6 Boolean variables?
2. How many percent of the candidates are cut by a unit clause?
3. How many percent of the candidates are cut by a binary, ternary, ... clause?
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 17
SAT Solving - Example
I Given: Conjunction of clauses
I Task: Find satisfying interpretation for variables if possible!
F = (a ∨ c) ∧ (b ∨ e ∨ f ) ∧ (a ∨ d ∨ f ) ∧ (a ∨ b ∨ d ∨ e) ∧ (a ∨ b)
I How to find a solution?
I Some questions:
1. How many combinations (solution candidates) exist for 6 Boolean variables?
2. How many percent of the candidates are cut by a unit clause?
3. How many percent of the candidates are cut by a binary, ternary, ... clause?
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 18
SAT Solving - Example
I Given: Conjunction of clauses
I Task: Find satisfying interpretation for variables if possible!
F = (a ∨ c) ∧ (b ∨ e ∨ f ) ∧ (a ∨ d ∨ f ) ∧ (a ∨ b ∨ d ∨ e) ∧ (a ∨ b)
I How to find a solution?
I Some questions:
1. How many combinations (solution candidates) exist for 6 Boolean variables?
2. How many percent of the candidates are cut by a unit clause?
3. How many percent of the candidates are cut by a binary, ternary, ... clause?
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 19
Power of Modern SAT Solvers
10
100
1000
10000
100000
1e+06
1e+07
1e+08
10 100 1000 10000 100000 1e+06 1e+07 1e+08
Cla
use
s
Variables
identity
0
100
200
300
400
500
600
700
800
900
run
tim
e
I RISS 4.27, SAT Competition 2014, application track
I Formulas with several million clauses and variables can be solved
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 20
SAT Solving – With Search
I Assume a literal
I Propagate immediate consequences
I If a conflict, backtrack
I Known as DPLL (Davis Putnam Logemann Loveland)
I What are immediate consequences?
F
|b
a
= (a ∨ c) ∧ (b ∨ e ∨ f ) ∧ (a ∨ d ∨ f ) ∧ (a ∨ b ∨ d ∨ e) ∧ (a ∨ b)
I Assume b = >, then we have J = (b)
I Are there variables with a forced assignment?
. a
and c
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 21
SAT Solving – With Search
I Assume a literal
I Propagate immediate consequences
I If a conflict, backtrack
I Known as DPLL (Davis Putnam Logemann Loveland)
I What are immediate consequences?
F
|b
a
= (a ∨ c) ∧ (b ∨ e ∨ f ) ∧ (a ∨ d ∨ f ) ∧ (a ∨ b ∨ d ∨ e) ∧ (a ∨ b)
I Assume b = >, then we have J = (b)
I Are there variables with a forced assignment?
. a
and c
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 22
SAT Solving – With Search
I Assume a literal
I Propagate immediate consequences
I If a conflict, backtrack
I Known as DPLL (Davis Putnam Logemann Loveland)
I What are immediate consequences?
F
|b
a
= (a ∨ c) ∧ (b ∨ e ∨ f ) ∧ (a ∨ d ∨ f ) ∧ (a ∨ b ∨ d ∨ e) ∧ (a ∨ b)
I Assume b = >, then we have J = (b)
I Are there variables with a forced assignment?
. a
and c
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 23
SAT Solving – With Search
I Assume a literal
I Propagate immediate consequences
I If a conflict, backtrack
I Known as DPLL (Davis Putnam Logemann Loveland)
I What are immediate consequences?
F
|b
a
= (a ∨ c) ∧ (b ∨ e ∨ f ) ∧ (a ∨ d ∨ f ) ∧ (a ∨ b ∨ d ∨ e) ∧ (a ∨ b)
I Assume b = >, then we have J = (b)
I Are there variables with a forced assignment?
. a
and c
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 24
SAT Solving – With Search
I Assume a literal
I Propagate immediate consequences
I If a conflict, backtrack
I Known as DPLL (Davis Putnam Logemann Loveland)
I What are immediate consequences?
F |b
a
= (a ∨ c) ∧ (b ∨ e ∨ f ) ∧ (a ∨ d ∨ f ) ∧ (a ∨ b ∨ d ∨ e) ∧ (a ∨ b)
I Assume b = >, then we have J = (b)
I Are there variables with a forced assignment?
. a
and c
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 25
SAT Solving – With Search
I Assume a literal
I Propagate immediate consequences
I If a conflict, backtrack
I Known as DPLL (Davis Putnam Logemann Loveland)
I What are immediate consequences?
F |b
a
= (a ∨ c) ∧ (b ∨ e ∨ f ) ∧ (a ∨ d ∨ f ) ∧ (a ∨ b ∨ d ∨ e) ∧ (a ∨ b)
I Assume b = >, then we have J = (b)
I Are there variables with a forced assignment?
. a
and c
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 26
SAT Solving – With Search
I Assume a literal
I Propagate immediate consequences
I If a conflict, backtrack
I Known as DPLL (Davis Putnam Logemann Loveland)
I What are immediate consequences?
F |ba = (a ∨ c) ∧ (b ∨ e ∨ f ) ∧ (a ∨ d ∨ f ) ∧ (a ∨ b ∨ d ∨ e) ∧ (a ∨ b)
I Assume b = >, then we have J = (b)
I Are there variables with a forced assignment?
. a
and c
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 27
SAT Solving – With Search
I Assume a literal
I Propagate immediate consequences
I If a conflict, backtrack
I Known as DPLL (Davis Putnam Logemann Loveland)
I What are immediate consequences?
F |ba = (a ∨ c) ∧ (b ∨ e ∨ f ) ∧ (a ∨ d ∨ f ) ∧ (a ∨ b ∨ d ∨ e) ∧ (a ∨ b)
I Assume b = >, then we have J = (b)
I Are there variables with a forced assignment?
. a and c
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 28
Davis Putnam Logemann Loveland (DPLL) in a Nutshell
=(a ∨ b) ∧ (b ∨ d ∨ e) ∧ (c ∨ d) ∧ (a ∨ b ∨ e ∨ f ) ∧ (a ∨ e ∨ f ) ∧ (d ∨ f ) ∧ (c ∨ e ∨ f )
DPLL
found conflictC5 = (a ∨ e ∨ f)
Variable
Reason
a
-
b
-
c
-
d
-
e
-
f
-
a
b
c
dd
e
f
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 29
Davis Putnam Logemann Loveland (DPLL) in a Nutshell
=(a ∨ b) ∧ (b ∨ d ∨ e) ∧ (c ∨ d) ∧ (a ∨ b ∨ e ∨ f ) ∧ (a ∨ e ∨ f ) ∧ (d ∨ f ) ∧ (c ∨ e ∨ f )
DPLL
found conflictC5 = (a ∨ e ∨ f)
Variable
Reason
a
-
b
-
c
-
d
-
e
-
f
-
a
b
c
dd
e
f
I add a search decision
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 30
Davis Putnam Logemann Loveland (DPLL) in a Nutshell
=(a ∨ b) ∧ (b ∨ d ∨ e) ∧ (c ∨ d) ∧ (a ∨ b ∨ e ∨ f ) ∧ (a ∨ e ∨ f ) ∧ (d ∨ f ) ∧ (c ∨ e ∨ f )
DPLL
found conflictC5 = (a ∨ e ∨ f)
Variable
Reason
a
-
b
C1
c
-
d
-
e
-
f
-
a
b
c
dd
e
f
I propagate consequences
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 31
Davis Putnam Logemann Loveland (DPLL) in a Nutshell
=(a ∨ b) ∧ (b ∨ d ∨ e) ∧ (c ∨ d) ∧ (a ∨ b ∨ e ∨ f ) ∧ (a ∨ e ∨ f ) ∧ (d ∨ f ) ∧ (c ∨ e ∨ f )
DPLL
found conflictC5 = (a ∨ e ∨ f)
Variable
Reason
a
-
b
C1
c
-
d
-
e
-
f
-
a
b
c
dd
e
f
I add a search decision
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 32
Davis Putnam Logemann Loveland (DPLL) in a Nutshell
=(a ∨ b) ∧ (b ∨ d ∨ e) ∧ (c ∨ d) ∧ (a ∨ b ∨ e ∨ f ) ∧ (a ∨ e ∨ f ) ∧ (d ∨ f ) ∧ (c ∨ e ∨ f )
DPLL
found conflictC5 = (a ∨ e ∨ f)
Variable
Reason
a
-
b
C1
c
-
d
-
e
-
f
-
a
b
c
d
d
e
f
I add a search decision
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 33
Davis Putnam Logemann Loveland (DPLL) in a Nutshell
=(a ∨ b) ∧ (b ∨ d ∨ e) ∧ (c ∨ d) ∧ (a ∨ b ∨ e ∨ f ) ∧ (a ∨ e ∨ f ) ∧ (d ∨ f ) ∧ (c ∨ e ∨ f )
DPLL
found conflictC5 = (a ∨ e ∨ f)
Variable
Reason
a
-
b
C1
c
-
d
-
e
C2
f
-
a
b
c
d
d
e
f
I propagate consequences
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 34
Davis Putnam Logemann Loveland (DPLL) in a Nutshell
=(a ∨ b) ∧ (b ∨ d ∨ e) ∧ (c ∨ d) ∧ (a ∨ b ∨ e ∨ f ) ∧ (a ∨ e ∨ f ) ∧ (d ∨ f ) ∧ (c ∨ e ∨ f )
DPLL
found conflictC5 = (a ∨ e ∨ f)
Variable
Reason
a
-
b
C1
c
-
d
-
e
C2
f
C4
a
b
c
d
d
e
f
I propagate consequences
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 35
Davis Putnam Logemann Loveland (DPLL) in a Nutshell
=(a ∨ b) ∧ (b ∨ d ∨ e) ∧ (c ∨ d) ∧ (a ∨ b ∨ e ∨ f ) ∧ (a ∨ e ∨ f ) ∧ (d ∨ f ) ∧ (c ∨ e ∨ f )
DPLL
found conflictC5 = (a ∨ e ∨ f)
Variable
Reason
a
-
b
C1
c
-
d
-
e
C2
f
C4
a
b
c
dd
e
f
I backtrack from conflict and proceed with search
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 36
DPLL pseudo code
I An iterative solving algorithm
IDPLL (CNF formula F )
Input: A formula F in CNFOutput: The solution SAT or UNSAT of this formula
1 J := () // start with empty interpretation2 while true // until we find a solution3 if F |J = ∅ then return SAT // satisfiability rule4 if [] ∈ F |J then // there was a conflict5 if J = J′xJ′′ and @y ∈ J′′ then // backtrack and undo most recent decision6 J := J′x // add the complement7 continue8 else return UNSAT // unsatisfiability rule9 if (x) ∈ F |J then // unit rule
10 J := Jx // extend the interpretation11 continue12 if x ∈ lits(F |J ) and x /∈ lits(F |J ) then // pure literal rule13 J := Jx14 continue15 J := Jx for some x ∈ lits(F |J ) // decide rule
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 37
Conclusions of the DPLL Algorithm
I Chronological backtracking
I Heavily depends on the order of the decision variables
I How to perform unit propagation? How to find a unit in the formula efficiently?
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 38
Unit Propagation
I How to perform unit propagation?
I How to find a unit in the formula efficiently?
I Assumption: we use the presented pseudo code as algorithm.
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 39
Conflict Driven Clause Learning (CDCL) in a Nutshell
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 40
Conflict Driven Clause Learning (CDCL) in a Nutshell
F =(a ∨ b)∧ (b ∨ d ∨ e)∧ (c ∨ d)∧ (a ∨ b ∨ e ∨ f )∧ (a ∨ e ∨ f )∧ (d ∨ f )∧ (c ∨ e ∨ f )
CDCL
found conflictC5 = (a ∨ e ∨ f)
clause learningC7 = C4 ⊗ C5 : (a ∨ b ∨ e)
minimizationC8 = C7 ⊗ C1 : (a ∨ e)
Variable
Reason
a
-
b
-
c
-
d
-
e
-
f
-
a
b
ce
d
e
f
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 41
Conflict Driven Clause Learning (CDCL) in a Nutshell
F =(a ∨ b)∧ (b ∨ d ∨ e)∧ (c ∨ d)∧ (a ∨ b ∨ e ∨ f )∧ (a ∨ e ∨ f )∧ (d ∨ f )∧ (c ∨ e ∨ f )
CDCL
found conflictC5 = (a ∨ e ∨ f)
clause learningC7 = C4 ⊗ C5 : (a ∨ b ∨ e)
minimizationC8 = C7 ⊗ C1 : (a ∨ e)
Variable
Reason
a
-
b
-
c
-
d
-
e
-
f
-
a
b
ce
d
e
f
I add a search decision
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 42
Conflict Driven Clause Learning (CDCL) in a Nutshell
F =(a ∨ b)∧ (b ∨ d ∨ e)∧ (c ∨ d)∧ (a ∨ b ∨ e ∨ f )∧ (a ∨ e ∨ f )∧ (d ∨ f )∧ (c ∨ e ∨ f )
CDCL
found conflictC5 = (a ∨ e ∨ f)
clause learningC7 = C4 ⊗ C5 : (a ∨ b ∨ e)
minimizationC8 = C7 ⊗ C1 : (a ∨ e)
Variable
Reason
a
-
b
C1
c
-
d
-
e
-
f
-
a
b
ce
d
e
f
I propagate consequences
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 43
Conflict Driven Clause Learning (CDCL) in a Nutshell
F =(a ∨ b)∧ (b ∨ d ∨ e)∧ (c ∨ d)∧ (a ∨ b ∨ e ∨ f )∧ (a ∨ e ∨ f )∧ (d ∨ f )∧ (c ∨ e ∨ f )
CDCL
found conflictC5 = (a ∨ e ∨ f)
clause learningC7 = C4 ⊗ C5 : (a ∨ b ∨ e)
minimizationC8 = C7 ⊗ C1 : (a ∨ e)
Variable
Reason
a
-
b
C1
c
-
d
-
e
-
f
-
a
b
c
ed
e
f
I add a search decision
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 44
Conflict Driven Clause Learning (CDCL) in a Nutshell
F =(a ∨ b)∧ (b ∨ d ∨ e)∧ (c ∨ d)∧ (a ∨ b ∨ e ∨ f )∧ (a ∨ e ∨ f )∧ (d ∨ f )∧ (c ∨ e ∨ f )
CDCL
found conflictC5 = (a ∨ e ∨ f)
clause learningC7 = C4 ⊗ C5 : (a ∨ b ∨ e)
minimizationC8 = C7 ⊗ C1 : (a ∨ e)
Variable
Reason
a
-
b
C1
c
-
d
-
e
-
f
-
a
b
c
e
d
e
f
I add a search decision
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 45
Conflict Driven Clause Learning (CDCL) in a Nutshell
F =(a ∨ b)∧ (b ∨ d ∨ e)∧ (c ∨ d)∧ (a ∨ b ∨ e ∨ f )∧ (a ∨ e ∨ f )∧ (d ∨ f )∧ (c ∨ e ∨ f )
CDCL
found conflictC5 = (a ∨ e ∨ f)
clause learningC7 = C4 ⊗ C5 : (a ∨ b ∨ e)
minimizationC8 = C7 ⊗ C1 : (a ∨ e)
Variable
Reason
a
-
b
C1
c
-
d
-
e
C2
f
-
a
b
c
e
d
e
f
I propagate consequences
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 46
Conflict Driven Clause Learning (CDCL) in a Nutshell
F =(a ∨ b)∧ (b ∨ d ∨ e)∧ (c ∨ d)∧ (a ∨ b ∨ e ∨ f )∧ (a ∨ e ∨ f )∧ (d ∨ f )∧ (c ∨ e ∨ f )
CDCL
found conflictC5 = (a ∨ e ∨ f)
clause learningC7 = C4 ⊗ C5 : (a ∨ b ∨ e)
minimizationC8 = C7 ⊗ C1 : (a ∨ e)
Variable
Reason
a
-
b
C1
c
-
d
-
e
C2
f
C4
a
b
c
e
d
e
f
I propagate consequences
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 47
Conflict Driven Clause Learning (CDCL) in a Nutshell
F =(a ∨ b)∧ (b ∨ d ∨ e)∧ (c ∨ d)∧ (a ∨ b ∨ e ∨ f )∧ (a ∨ e ∨ f )∧ (d ∨ f )∧ (c ∨ e ∨ f )
CDCL
found conflictC5 = (a ∨ e ∨ f)
clause learningC7 = C4 ⊗ C5 : (a ∨ b ∨ e)
minimizationC8 = C7 ⊗ C1 : (a ∨ e)
Variable
Reason
a
-
b
C1
c
-
d
-
e
C2
f
C4
a
b
c
e
d
e
f
I create and add the learned clause to the formula
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 48
Conflict Driven Clause Learning (CDCL) in a Nutshell
F =(a ∨ b)∧ (b ∨ d ∨ e)∧ (c ∨ d)∧ (a ∨ b ∨ e ∨ f )∧ (a ∨ e ∨ f )∧ (d ∨ f )∧ (c ∨ e ∨ f )
CDCL
found conflictC5 = (a ∨ e ∨ f)
clause learningC7 = C4 ⊗ C5 : (a ∨ b ∨ e)
minimizationC8 = C7 ⊗ C1 : (a ∨ e)
Variable
Reason
a
-
b
C1
c
-
d
-
e
C2
f
C4
a
b
c
e
d
e
f
I create and add the learned clause to the formula
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 49
Conflict Driven Clause Learning (CDCL) in a Nutshell
F =(a ∨ b)∧ (b ∨ d ∨ e)∧ (c ∨ d)∧ (a ∨ b ∨ e ∨ f )∧ (a ∨ e ∨ f )∧ (d ∨ f )∧ (c ∨ e ∨ f )
CDCL
found conflictC5 = (a ∨ e ∨ f)
clause learningC7 = C4 ⊗ C5 : (a ∨ b ∨ e)
minimizationC8 = C7 ⊗ C1 : (a ∨ e)
Variable
Reason
a
-
b
C1
c
-
d
-
e
C8
f
-
a
b
ce
d
e
f
I backtrack, add C8, and proceed with unit propagation
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 50
The CDCL Algorithm
CDCL (CNF formula F )
Input: A formula F in CNFOutput: The solution SAT or UNSAT of this formula
1 J := () // start with empty interpretation2 while true3 while (x) ∈ F |J do // unit rule4 J := Jx5 if [] ∈ F |J then // conflict6 if ∃y ∈ J, such that J = J′J′′yJ′′′ then7 F := F ∪ C with F |= C and C /∈ F // learning8 J := J′ // backjumping9 else return UNSAT // unsatisfiability rule
10 else // no empty clause in F |J11 if atoms(J) ⊇ atoms(F ) then return SAT // satisfiability rule12 else J := Jz with atoms(z) ⊆ atoms(F ) // decision rule
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 51
Conclusions of the CDCL Algorithm
I Heavily depends on the order of the decision variables
I Non-Chronological backtracking, backjumping
I Learning of new clauses
I No mentioned here: restarts, clause removal
I Question: can the CDCL algorithm simulate the DPLL algorithm?
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 52
An Intuitive Abstraction of SAT Solver Techniques
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 53
Finding an Exit in a Maze
I Some rules
. starting point is located in the left column
. exit is on the right side (if there exists one)
. search decisions can be done only when moving right
. when moving left, use backtracking
I Property: satisfiable formulas correspond to mazes that can be solved bysearching right only
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 54
The DPLL Algorithm
I Heuristics:
. pick the highest possible column
. then, pick the lowest column
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 55
The DPLL Algorithm
I Heuristics:
. pick the highest possible column
. then, pick the lowest column
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 56
The DPLL Algorithm
I Heuristics:
. pick the highest possible column
. then, pick the lowest column
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 57
The DPLL Algorithm
I No decision, hence propagate
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 58
The DPLL Algorithm
I No exit (conflict), hence backtrack
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 59
The DPLL Algorithm
I No exit in the upper search space, hence backtrack
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 60
The DPLL Algorithm
I Do next search decision
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 61
The DPLL Algorithm
I Enter the same search space as before
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 62
The CDCL Algorithm (conflict driven clause learning)
I Choose,
I Propagate,
I and Backtrack after Conflict
I . . . enters the same search space again and again.
I Let’s go a few steps back . . .
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 63
The CDCL Algorithm (conflict driven clause learning)
I No decision, hence propagate
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 64
The CDCL Algorithm (conflict driven clause learning)
I No exit (conflict), hence backtrack
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 65
The CDCL Algorithm (conflict driven clause learning)
I . . . and learn a clause
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 66
The CDCL Algorithm (conflict driven clause learning)
I No exit in upper search space, backtrack and learn
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 67
The CDCL Algorithm (conflict driven clause learning)
I Do next search decision
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 68
The CDCL Algorithm (conflict driven clause learning)
I Does not enter the same search space as before
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 69
Motivating Clause Removal
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 70
How to perform Unit Propagation
I When is a unit clause in the reduct?
I How to find a unit clause in the reduct, especially in the CDCL algorithm?
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 71
Coming Next
I Simplification
I Parallel Search
Steffen Holldobler and Norbert MantheySAT Solving – Algorithms 72