Gábor Kusper University of Linz RISC Austria

46
Proving by Assignment Trees that SAT Solvers are Non-Polynomial in Unit Propagation Framework with 1 Selection and Cache 2004 Gábor Kusper University of Linz RISC Austria

description

Proving by Assignment Trees that SAT Solvers are Non-Polynomial in Unit Propagation Framework with 1 Selection and Cache. Gábor Kusper University of Linz RISC Austria. 200 4. Outline. Representations of SAT Unit Propagation and Resolution DPLL and GUS Unit Propagation Framework. - PowerPoint PPT Presentation

Transcript of Gábor Kusper University of Linz RISC Austria

Page 1: Gábor Kusper University of Linz RISC Austria

Proving by Assignment Trees that SAT Solvers are Non-Polynomial

in Unit Propagation Frameworkwith 1 Selection and Cache

2004

Gábor Kusper

University of Linz

RISC

Austria

Page 2: Gábor Kusper University of Linz RISC Austria

OutlineOutline

Representations of SAT

Unit Propagation and Resolution

DPLL and GUS

Unit Propagation Framework

Page 3: Gábor Kusper University of Linz RISC Austria

MotivMotivationation

Theorema, http://www.theorema.org/

A1, ..., An G.

A1, ..., An, G is unsatisfiable.

Page 4: Gábor Kusper University of Linz RISC Austria

Boolean Satisfiability (SAT)Boolean Satisfiability (SAT)

Identify truth assignment that satisfies boolean formula or prove it does not exist.

SAT: Boolean Satisfiability if the boolean formula is in CNF form.

Well-known NP-complete problem.

Page 5: Gábor Kusper University of Linz RISC Austria

ConjunctiveConjunctive Norm Normalal Form Form ( (CCNF)NF)

ClausePozitive Literal

Negative Literal

F( a c ) ( b c ) (¬a ¬b ¬c )

Page 6: Gábor Kusper University of Linz RISC Austria

RepresentationsRepresentations

F( a c ) ( b c ) (¬a ¬b ¬c )

S{ { a,c }, { b,c }, {¬a¬b, ¬c } }

+ x +

M = x + +

- - -

a

True

False b

True

False c

True

False

Page 7: Gábor Kusper University of Linz RISC Austria

ClauseClause ClassificationClassification

x - +

x x x

x - x

+ - +

2-Clause

Empty Clause

Unit Clause

Clear Clause

Page 8: Gábor Kusper University of Linz RISC Austria

ClauseClause Set Classification Set Classification

x - +

x x x

x - x

+ - +

Unsatisfiable Clause Set

Empty Clause Set,Satisfiable

Page 9: Gábor Kusper University of Linz RISC Austria

Simplifying SATSimplifying SAT

Resolution

Unit Propagation

Page 10: Gábor Kusper University of Linz RISC Austria

ResolutionResolution

if A, B are clauses and a is a literal, then res(A, B, a) := A B \ {a, ¬a}.

- + + x

+ + x +

x + + +

res(A, B, a)

A

B

a

Page 11: Gábor Kusper University of Linz RISC Austria

Unit Propagation (UP)

If S is a clause set and a is a literal, then UP(S, { a }) := { C \ { a } | C S a C }.

x - +

- - x

+ x x

+ + +

Unit Clause

x - +

x - xUP by +xx

Page 12: Gábor Kusper University of Linz RISC Austria

SAT SolversSAT Solvers

DPLL

GUS

Page 13: Gábor Kusper University of Linz RISC Austria

BCPBCP

Boolean Constraint Propagation (BCP): Iterated application of unit propagation.

x - +

- - x

+ x x

+ + +

x - +

x - xUP by +xx UP by x-x

Page 14: Gábor Kusper University of Linz RISC Austria

DPLL DPLL ProcedureProcedure

Davis & Putnam & Logemann & Loveland Procedure

Function DPLL(S : Clause Set) : Boolean Begin

