SAT Solvers

33
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 Presentation

Transcript of SAT Solvers

Page 1: SAT Solvers

SAT Solvers

Page 2: 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

Page 3: SAT Solvers

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

Page 4: SAT Solvers

DPLL: Davis Putnam Logemann Loveland Backtrack Search Choose a decision

variable and value.x6

Page 5: SAT Solvers

DPLL: Davis Putnam Logemann Loveland Backtrack Search Choose a decision

variable and value. Run bcp()

x6 ¬x14 x3

Page 6: SAT Solvers

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

Page 7: SAT Solvers

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

Page 8: SAT Solvers

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**

Page 9: SAT Solvers

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

Page 10: SAT Solvers

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

Page 11: SAT Solvers

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

Page 12: SAT Solvers

DPLL: Davis Putnam Logemann Loveland Backtrack Search

Termination No unassigned variables – SAT

Page 13: SAT Solvers

DPLL: Davis Putnam Logemann Loveland Backtrack Search

Termination No unassigned variables – SAT No decision variable to flip – un-SAT

Page 14: SAT Solvers

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

Page 15: SAT Solvers

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

Page 16: SAT Solvers

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

Page 17: SAT Solvers

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

Page 18: SAT Solvers

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

Page 19: SAT Solvers

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

Page 20: SAT Solvers

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

Page 21: SAT Solvers

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

Page 22: SAT Solvers

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)

Page 23: SAT Solvers

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

Page 24: SAT Solvers

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

Page 25: SAT Solvers

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

Page 26: SAT Solvers

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

Page 27: SAT Solvers

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

Page 28: SAT Solvers

Learning: Cuts

¬x5

¬x9

x4 ¬x1

x12

x7

¬x8

x19

¬x6

x3

¬x3

Conflict

Page 29: SAT Solvers

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)

Page 30: SAT Solvers

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

Page 31: SAT Solvers

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

Page 32: SAT Solvers

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)

Page 33: SAT Solvers

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.