sat solvers
DESCRIPTION
SAT Solvers. The 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: - PowerPoint PPT PresentationTRANSCRIPT
SAT Solvers
The 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: A satisfies ↔ A satisfies all its clauses.
( )v( ( ))A v true v
( )v
( )v1 2( ) ... mv cl cl cl
1( ... )i lcl lit lit
v
( )v
( )v
Boolean 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. a and c are the antecedent variables of
BCP(): Calculates all the possible implications. Returns conflict / no-conflict.
( )cl a b c a = 0 b = ? c = 1
b = 0
bb
DPLL: Davis Putnam Logemann Loveland Backtrack Search Choose a decision
variable and value.x6
DPLL: Davis Putnam Logemann Loveland Backtrack Search Choose a decision
variable and value. Run bcp()
x6 ¬x14 x3
DPLL: Davis Putnam Logemann Loveland Backtrack Search Choose a decision
variable and value. Run bcp()
x6 ¬x14 x3
¬x1 x18 x4 ¬x2
x8 ¬x10 x7
DPLL: 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.
x6 ¬x14 x3
¬x1 x18 x4 ¬x2
x8 ¬x10 x7
¬x9 x5 ¬x3
DPLL: 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.
x6 ¬x14 x3
¬x1 x18 x4 ¬x2
x8 ¬x10 x7
x9**
DPLL: 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().
x6 ¬x14 x3
¬x1 x18 x4 ¬x2
x8 ¬x10 x7
x9** x15 x14
DPLL: 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().
x6 ¬x14 x3
¬x1 x18 x4 ¬x2
¬x8**
x9** x15 x14
DPLL: 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().
x6 ¬x14 x3
¬x1 x18 x4 ¬x2
¬x8** x11
DPLL: Davis Putnam Logemann Loveland Backtrack Search
Termination No unassigned variables – SAT
DPLL: Davis Putnam Logemann Loveland Backtrack Search
Termination No unassigned variables – SAT No decision variable to flip – un-SAT
The SAT Problem - Resolution Given a Boolean formula in CNF, for
clauses and .
For ( ) ( )v v c
( )v c
1 ( )cl A v 2 ( )cl B v
1 2( , ) ( )resolution c c A B
1 2( , )c resolution c c
( )v
Learning: Implication Graph(x9,¬x5)
(x9,¬x8)
(x9,x12)
(x5,x7)
(x5,¬x7,x3)
(¬x4,¬x1)
(x1,¬x12,x19)
(x1,¬x6)
(x6,¬x19,x8, ¬x7,¬x3)
¬x5
¬x9
x4 ¬x1
x12
x7
¬x8
x19
¬x6
x3
¬x3
Learning: Implication Graph(x9,¬x5)
(x9,¬x8)
(x9,x12)
(x5,x7)
(x5,¬x7,x3)
(¬x4,¬x1)
(x1,¬x12,x19)
(x1,¬x6)
(x6,¬x19,x8,¬x7,¬x3)
¬x5
¬x9
x4 ¬x1
x12
x7
¬x8
x19
¬x6
x3
¬x3
Learning: Implication Graph(x9,¬x5)
(x9,¬x8)
(x9,x12)
(x5,x7)
(x5,¬x7,x3)
(¬x4,¬x1)
(x1,¬x12,x19)
(x1,¬x6)
(x6,¬x19,x8,¬x7,¬x3)
¬x5
¬x9
x4 ¬x1
x12
x7
¬x8
x19
¬x6
x3
¬x3
Learning: Implication Graph(x9,¬x5)
(x9,¬x8)
(x9,x12)
(x5,x7)
(x5,¬x7,x3)
(¬x4,¬x1)
(x1,¬x12,x19)
(x1,¬x6)
(x6,¬x19,x8,¬x7,¬x3)
¬x5
¬x9
x4 ¬x1
x12
x7
¬x8
x19
¬x6
x3
¬x3
Learning: Implication Graph(x9,¬x5)
(x9,¬x8)
(x9,x12)
(x5,x7)
(x5,¬x7,x3)
(¬x4,¬x1)
(x1,¬x12,x19)
(x1,¬x6)
(x6,¬x19,x8,¬x7,¬x3)
¬x5
¬x9
x4 ¬x1
x12
x7
¬x8
x19
¬x6
x3
¬x3
Learning: Implication Graph(x9,¬x5)
(x9,¬x8)
(x9,x12)
(x5,x7)
(x5,¬x7,x3)
(¬x4,¬x1)
(x1,¬x12,x19)
(x1,¬x6)
(x6,¬x19,x8,¬x7,¬x3)
¬x5
¬x9
x4 ¬x1
x12
x7
¬x8
x19
¬x6
x3
¬x3
Learning: Implication Graph(x9,¬x5)
(x9,¬x8)
(x9,x12)
(x5,x7)
(x5,¬x7,x3)
(¬x4,¬x1)
(x1,¬x12,x19)
(x1,¬x6)
(x6,¬x19,x8,¬x7,¬x3)
¬x5
¬x9
x4 ¬x1
x12
x7
¬x8
x19
¬x6
x3
¬x3
Learning: Implication Graph
¬x5
¬x9
x4 ¬x1
x12
x7
¬x8
x19
¬x6
x3
¬x3
(x9,¬x5)
(x9,¬x8)
(x9,x12)
(x5,x7)
(x5,¬x7,x3)
(¬x4,¬x1)
(x1,¬x12,x19)
(x1,¬x6)
(x6,¬x19,x8,¬x7,¬x3)
Learning: Implication Graph(x9,¬x5)
(x9,¬x8)
(x9,x12)
(x5,x7)
(x5,¬x7,x3)
(¬x4,¬x1)
(x1,¬x12,x19)
(x1,¬x6)
(x6,¬x19,x8,¬x7,¬x3)
¬x5
¬x9
x4 ¬x1
x12
x7
¬x8
x19
¬x6
x3
¬x3
Learning: Implication Graph(x9,¬x5)
(x9,¬x8)
(x9,x12)
(x5,x7)
(x5,¬x7,x3)
(¬x4,¬x1)
(x1,¬x12,x19)
(x1,¬x6)
(x6,¬x19,x8,¬x7,¬x3)
¬x5
¬x9
x4 ¬x1
x12
x7
¬x8
x19
¬x6
x3
¬x3
Learning: Implication Graph(x9,¬x5)
(x9,¬x8)
(x9,x12)
(x5,x7)
(x5,¬x7,x3)
(¬x4,¬x1)
(x1,¬x12,x19)
(x1,¬x6)
(x6,¬x19,x8,¬x7,¬x3)
¬x5
¬x9
x4 ¬x1
x12
x7
¬x8
x19
¬x6
x3
¬x3
Learning: Implication Graph(x9,¬x5)
(x9,¬x8)
(x9,x12)
(x5,x7)
(x5,¬x7,x3)
(¬x4,¬x1)
(x1,¬x12,x19)
(x1,¬x6)
(x6,¬x19,x8,¬x7,¬x3)
¬x5
¬x9
x4 ¬x1
x12
x7
¬x8
x19
¬x6
x3
¬x3
Learning: Implication Graph(x9,¬x5)
(x9,¬x8)
(x9,x12)
(x5,x7)
(x5,¬x7,x3)
(¬x4,¬x1)
(x1,¬x12,x19)
(x1,¬x6)
(x6,¬x19,x8,¬x7,¬x3)
¬x5
¬x9
x4 ¬x1
x12
x7
¬x8
x19
¬x6
x3
¬x3
Conflict
Learning: Cuts
¬x5
¬x9
x4 ¬x1
x12
x7
¬x8
x19
¬x6
x3
¬x3
Conflict
Learning: Conflict Clauses
¬x5
¬x9
x4 ¬x1
x12
x7
¬x8
x19
¬x6
x3
¬x3
Conflict
Conflict Side
Reason Side
x7,¬x5,x15 are the reason for the conflict. Adding the clause will
prevent it in the future.7 5 8 19 6(¬x x x ¬x x )
(x5,¬x7,x3)
(x6,¬x19,x8,¬x7,¬x3)
Learning: Conflict ClausesX1
X2 X2
X3 X3 X3X3
0
00
00
1
1 1
The clause (x2,x3) is
created after a conflict
The search tree is pruned accordingly
Learning: Implication Graph(x9,¬x5)
(x9,¬x8)
(x9,x12)
(x5,x7)
(x5,¬x7,x3)
(¬x4,¬x1)
(x1,¬x12,x19)
(x1,¬x6)
(x6,¬x19,x8,¬x7,¬x3)
¬x5
¬x9
x4 ¬x1
x12
x7
¬x8
x19
¬x6
x3
¬x3
Conflict
1 UIP2 UIP
Non –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.
x8 ¬x10 x3 x7 x14
¬x2 x5 x1
¬x4 x21 ¬x12 ¬x15
x19 x18 x32
¬x6 x16 ¬x9 ¬x14
x8 ¬x10 x3 x7
¬x2 x5 x1 x9
Conflict Clause
(x10,¬x7,x2,x9)
Learning: 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.