Automated Theorem Proving Lecture 2 Propositional Satisfiability Decision procedures • Boolean programs – Propositional satisfiability • Arithmetic programs – Propositional satisfiability modulo theory of linear arithmetic • Memory.

Download Report

Transcript Automated Theorem Proving Lecture 2 Propositional Satisfiability Decision procedures • Boolean programs – Propositional satisfiability • Arithmetic programs – Propositional satisfiability modulo theory of linear arithmetic • Memory.

Automated Theorem Proving

Lecture 2 Propositional Satisfiability

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

Case I: Boolean programs

• Boolean-valued variables and boolean operations   b  Formula := b |  SymBoolConst |   

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, …

Conjunctive Normal Form

 c  l  b  CNF Formula ::= c Clause ::= l 1  l 2 Literal ::= b |  b  1  … l n c 2  SymBoolConst … c m Unit clause ( l ) -a clause containing a single literal Empty clause ( ) - a clause containing no literal - equivalent to false

Conversion into CNF

• In general, converting equivalent CNF formula may result in an exponential blow-up • We are only interested in satisfiability of  • Convert into an  into an equi-satisfiable CNF formula EQCNF(  ) –  is satisfiable iff EQCNF(  ) is satisfiable – size of EQCNF(  ) is polynomial in size of 

Conversion into CNF

• Convert formula  NF(  ) into normal form – NF(  ) is polynomial in  • Convert  = NF(  ) into equisatisfiable CNF formula EQCNF(  ) – EQCNF(  ) is polynomial in 

Normal Form

Normal form: NF(  )   Negated normal form: NNF(  )   NF(b) = b NNF(b) =  b NF(  ) = NNF(  ) NNF(  ) = NF(  ) NF(  1   NNF(  1 2 ) = NF(  1 )  NF(  1 )   2 ) = NNF(  1 )  NNF(  2 )

Equi-satisfiable CNF

Let  be a formula in normal form.

For each subformula  of  : - create a fresh symbol v  Identify v b with b and v  b in SymBoolConst with  b Cl(b) = Cl(  b) = true Cl(  ) = Cl(  )  (v   v  Cl(  )   v  )  (v   v  )  (v   v  ) Cl(  ) = Cl(  )  (v   Cl(  )  v   v  )  (v   v  )  (v   v  ) EQCNF(  ) = v   Cl(  )

Resolution

c 1 , c 2 independent of b clauses (c 1  b) (c 2   b) (c 1  c 2 ) resolvent resolvent(b, c 1  b, c 2   b) = c 1  c 2 =  b. (c 1  b)  (c 2   b)

Theorem

  (c   1  (c 1 b)   b)  iff (c 2 (c 2     b)  b) (c 1  c 2 ) Adding the resolvent to the set of clauses does not affect the satisfiability of the clause set.

Unit resolution

One of the clauses being resolved is a unit clause ( b ) (c 2   b) (  b ) (c 2  b) ( c 2 ) ( c 2 ) Derivation of the empty clause (denoted by  ) ( b ) (  b ) 

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

Davis-Putnam algorithm (II)

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

Satisfiable example

(a  b  c) (b   c   f) (  b  c) Rule 3a (b   c   f) (  b  c) Resolve on b (c   c   f) Rule 2 Clause set is empty

Unsatisfiable example

Pick b (a  b) (a   b) (  a  c) (  a   c) ( a ) (  a  c) (  a   c) Pick a ( c ) (  c ) Pick c 

Correctness

Saturate C w.r.t Rules 1, 2, 3a, and 3b while (C is nonempty) { Pick a variable b appearing in some clause in C C’ = { resolvent(b,c if (   C = C’ 1 ,c 2 ) | c 1 ,c 2 C’) return unsatisfiable  C } Saturate C’ w.r.t. Rules 1, 2, 3a, and 3b } return satisfiable Two observations: - Each of the rules 1, 2, 3a, and 3b preserve satisfiability - C’ =  b. C

Memory explosion

Saturate C w.r.t Rules 1, 2, 3a, and 3b while (C is nonempty) { Pick a variable b appearing in some clause in C C’ = { resolvent(b,c if (   C = C’ 1 ,c 2 ) | c 1 ,c 2 C’) return unsatisfiable  C } Saturate C’ w.r.t. Rules 1, 2, 3a, and 3b } 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))

Davis-Logemann-Loveland algorithm Slides 42-72 of sat_course1.pdf

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

Davis-Logemann-Loveland algorithm • Eliminates exponential memory requirement • Might still need exponential time

Conflict-driven learning and non chronological backtracking Slides 2-20 of sat_course2.pdf

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