
Overview CS389L: Automated Logical Reasoning I An algorithm called DPLL for determining satisfiability Lecture 2: Normal Forms and DPLL I Many SAT solvers used today based on DPLL I¸sıl Dillig I However, requires converting formulas to a respresentation called normal forms I¸sıl Dillig, CS389L: Automated Logical Reasoning Lecture 2: Normal Forms and DPLL 1/39 I¸sıl Dillig, CS389L: Automated Logical Reasoning Lecture 2: Normal Forms and DPLL 2/39 Normal Forms Negation Normal Form (NNF) Negation Normal Form requires two syntactic restrictions: I A normal form of a formula F is another formula F 0 such that F is equivalent to F 0, but F 0 obeys certain syntactic I The only logical connectives are , , (i.e., no , ) restrictions. ¬ ∧ ∨ → ↔ I Negations appear only in literals I There are three kinds of normal forms that are interesting in propositional logic: I i.e., negations not allowed inside , , or any other ∧ ∨ ¬ I Negation Normal Form (NNF) I Is formula p ( q (r s)) in NNF? ∨ ¬ ∧ ∨ ¬ I Disjunctive Normal Form (DNF) I What about p ( q ( r s))? ∨ ¬ ∧ ¬ ¬ ∧ I Conjunctive Normal Form (CNF) I What about p ( q ( r s))? ∨ ¬ ∧ ¬¬ ∨ ¬ I¸sıl Dillig, CS389L: Automated Logical Reasoning Lecture 2: Normal Forms and DPLL 3/39 I¸sıl Dillig, CS389L: Automated Logical Reasoning Lecture 2: Normal Forms and DPLL 4/39 Conversion to NNF I Conversion to NNF II I Also need to ensure negations appear only in literals: push negations in I To make sure the only logical connectives are , , , need to ¬ ∧ ∨ I Use DeMorgan’s laws to distribute over and : eliminate and ¬ ∧ ∨ → ↔ (F F ) F F ¬ 1 ∧ 2 ⇔ ¬ 1 ∨ ¬ 2 I How do we express F F using , , ? 1 → 2 ∨ ∧ ¬ (F F ) F F ¬ 1 ∨ 2 ⇔ ¬ 1 ∧ ¬ 2 I How do we express F F using only , . ? 1 ↔ 2 ¬ ∧ ∨ I We also disallow double negations: F F ¬¬ ⇔ I¸sıl Dillig, CS389L: Automated Logical Reasoning Lecture 2: Normal Forms and DPLL 5/39 I¸sıl Dillig, CS389L: Automated Logical Reasoning Lecture 2: Normal Forms and DPLL 6/39 1 NNF Example Disjunctive Normal Form (DNF) I A formula in disjunctive normal form is a disjunction of conjunction of literals. Convert F : (p (p q)) to NNF ¬ → ∧ `i,j for literals `i,j i j _ ^ I i.e., can never appear inside or ∨ ∧ ¬ I Called disjunctive normal form because disjuncts are at the outer level I Each inner conjunction is called a clause I Question: If a formula is in DNF, is it also in NNF? I¸sıl Dillig, CS389L: Automated Logical Reasoning Lecture 2: Normal Forms and DPLL 7/39 I¸sıl Dillig, CS389L: Automated Logical Reasoning Lecture 2: Normal Forms and DPLL 8/39 Conversion to DNF Example Convert F :(q q ) ( r r ) into DNF 1 ∨ ¬¬ 2 ∧ ¬ 1 → 2 I To convert formula to DNF, first convert it to NNF. I Then, distribute over : ∧ ∨ (F F ) F (F F ) (F F ) 1 ∨ 2 ∧ 3 ⇔ 1 ∧ 3 ∨ 2 ∧ 3 F (F F ) (F F ) (F F ) 1 ∧ 2 ∨ 3 ⇔ 1 ∧ 2 ∨ 1 ∧ 3 I¸sıl Dillig, CS389L: Automated Logical Reasoning Lecture 2: Normal Forms and DPLL 9/39 I¸sıl Dillig, CS389L: Automated Logical Reasoning Lecture 2: Normal Forms and DPLL 10/39 DNF and Satisfiability DNF and Blow-up in formula size I This idea is completely impractical. Why? I Claim: If formula is in DNF, trivial to determine satisfiability. I Consider formula: (F1 F2) (F3 F4) How? ∨ ∧ ∨ I In DNF: I (F F ) (F F ) (F F ) (F F ) 1 ∧ 3 ∨ 1 ∧ 4 ∨ 2 ∧ 3 ∨ 2 ∧ 4 I I Every time we distribute, formula size doubles! I Idea: To determine satisfiability, convert formula to DNF and just do a syntactic check. I Moral: DNF conversion causes exponential blow-up in size! I Checking satisfiability by converting to DNF is almost as bad as truth tables! I¸sıl Dillig, CS389L: Automated Logical Reasoning Lecture 2: Normal Forms and DPLL 11/39 I¸sıl Dillig, CS389L: Automated Logical Reasoning Lecture 2: Normal Forms and DPLL 12/39 2 Conjunctive Normal Form (CNF) Conversion to CNF I A formula in conjuctive normal form is a conjunction of disjunction of literals. `i,j for literals `i,j I To convert formula to CNF, first convert it to NNF. i j ^ _ I Then, distribute over : ∨ ∧ I i.e., not allowed inside , . (F1 F2) F3 (F1 F3) (F2 F3) ∧ ∨ ¬ ∧ ∨ ⇔ ∨ ∧ ∨ F (F F ) (F F ) (F F ) 1 ∨ 2 ∧ 3 ⇔ 1 ∨ 2 ∧ 1 ∨ 3 I Called conjunctive normal form because conjucts are at the outer level I Each inner disjunction is called a clause I Is formula in CNF also in NNF? I¸sıl Dillig, CS389L: Automated Logical Reasoning Lecture 2: Normal Forms and DPLL 13/39 I¸sıl Dillig, CS389L: Automated Logical Reasoning Lecture 2: Normal Forms and DPLL 14/39 CNF Conversion Example DNF vs. CNF Convert F :(p (q r)) into CNF ↔ → I Fact: Unlike DNF, it is not trivial to determine satisfiability of formula in CNF. I Does CNF conversion cause exponential blow-up in size? I News: But almost all SAT solvers first convert formula to CNF before solving! I¸sıl Dillig, CS389L: Automated Logical Reasoning Lecture 2: Normal Forms and DPLL 15/39 I¸sıl Dillig, CS389L: Automated Logical Reasoning Lecture 2: Normal Forms and DPLL 16/39 Why CNF? Equisatisfiability I Two formulas F and F 0 are equisatisfiable iff: I Interesting Question: If it is just as expensive to convert formula to CNF as to DNF, why do solvers convert to CNF F is satisfiable if and only if F 0 is satisfiable although it is much easier to determine satisfiability in DNF? I If two formulas are equisatisfiable, are they equivalent? I Example: I I Equisatisfiability is a much weaker notion than equivalence. I I But useful if all we want to do is determine satisfiability. I¸sıl Dillig, CS389L: Automated Logical Reasoning Lecture 2: Normal Forms and DPLL 17/39 I¸sıl Dillig, CS389L: Automated Logical Reasoning Lecture 2: Normal Forms and DPLL 18/39 3 The Plan Tseitin’s Transformation I To determine satisfiability of F , convert formula to equisatisfiable formula F 0 in CNF I Use an algorithm (DPLL) to decide satisfiability of F 0 Tseitin’s transformation converts formula F to equisatisfiable formula F 0 in CNF I Since F 0 is equisatisfiable to F , F is satifiable iff algorithm with only a linear increase in size. decides F 0 is satisfiable I Big question: How do we convert formula to equisatisfiable formula without causing exponential blow-up in size? I¸sıl Dillig, CS389L: Automated Logical Reasoning Lecture 2: Normal Forms and DPLL 19/39 I¸sıl Dillig, CS389L: Automated Logical Reasoning Lecture 2: Normal Forms and DPLL 20/39 Tseitin’s Transformation I Tseitin’s Transformation II I Step 2: Consider each subformula G : G1 G2 ( arbitrary boolean connective) I Step 1: Introduce a new variable pG for every subformula G ◦ ◦ of F (unless G is already an atom). I Stipulate representative of G is equivalent to representative of G G 1 ◦ 2 I For instance, if F = G1 G2, introduce two variables pG1 and p p p ∧ G ↔ G1 ◦ G2 pG2 representing G1 and G2 respectively. I p is said to be representative of G and p is I Step 3: Convert p p p to equivalent CNF (by G1 1 G2 G ↔ G1 ◦ G2 representative of G . converting to NNF and distributing ’s over ’s). 2 ∨ ∧ I Observe: Since p p p contains at most three G ↔ G1 ◦ G2 propositional variables and exactly two connectives, size of this formula in CNF is bound by a constant. I¸sıl Dillig, CS389L: Automated Logical Reasoning Lecture 2: Normal Forms and DPLL 21/39 I¸sıl Dillig, CS389L: Automated Logical Reasoning Lecture 2: Normal Forms and DPLL 22/39 Tseitin’s Transformation II Tseitin’s Transformation and Size I Using this transformation, we converted F to an I Given original formula F , let pF be its representative and let equisatisfiable CNF formula F 0. SF be the set of all subformulas of F (including F itself). I What about the size of F 0? I Then, introduce the formula p CNF (p p p ) F ∧ g ↔ g1 ◦ g2 pF CNF (pg pg1 pg2 ) G=(G1 G2) S ∧ ↔ ◦ ^◦ ∈ F G=(G1 G2) S ^◦ ∈ F I SF is bound by the number of connectives in F . I Claim: This formula is equisatisfiable to F . | | I Each formula CNF (pg pg1 pg2 ) has constant size. I The proof is by structural induction ↔ ◦ I Thus, trasformation causes only linear increase in formula size. I Formula is also in CNF because conjunction of CNF formulas is in CNF. I More precisely, the size of resulting formula is bound by 30n + 2 where n is size of original formula I¸sıl Dillig, CS389L: Automated Logical Reasoning Lecture 2: Normal Forms and DPLL 23/39 I¸sıl Dillig, CS389L: Automated Logical Reasoning Lecture 2: Normal Forms and DPLL 24/39 4 Tseitin’s Transformation Example SAT Solvers Convert F :(p q) (p r) to equisatisfiable CNF formula. ∨ → ∧ ¬ 1. 2. I Almost all SAT solvers today are based on an algorithm called DPLL (Davis-Putnam-Logemann-Loveland) 3. I¸sıl Dillig, CS389L: Automated Logical Reasoning Lecture 2: Normal Forms and DPLL 25/39 I¸sıl Dillig, CS389L: Automated Logical Reasoning Lecture 2: Normal Forms and DPLL 26/39 DPLL: Historical Perspective DPLL insight I 1962: the original algorithm known as DP (Davis-Putnam) I There are two distinct ways to approach the boolean “simple” procedure for automated theorem proving satisfiability problem: ⇒ I Search I Davis and Putnam hired two I Find satisfying assignment in by searching through all possible programmers, George Logemann assignments most basic incarnation: truth table! ⇒ and David Loveland, to implement their ideas on the IBM 704.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages7 Page
-
File Size-