Automated Theorem Proving

21
Automated Theorem Proving Lecture 2 Propositional Satisfiability

description

Automated Theorem Proving. Lecture 2 Propositional Satisfiability. Decision procedures. Boolean programs Propositional satisfiability Arithmetic programs Propositional satisfiability modulo theory of linear arithmetic Memory programs - PowerPoint PPT Presentation

Transcript of Automated Theorem Proving

Page 1: Automated Theorem Proving

Automated Theorem Proving

Lecture 2Propositional Satisfiability

Page 2: Automated Theorem Proving

Decision procedures

• Boolean programs– Propositional satisfiability

• Arithmetic programs– Propositional satisfiability modulo theory

of linear arithmetic

• Memory programs– Propositional satisfiability modulo theory

of linear arithmetic + arrays

Page 3: Automated Theorem Proving

Case I: Boolean programs

• Boolean-valued variables and boolean operations

Formula := b | | b SymBoolConst

Page 4: Automated Theorem Proving

SAT• First NP-complete problem (Cook 1972)• Davis-Putnam algorithm (1960)

– resolution-based– may use exponential memory

• Davis-Logemann-Loveland algorithm (1962)– search-based– basis for all successful modern solvers

• Conflict-driven learning and non-chronological backtracking (1996)– resolution strikes back!

• Amazing progress– GRASP, SATO, Chaff, ZChaff, BerkMin, …

Page 5: Automated Theorem Proving

Conjunctive Normal Form

CNF Formula ::= c1 c2 … cm

c Clause ::= l1 l2 … lnl Literal ::= b | bb SymBoolConst

Unit clause ( l )-a clause containing a single literal

Empty clause ( )- a clause containing no literal - equivalent to false

Page 6: Automated Theorem Proving

Conversion into CNF

• In general, converting into an equivalent CNF formula may result in an exponential blow-up

• We are only interested in satisfiability of

• Convert into an equi-satisfiable CNF formula EQCNF() is satisfiable iff EQCNF() is satisfiable– size of EQCNF() is polynomial in size of

Page 7: Automated Theorem Proving

Conversion into CNF

• Convert formula into normal form NF()– NF() is polynomial in

• Convert = NF() into equisatisfiable CNF formula EQCNF()– EQCNF() is polynomial in

Page 8: Automated Theorem Proving

Normal form: NF() Negated normal form: NNF()

Normal Form

NF(b) = bNNF(b) = b

NF() = NNF()NNF() = NF()

NF(1 2) = NF(1) NF(1)NNF(1 2) = NNF(1) NNF(2)

Page 9: Automated Theorem Proving

Equi-satisfiable CNF

Cl(b) = Cl(b) = true

Cl() = Cl() Cl() (v v v) (v v) (v v)

Cl() = Cl() Cl() (v v v) (v v) (v v)

Let be a formula in normal form.For each subformula of : - create a fresh symbol v in SymBoolConstIdentify vb with b and vb with b

EQCNF() = v Cl()

Page 10: Automated Theorem Proving

Resolution

(c1 b) (c2 b)

(c1 c2)

clauses

resolvent

resolvent(b, c1 b, c2 b) = c1 c2 = b. (c1 b) (c2 b)

c1, c2 independent of b

Page 11: Automated Theorem Proving

(c1 b) (c2 b)iff

(c1 b) (c2 b) (c1 c2)

Theorem

Adding the resolvent to the set of clauses does not affect the satisfiability of the clause set.

Page 12: Automated Theorem Proving

Unit resolution

( b ) (c2 b)

( c2 )

One of the clauses being resolved is a unit clause

Derivation of the empty clause (denoted by )

( b ) ( b )

( b ) (c2 b)

( c2 )

Page 13: Automated Theorem Proving

Davis-Putnam algorithm (I)Given clause set C:

Rule 1: If a clause (c l l) C, replace it with (c l)

Rule 2: If a clause (c b b) C, remove it from C

Rule 3a: If b does not occur in any clause in C, remove every clause containing b from C

Rule 3b: If b does not occur in any clause in C, remove every clause containing b from C

Page 14: Automated Theorem Proving

Davis-Putnam algorithm (II)

Saturate C w.r.t Rules 1, 2, 3a, and 3bwhile (C is nonempty) { Pick a variable b appearing in some clause in C C’ = { resolvent(b,c1,c2) | c1,c2 C } Saturate C’ w.r.t. Rules 1, 2, 3a, and 3b if ( C’) return unsatisfiable C = C’}return satisfiable

Page 15: Automated Theorem Proving

(a b c) (b c f) (b c)

Satisfiable example

(b c f) (b c)

Rule 3a

(c c f)

Resolve on b

Rule 2

Clause set is empty

Page 16: Automated Theorem Proving

(a b) (a b) (a c) (a c)

( a ) (a c) (a c)

( c ) ( c )

Unsatisfiable example

Pick b

Pick a

Pick c

Page 17: Automated Theorem Proving

Correctness

Saturate C w.r.t Rules 1, 2, 3a, and 3bwhile (C is nonempty) { Pick a variable b appearing in some clause in C C’ = { resolvent(b,c1,c2) | c1,c2 C } Saturate C’ w.r.t. Rules 1, 2, 3a, and 3b if ( C’) return unsatisfiable C = C’}return satisfiable

Two observations:- Each of the rules 1, 2, 3a, and 3b preserve satisfiability- C’ = b. C

Page 18: Automated Theorem Proving

Memory explosion

Saturate C w.r.t Rules 1, 2, 3a, and 3bwhile (C is nonempty) { Pick a variable b appearing in some clause in C C’ = { resolvent(b,c1,c2) | c1,c2 C } Saturate C’ w.r.t. Rules 1, 2, 3a, and 3b if ( C’) return unsatisfiable C = C’}return satisfiable

Let n be the number of clauses in the input clause set Number of clauses after i-th iteration of loop: O(n^(2^i))

Page 19: Automated Theorem Proving

Davis-Logemann-Loveland algorithm

Slides 42-72 of sat_course1.pdfDownload from:http://research.microsoft.com/users/lintaoz/SATSolving/satsolving.htm

Page 20: Automated Theorem Proving

Davis-Logemann-Loveland algorithm

• Eliminates exponential memory requirement

• Might still need exponential time

Page 21: Automated Theorem Proving

Conflict-driven learning and non-chronological backtracking

Slides 2-20 of sat_course2.pdfDownload from:

http://research.microsoft.com/users/lintaoz/SATSolving/satsolving.htm