– S := BCP(S); – if S = then return True;– if S then return False;– Let a be a variable in S;– return DPLL( S { { a } } ) DPLL( S { { ¬a } } );

End

Page 15: Gábor Kusper University of Linz RISC Austria

ExampleExample - - xx + +- x -

- - xx + +- x -+ x x

- x x

- - xx + +- x -- x x

+ x x

x + x

x + +x + x

Page 16: Gábor Kusper University of Linz RISC Austria

AssignmentAssignment

We say for short – clause disjunctive set of literals.– assignment conjunctive set of literals.

The intended meaning of assignment { a, b } is that we assign true to a and false to b.

If C is a clause, then C is an assignment. If A is an assignment, then A is a clause. If S is a clause set, then S is an assignment set. If T is an assignment set, then T is a clause set.

Page 17: Gábor Kusper University of Linz RISC Austria

Hyper-Unit Propagation (HUP)

If S is a clause set and A is an assignment, then

HUP(S, A) := { C \ A | C S C A = }.

x - +

- - x

+ + +

x x +

x x xHUP by ++x

x - +

- - x

+ + +

x x +

x x xUP by +xxx - +

x - x UP by x+x

Page 18: Gábor Kusper University of Linz RISC Austria

Sub-Model (sm)

If C is a clause and c is a literal in C, then sm(C, c) := C \ { c } { c }. sm(C, c) is an assignment. (a b c) (a b) c.

+ + + x

- - + x

sm(C, c)

C

c

Page 19: Gábor Kusper University of Linz RISC Austria

Expansion Rule

If HUP(S, A) is unsat, then {A} S S.

If C S, c C and HUP(S, sm(C, c)) is unsat, then {sm(C, c)} S S, i.e.,

{C \ {c}} S S, because res(C, sm(C, c)) = C \ {c}.

Page 20: Gábor Kusper University of Linz RISC Austria

GUSGUS

General Unicorn-SAT(GUS)

Function GUS(S : Clause Set) : Boolean Begin

– if S = then return True;– Let C be a minimal clause in S;– For each c C do

• If ( GUS( HUP(S, sm(C, c) ) ) ) then return True;– od– return False;

End

Page 21: Gábor Kusper University of Linz RISC Austria

ExampleExample - - xx + +- x -

x x +x x -

x - x

x x +- x -

+ - x

x x +

- x xx x x

x x +

- x x

Page 22: Gábor Kusper University of Linz RISC Austria

Unit Propagation FrameworkUnit Propagation Framework

Unit Propagation Framework with 1 Selection and Cache

Limitation Lemma

Page 23: Gábor Kusper University of Linz RISC Austria

Strategy Set & FunctionStrategy Set & Function

If C is a clause and T is an assignment set, then T is a strategy set generated by C, if { C } T is unsatisfiable.

If C is a clause and F is a function, that has the type “function F( C : clause) : assignment set”, and F(C) is a strategy set generated by C, then F is a strategy function.

Page 24: Gábor Kusper University of Linz RISC Austria

ExampleExample

+ + + +

+ x x x

- x x x

C

T

+ + + +

- - - +

- - + x

- + x x

+ x x x

C

T

+ x x x

+ x x xC

T

x x x xC

T

Page 25: Gábor Kusper University of Linz RISC Austria

Strategy Function of DPLLStrategy Function of DPLL

Function DPLL_STF( C : Clause ) : Assignment Set Begin

– if ( C is empty ) then return ;– if ( C is unit ) then return { C };– Let c be a literal in C;– return { { c }, { c } };

End

Page 26: Gábor Kusper University of Linz RISC Austria

ExampleExample

+ + + +

+ x x x

- x x x

C

T

+ x x x

+x x xC

T

x x x xC

T

Page 27: Gábor Kusper University of Linz RISC Austria

Strategy Function of GUSStrategy Function of GUS

Function GUS_STF( C : Clause ) : Assignment Set Begin

