Title: SAT Solving
1SAT Solving
Presented by Avi Yadgar
2The SAT Problem
- Given a Boolean formula , look for
assignment A for such that
. - A is a solution for .
- A partial assignment assigns a subset of .
- CNF representation of
- is a conjunction of clauses
- A clause is a disjunction of literals
3The SAT Problem
- ? (v1? v2? ? v5) ? (?v1? v7? ? v9) (v5? v7)
- A satisfies ? A satisfies all its
clauses. - Each clause needs one true literal
- NP-Complete
- Many applications
- Very efficient solvers
- Search / Proof engine
4Boolean Constraint Propagation
- Unit Clause A clause with exactly one unassigned
literal, while all the rest are false. - Asserts the value of the unassigned variable.
v1 0 v2 1 v3 ?
v1 ?
cl ( v3)
v3 1
?v2 ?
v1 0
?v2 0
5Boolean Constraint Propagation
- Unit Clause A clause with exactly one unassigned
literal, while all the rest are false. - Asserts the value of the unassigned variable.
- cl implies and is its antecedent.
- v1 and v2 are the antecedent variables of
- BCP() Calculates all the possible implications.
v1 0 v2 1 v3 ?
v3 1
6DPLL Davis Putnam Logemann Loveland Backtrack
Search
- Choose a decision variable and value.
7DPLL Davis Putnam Logemann Loveland Backtrack
Search
- Choose a decision variable and value.
- Run bcp()
8DPLL Davis Putnam Logemann Loveland Backtrack
Search
- Choose a decision variable and value.
- Run bcp()
9DPLL Davis Putnam Logemann Loveland Backtrack
Search
- Choose a decision variable and value.
- Run bcp()
- If a conflict occurs
- Flip the highest decision variable not yet
flipped.
10DPLL Davis Putnam Logemann Loveland Backtrack
Search
- Choose a decision variable and value.
- Run bcp()
- If a conflict occurs
- Flip the highest decision variable not yet
flipped. - Mark as flipped.
11DPLL Davis Putnam Logemann Loveland Backtrack
Search
- Choose a decision variable and value.
- Run bcp()
- If a conflict occurs
- flip the highest decision variable not yet
flipped. - Mark as flipped
- Run bcp().
12DPLL Davis Putnam Logemann Loveland Backtrack
Search
- Choose a decision variable and value.
- Run bcp()
- If a conflict occurs
- flip the highest decision variable not yet
flipped. - Mark as flipped
- Run bcp().
13DPLL Davis Putnam Logemann Loveland Backtrack
Search
- Choose a decision variable and value.
- Run bcp()
- If a conflict occurs
- flip the highest decision variable not yet
flipped. - Mark as flipped
- Run bcp().
14DPLL Davis Putnam Logemann Loveland Backtrack
Search
- Termination
- No unassigned variables SAT
- No decision variable to flip un-SAT
15Optimized BCP
16The SAT Problem - Resolution
v2? ? v5
- c1 (v1? v2? ? v5) , c2(?v1? v7? ? v9)
v7? ? v9
cres(c1 , c2) (v2? ? v5 ? v7? ? v9)
? ? cres ? ? ? ? cres
17SAT Solving - Implication Graph
(v9,v5) (v9,v8) (v9,v12) (v5,v7) (v5,v7,v3) (v
4,v1) (v1,v12,v19) (v1,v6) (v6,v19,v8,v15) (v
7,v15,v3)
18SAT Solving - Implication Graph
(v9,v5) (v9,v8) (v9,v12) (v5,v7) (v5,v7,v3) (v
4,v1) (v1,v12,v19) (v1,v6) (v6,v19,v8,v15) (v
7,v15,v3)
v9
19SAT Solving - Implication Graph
(v9,v5) (v9,v8) (v9,v12) (v5,v7) (v5,v7,v3) (v
4,v1) (v1,v12,v19) (v1,v6) (v6,v19,v8,v15) (v
7,v15,v3)
v5
v9
20SAT Solving - Implication Graph
(v9,v5) (v9,v8) (v9,v12) (v5,v7) (v5,v7,v3) (v
4,v1) (v1,v12,v19) (v1,v6) (v6,v19,v8,v15) (v
7,v15,v3)
v5
v9
v8
21SAT Solving - Implication Graph
(v9,v5) (v9,v8) (v9,v12) (v5,v7) (v5,v7,v3) (v
4,v1) (v1,v12,v19) (v1,v6) (v6,v19,v8,v15) (v
7,v15,v3)
v5
v9
v8
v12
22SAT Solving - Implication Graph
(v9,v5) (v9,v8) (v9,v12) (v5,v7) (v5,v7,v3) (v
4,v1) (v1,v12,v19) (v1,v6) (v6,v19,v8,v15) (v
7,v15,v3)
v7
v5
v9
v8
v12
23SAT Solving - Implication Graph
(v9,v5) (v9,v8) (v9,v12) (v5,v7) (v5,v7,v3) (v
4,v1) (v1,v12,v19) (v1,v6) (v6,v19,v8,v15) (v
7,v15,v3)
v7
v5
v3
v9
v8
v12
24SAT Solving - Implication Graph
(v9,v5) (v9,v8) (v9,v12) (v5,v7) (v5,v7,v3) (v
4,v1) (v1,v12,v19) (v1,v6) (v6,v19,v8,v15) (v
7,v15,v3)
v7
v5
v3
v9
v8
v12
v4
25SAT Solving - Implication Graph
(v9,v5) (v9,v8) (v9,v12) (v5,v7) (v5,v7,v3) (v
4,v1) (v1,v12,v19) (v1,v6) (v6,v19,v8,v15) (v
7,v15,v3)
v7
v5
v3
v9
v8
v12
v4
v1
26SAT Solving - Implication Graph
(v9,v5) (v9,v8) (v9,v12) (v5,v7) (v5,v7,v3) (v
4,v1) (v1,v12,v19) (v1,v6) (v6,v19,v8,v15) (v
7,v15,v3)
v7
v5
v3
v9
v8
v12
v19
v4
v1
27SAT Solving - Implication Graph
(v9,v5) (v9,v8) (v9,v12) (v5,v7) (v5,v7,v3) (v
4,v1) (v1,v12,v19) (v1,v6) (v6,v19,v8,v15) (v
7,v15,v3)
v7
v5
v3
v9
v8
v12
v19
v4
v1
v6
28SAT Solving - Implication Graph
(v9,v5) (v9,v8) (v9,v12) (v5,v7) (v5,v7,v3) (v
4,v1) (v1,v12,v19) (v1,v6) (v6,v19,v8,v15) (v
7,v15,v3)
v7
v5
v3
v9
v8
v12
v19
v4
v1
v15
v6
29SAT Solving - Implication Graph
(v9,v5) (v9,v8) (v9,v12) (v5,v7) (v5,v7,v3) (v
4,v1) (v1,v12,v19) (v1,v6) (v6,v19,v8,v15) (v
7,v15,v3)
v7
v5
v3
v9
v8
v12
v19
v3
v4
v1
v15
v6
30SAT Solving - Implication Graph
(v9,v5) (v9,v8) (v9,v12) (v5,v7) (v5,v7,v3) (v
4,v1) (v1,v12,v19) (v1,v6) (v6,v19,v8,v15) (v
7,v15,v3)
v7
v5
v3
v9
v8
v12
Conflict
v19
v3
v4
v1
v15
v6
31SAT Solving - Implication Graph
(v9,v5) (v9,v8) (v9,v12) (v5,v7) (v5,v7,v3) (v
4,v1) (v1,v12,v19) (v1,v6) (v6,v19,v8,v15) (v
7,v15,v3)
v7
v5
v3
v9
v8
v12
v4
32Learning Cuts
- CUT A bi-partition of the graph.
- The conflict is on the conflict side.
- The decisions are on the reason side
- No edge from the conflict side to the reason
side. - The edges which cut the cut represent the reason
to the conflict.
33Learning Cuts
v9
Conflict
v4
34Learning Conflict Clauses
Reason Side
Conflict Side
v7
v5
v3
v9
(v5,v7,v3) (v7,v15,v3)
Conflict
(v7,v5,v15)
v4
v15
- v7,v5,v15 are the reason for the conflict.
- Adding the clause will
prevent it in the future.
35Learning Conflict Clauses
v1
0
1
v2
v2
The clause (v2,v3) is created after a conflict
0
0
1
1
v3
v3
v3
v3
0
0
The search tree is pruned accordingly
36Learning Conflict Clauses
- Prevent the reason to the conflict.
- Consists of the negation to the reason literals.
- Prunes the search tree.
- Different cuts yield different conflict clauses.
- We choose cuts such that
- Conflict clause includes one variable from the
top level. - ? It is a unit clause after backtracking one
level. - The new problem is equivalent to the original.
37Learning Implication Graph
(v9,v5) (v9,v8) (v9,v12) (v5,v7) (v5,v7,v3) (v
4,v1) (v1,v12,v19) (v1,v6) (v6,v19,v8,v15) (v
7,v15,v3)
v7
v5
v3
v9
v8
v12
Conflict
v19
v3
v4
v1
v15
v6
38Non Chronological Backtracking
- Backtrack multiple levels instead of one.
- Use conflict clause to determine the level
- Backtrack to the minimum level where the clause
is still asserting. - Emphasis on recent learning.
Conflict Clause (v10,v7,v2,v9)
39Non Chronological Backtracking
v8
v8
1
1
v2
v2
0
0
v4
v9
0
1
v19
1
v6
1
40Branching - VSIDS(Variable State Independent
Decaying Sum)
- Counter for each literal
- Updated when clauses are added
- Branch on the literal with the highest rank
- Divide counters periodically
- Favors recent conflict clauses.
- Recent gained knowledge
41Restarts
- After a fixed interval
- Lengthen interval after each restart
- Nullify all branching and implications
- Keep conflict clauses
- Leads to a new branching order
- New score for the literals
- Hopefully a better order
42Branching for BMC
- Add static ordering
- Forward
- backward
- Branch on latches \ inputs
43Branching for BMC
- Create independent sub-problems
44un-SAT Core
Conflict
45un-SAT Core
v2
Conflict
46un-SAT Core
47un-SAT Core
- Easily obtained from a DPLL SAT solver
- Requires saving the resolution graph
48Branching BerkMin \HaifaSAT
- SAT as abstraction / refinement
- Stack of added conflict clauses
- Order clauses chronologically (BerkMin)
- Order on clauses topologically (HaifaSAT)
- Branch on a literal from the top clause
49The Rise and Fall of Parallel SAT Solving
- VERY appealing!
- Obstacles
- Dependencies
- Communication
- Parallelized BCP()
- Centralized
- Appealing since bcp() is 90 of the runtime
- Useless since bcp() is only 90 of the runtime
50The Rise and Fall of Parallel SAT Solving
- Parallelize for BMC
- Create independent formulae
- Take advantage of symmetry
- Share learned clauses
- Inference is local