Recursion and Induction: Boolean Satisfiability; Davis-Putnam Procedure Greg Plaxton Theory in Programming Practice, Fall 2005 Department of Computer Science University of Texas at Austin
Program Design: Boolean Satisfiability • In this lecture and the next one, we consider the design and implementation of a Haskell program for solving the “boolean satisfiability” problem • Input: A propositional formula – Example: ( p ∨ q ) ∧ ( ¬ p ∨ ¬ q ) ∧ ( p ∨ ¬ q ) • Such a formula is satisfiable if there exists an assignment of (boolean) values to the variables in the formula such that the formula evaluates to true – Example: The above formula is satisfied by setting p to true and q to false • Goal: Determine whether the given formula is satisfiable – The satisfiability solver that we develop produces a satisfying assignment when the given formula is satisfiable Theory in Programming Practice, Plaxton, Fall 2005
Conjunctive Normal Form (CNF) • A propositional formula is said to be in CNF if it is the conjunction (AND) of a number of clauses , where each clause is the disjunction (OR) of a number of literals , and each literal is either a variable or its negation – Example: ( p ∨ q ) ∧ ( ¬ p ∨ ¬ q ) ∧ ( p ∨ ¬ q ) • Theorem: Any boolean formula of length n can be converted to a logically equivalent CNF formula of length that is polynomial (in fact, linear) in n • Henceforth, we assume that the input formula is in CNF Theory in Programming Practice, Plaxton, Fall 2005
Complexity of the Boolean Satisfiability Problem • The boolean satisfiability problem is NP-complete – Thousands of such NP-complete problems have been identified in the literature – A polynomial-time algorithm for one NP-complete problem implies polynomial-time algorithms for all of them – It is widely believed that NP-complete problems require superpolynomial (e.g., exponential) time to solve • In practice, heuristic satisfiability solvers such as Chaff are able to solve fairly large problem instances – Such solvers are applied in a wide variety of application domains Theory in Programming Practice, Plaxton, Fall 2005
The Davis-Putnam Procedure • Let f denote the input formula, and let p denote a variable in f • Let f p denote f with all occurrences of the literal ¬ p removed, and with all clauses containing the literal p removed – There is a satisfying assignment for f with p set to true if and only if f p is satisfiable • Let f ¬ p be defined similarly – There is a satisfying assignment for f with p set to false if and only if f ¬ p is satisfiable • The formula f is satisfiable if and only if f p or f ¬ p is satisfiable • This suggests a recursive procedure – Heuristics may be used to select p and to prioritize the set of remaining recursive subproblems Theory in Programming Practice, Plaxton, Fall 2005
Recommend
More recommend