– T := ;– While (C is not empty) do

• Let c be a literal in C;• T := T { sm(C, c) };• C := C \ { c };

– od– return T;

End

Page 28: Gábor Kusper University of Linz RISC Austria

ExampleExample

+ + + +

- - - +

- - + x

- + x x

+ x x x

C

T

+ x x x

+ x x xC

T

x x x xC

T

Page 29: Gábor Kusper University of Linz RISC Austria

UPFw1SUPFw1S

Function UPFw1S(S : Clause Set, STF : Strategy Function) : Boolean

Begin– if ( S = ) then return True;– if ( S ) then return False;– Let C be a clause in S; // 1 Selection– T := STF ( C ); // T is a strategy set – For each A T do

• if ( UPFw1S( HUP(S, A), STF ) ) then return True;– od– return False;

End

Page 30: Gábor Kusper University of Linz RISC Austria

UPFw1S is a SAT solverUPFw1S is a SAT solver

We know that if T is a strategy set generated by C, then { C } T is unsatisfiable.

Assume T = { A1, A2, ..., Ak } is strategy set generated by C S.

S

CA1A2

AkHUP by Ak

HUP by A1

HUP by A2S2

S1

Sk

Page 31: Gábor Kusper University of Linz RISC Austria

Simulated DPLL & GUSSimulated DPLL & GUS

Function Simulated_DPLL( S : Clause Set) : Assignment Begin

– return UPFw1S(S, DPLL_STF);

End

Function Simulated_GUS( S : Clause Set) : Assignment Begin

– return UPFw1S(S, GUS_STF);

End

Page 32: Gábor Kusper University of Linz RISC Austria

k-Clause Setk-Clause Set

[2^k] := the set of all possible k-clauses on the same variables.

For all k : [2^k] is unsatisfiable. Assume we have 3 variables.

+ + x

[4]= + - x

- + x

- - x

x + +

[4]= x + -

x - +

x - -

+ x +

[4]= + x -

- x +

- x -

or or

[1]= x x x

Page 33: Gábor Kusper University of Linz RISC Austria

HUP on k-Clause SetHUP on k-Clause Set

HUP([2^k], A) = [2^(k-m)], where m = |A|.

[8] [2]HUP by ++x

+ + +

+ + -

+ - +

[8]= + - -

- + +

- + -

- - +

- - -

HUP by ++x x x + =[2]

x x -

Page 34: Gábor Kusper University of Linz RISC Austria

DPLL and GUS on [2]DPLL and GUS on [2]

[2]

+-

[1]DPLL:

GUS:

UP steps: 1

HUP by +

[2]

+-

[1]UP steps: 1

HUP by +

Page 35: Gábor Kusper University of Linz RISC Austria

DPLL and GUS on [4]DPLL and GUS on [4]

[4]

+++--x

HUP by -+

HUP by +x[1]

[2]

[4]

++-x+x

HUP by +x

HUP by -x[2]

[2]

DPLL:

GUS:

UP steps: 4

UP steps: 4

1

1

1

Page 36: Gábor Kusper University of Linz RISC Austria

DPLL and GUS on [8]DPLL and GUS on [8]

[8]

+++++-+-x

HUP by --+

HUP by -+x

[8]

+++-xx+xx

HUP by +xx

HUP by -xx[4]

DPLL:

GUS:

UPs: 10

4

[4] 4

-xx

[1]

UPs: 11[2] 1

[4] 4

HUP by +xx

-1

Page 37: Gábor Kusper University of Linz RISC Austria

Limit for Strategy SetsLimit for Strategy Sets

If T is strategy set generated by C and C is a k-clause, then T subsumes at least 2^k – 1 k-clauses on the variables of C.

This holds, because { C } T is unsatisfiable.

+ + +

- - +

- + x

+ x x

C

T

- - + - - +

T = - + x = - + +

- x x - + -

+ + +

+ + -

+ - +

+ - -

Page 38: Gábor Kusper University of Linz RISC Austria

Limit for ChildrenLimit for Children

If we break down [2^k] by a strategy set to [2^k1], [2^k2], ..., [2^km] then

2^k1 + 2^k2 + ... + 2^km 2^k – 1.

This holds, because of Limit for Strategy Sets.

[8]

+++++-+-x

HUP by --+

HUP by -+x

-xx

[1]

[2]

[4]

HUP by +xx

Page 39: Gábor Kusper University of Linz RISC Austria

Assignment Tree (A-tree)Assignment Tree (A-tree)

A, Cs is an A-tree if A is an assignment and Cs is a set of A-trees.

We can represent a run of UPFw1S by an A-tree.

[8]

+++++-+-x

HUP by --+

HUP by -+x

-xx

[1]

[2]

[4]

HUP by +xx

xxx

--+ -+x +xx

xx+ x-+ x+x

xx+

Page 40: Gábor Kusper University of Linz RISC Austria

Unit Assignment TreeUnit Assignment Tree

(a)  , Cs is a unit A-tree if Cs is a set of unit A-trees.

(b)  A, Cs is a unit A-tree if A is a unit and

Cs is a set of unit A-trees.

xxx

--+ -+x +xx

xx+ x-+ x+x

xx+

xxx

-xx -xx +xx

x+x x-x x+x

xx+xx+ xx+

x-x

xx+

convert to

unit A-tree

Page 41: Gábor Kusper University of Linz RISC Austria

Cached Unit Assignment TreeCached Unit Assignment Tree

xxx

-xx -xx +xx

x+x x-x x+x

xx+xx+ xx+

x-x

xx+

convert tocached unit A-tree

xxx

-xx +xx

x+x x-x x+x

xx+xx+ xx+

x-x

xx+

Page 42: Gábor Kusper University of Linz RISC Austria

Auxiliary LemmasAuxiliary Lemmas

The number of edges of a cached unit A-tree equals to the number of used UP steps in the run of UPFw1SC, if this cached unit A-tree corresponds to this run of the framework.

A well-know graph theory states that if a tree has N nodes, then it has N-1 edges.

Page 43: Gábor Kusper University of Linz RISC Austria

Number of Nodes of a CUA-TreeNumber of Nodes of a CUA-Tree

Let AT be a A-tree, which represent a run of UPFw1SC on [2^n], n > 0.

We convert AT to a cached unit A-tree. Let CUAT this cached unit A-tree.

Then CUAT has 2^n + 2^(n-1) – 1 nodes. Proof by Induction:

– For k = 1 is true, because [2] has 2 nodes.– Let us assume that it holds for k = n-1.– We show that it holds for k = n. We assume that n > 1.

• The child nodes of root correspond to a run of UPFw1SC on [2^(n-1)].

• Since n > 1, the root has at least two child nodes.• Hence, it has at least 2 * (2^(n-1)+2^(n-2) – 1) + 1 nodes.

Page 44: Gábor Kusper University of Linz RISC Austria

Limitation LemmaLimitation Lemma

There is no SAT solver algorithm in the Unit Propagation Framework with 1 Selection and Cache, which can show that [2^n] is unsatisfiable using fewer UP steps than 2^n + 2^(n-1) - 2.

It holds, because each cache unit A-tree, which correspond to a run of this framework on [2^n] has at least 2^n + 2^(n-1) – 1 nodes.

Page 45: Gábor Kusper University of Linz RISC Austria

HenceHence

Therefore, each SAT solver in this framework uses at least 2^n + 2^(n-1) – 2 UP steps to show that [2^n] is unsatisfiable.

Hence, SAT solvers are non-polynomial in Unit Propagation Framework with 1 Selection and Cache.

Page 46: Gábor Kusper University of Linz RISC Austria

Thank you for your attention!Thank you for your attention!

Download:http://www.risc.uni-linz.ac.at/people/gkusper/UPF.ppt