Propositional Logic: [2Ex] Conjunctive Normal Forms, Disjunctive Normal
Total Page:16
File Type:pdf, Size:1020Kb
CS 511, Fall 2018, Handout 06 Propositional Logic: Conjunctive Normal Forms, Disjunctive Normal Forms, Horn Formulas, and other special forms Assaf Kfoury 10 September 2018 (adjusted 25 September 2018) Assaf Kfoury, CS 511, Fall 2018, Handout 06 page 1 of 29 CNF L ::= p j :p literal D ::= L j L _ D disjunction of literals C ::= D j D ^ C conjunction of disjunctions DNF L ::= p j :p literal C ::= L j L ^ C conjunction of literals D ::= C j C _ D disjunction of conjunctions conjunctive normal form & disjunctive normal form Assaf Kfoury, CS 511, Fall 2018, Handout 06 page 2 of 29 DNF L ::= p j :p literal C ::= L j L ^ C conjunction of literals D ::= C j C _ D disjunction of conjunctions conjunctive normal form & disjunctive normal form CNF L ::= p j :p literal D ::= L j L _ D disjunction of literals C ::= D j D ^ C conjunction of disjunctions Assaf Kfoury, CS 511, Fall 2018, Handout 06 page 3 of 29 conjunctive normal form & disjunctive normal form CNF L ::= p j :p literal D ::= L j L _ D disjunction of literals C ::= D j D ^ C conjunction of disjunctions DNF L ::= p j :p literal C ::= L j L ^ C conjunction of literals D ::= C j C _ D disjunction of conjunctions Assaf Kfoury, CS 511, Fall 2018, Handout 06 page 4 of 29 I A disjunction of literals L1 _···_ Lm is valid (or a tautology) iff there are 1 6 i; j 6 m with i 6= j such that Li is :Lj. I A conjunction of disjunctions D1 ^ · · · ^ Dn is valid (or a tautology) iff for every 1 6 i 6 n it is the case that Di is valid. I CNF allows for a fast and easy syntactic test of validity. I Unfortunately, conversion into CNF may lead to exponential blow-up: (x1 ^ y1) _ (x2 ^ y2) _···_ (xn ^ yn) becomes (x1 _···_ xn−1 _ xn) ^ (x1 _···_ xn−1 _ yn) ^ · · · ^ (y1 _···_ yn−1 _ yn) i.e., the initial WFF of size O(n) becomes an equivalent WFF of size n O(2 ), because each clause in the latter contains either xi or yi for every i. I Converting a WFF into an equivalent WFF in CNF, preserving validity, is NP-hard! (However, converting a WFF into another WFF, not necessarily equivalent, preserving satisfiability can be carried out in linear time – more in a later handout.) Why CNF? Assaf Kfoury, CS 511, Fall 2018, Handout 06 page 5 of 29 I A conjunction of disjunctions D1 ^ · · · ^ Dn is valid (or a tautology) iff for every 1 6 i 6 n it is the case that Di is valid. I CNF allows for a fast and easy syntactic test of validity. I Unfortunately, conversion into CNF may lead to exponential blow-up: (x1 ^ y1) _ (x2 ^ y2) _···_ (xn ^ yn) becomes (x1 _···_ xn−1 _ xn) ^ (x1 _···_ xn−1 _ yn) ^ · · · ^ (y1 _···_ yn−1 _ yn) i.e., the initial WFF of size O(n) becomes an equivalent WFF of size n O(2 ), because each clause in the latter contains either xi or yi for every i. I Converting a WFF into an equivalent WFF in CNF, preserving validity, is NP-hard! (However, converting a WFF into another WFF, not necessarily equivalent, preserving satisfiability can be carried out in linear time – more in a later handout.) Why CNF? I A disjunction of literals L1 _···_ Lm is valid (or a tautology) iff there are 1 6 i; j 6 m with i 6= j such that Li is :Lj. Assaf Kfoury, CS 511, Fall 2018, Handout 06 page 6 of 29 I CNF allows for a fast and easy syntactic test of validity. I Unfortunately, conversion into CNF may lead to exponential blow-up: (x1 ^ y1) _ (x2 ^ y2) _···_ (xn ^ yn) becomes (x1 _···_ xn−1 _ xn) ^ (x1 _···_ xn−1 _ yn) ^ · · · ^ (y1 _···_ yn−1 _ yn) i.e., the initial WFF of size O(n) becomes an equivalent WFF of size n O(2 ), because each clause in the latter contains either xi or yi for every i. I Converting a WFF into an equivalent WFF in CNF, preserving validity, is NP-hard! (However, converting a WFF into another WFF, not necessarily equivalent, preserving satisfiability can be carried out in linear time – more in a later handout.) Why CNF? I A disjunction of literals L1 _···_ Lm is valid (or a tautology) iff there are 1 6 i; j 6 m with i 6= j such that Li is :Lj. I A conjunction of disjunctions D1 ^ · · · ^ Dn is valid (or a tautology) iff for every 1 6 i 6 n it is the case that Di is valid. Assaf Kfoury, CS 511, Fall 2018, Handout 06 page 7 of 29 I Unfortunately, conversion into CNF may lead to exponential blow-up: (x1 ^ y1) _ (x2 ^ y2) _···_ (xn ^ yn) becomes (x1 _···_ xn−1 _ xn) ^ (x1 _···_ xn−1 _ yn) ^ · · · ^ (y1 _···_ yn−1 _ yn) i.e., the initial WFF of size O(n) becomes an equivalent WFF of size n O(2 ), because each clause in the latter contains either xi or yi for every i. I Converting a WFF into an equivalent WFF in CNF, preserving validity, is NP-hard! (However, converting a WFF into another WFF, not necessarily equivalent, preserving satisfiability can be carried out in linear time – more in a later handout.) Why CNF? I A disjunction of literals L1 _···_ Lm is valid (or a tautology) iff there are 1 6 i; j 6 m with i 6= j such that Li is :Lj. I A conjunction of disjunctions D1 ^ · · · ^ Dn is valid (or a tautology) iff for every 1 6 i 6 n it is the case that Di is valid. I CNF allows for a fast and easy syntactic test of validity. Assaf Kfoury, CS 511, Fall 2018, Handout 06 page 8 of 29 Why CNF? I A disjunction of literals L1 _···_ Lm is valid (or a tautology) iff there are 1 6 i; j 6 m with i 6= j such that Li is :Lj. I A conjunction of disjunctions D1 ^ · · · ^ Dn is valid (or a tautology) iff for every 1 6 i 6 n it is the case that Di is valid. I CNF allows for a fast and easy syntactic test of validity. I Unfortunately, conversion into CNF may lead to exponential blow-up: (x1 ^ y1) _ (x2 ^ y2) _···_ (xn ^ yn) becomes (x1 _···_ xn−1 _ xn) ^ (x1 _···_ xn−1 _ yn) ^ · · · ^ (y1 _···_ yn−1 _ yn) i.e., the initial WFF of size O(n) becomes an equivalent WFF of size n O(2 ), because each clause in the latter contains either xi or yi for every i. I Converting a WFF into an equivalent WFF in CNF, preserving validity, is NP-hard! (However, converting a WFF into another WFF, not necessarily equivalent, preserving satisfiability can be carried out in linear time – more in a later handout.) Assaf Kfoury, CS 511, Fall 2018, Handout 06 page 9 of 29 I A conjunction of literals L1 ^ · · · ^ Lm is satisfiable iff fL1;:::; Lmg does not include both a propositional atom P and its negation :P. I A disjunction of conjunctions C1 _···_ Cn is satisfiable iff there is some 1 6 i 6 n such that Ci is satisfiable. I DNF allows for a fast and easy syntactic test of satisfiability. I Unfortunately, conversion into DNF may lead to exponential blow-up: (x1 _ y1) ^ (x2 _ y2) ^ · · · ^ (xn _ yn) becomes (x1 ^ · · · ^ xn−1 ^ xn) _ (x1 ^ · · · ^ xn−1 ^ yn) _···_ (y1 ^ · · · ^ yn−1 ^ yn) i.e., the initial WFF of size O(n) becomes an equivalent WFF of size n O(2 ), because each clause in the latter contains either xi or yi for every i. I Converting a WFF into an equivalent WFF in DNF, preserving satisfiability, is NP-hard! Why DNF? Assaf Kfoury, CS 511, Fall 2018, Handout 06 page 10 of 29 I A disjunction of conjunctions C1 _···_ Cn is satisfiable iff there is some 1 6 i 6 n such that Ci is satisfiable. I DNF allows for a fast and easy syntactic test of satisfiability. I Unfortunately, conversion into DNF may lead to exponential blow-up: (x1 _ y1) ^ (x2 _ y2) ^ · · · ^ (xn _ yn) becomes (x1 ^ · · · ^ xn−1 ^ xn) _ (x1 ^ · · · ^ xn−1 ^ yn) _···_ (y1 ^ · · · ^ yn−1 ^ yn) i.e., the initial WFF of size O(n) becomes an equivalent WFF of size n O(2 ), because each clause in the latter contains either xi or yi for every i. I Converting a WFF into an equivalent WFF in DNF, preserving satisfiability, is NP-hard! Why DNF? I A conjunction of literals L1 ^ · · · ^ Lm is satisfiable iff fL1;:::; Lmg does not include both a propositional atom P and its negation :P. Assaf Kfoury, CS 511, Fall 2018, Handout 06 page 11 of 29 I DNF allows for a fast and easy syntactic test of satisfiability. I Unfortunately, conversion into DNF may lead to exponential blow-up: (x1 _ y1) ^ (x2 _ y2) ^ · · · ^ (xn _ yn) becomes (x1 ^ · · · ^ xn−1 ^ xn) _ (x1 ^ · · · ^ xn−1 ^ yn) _···_ (y1 ^ · · · ^ yn−1 ^ yn) i.e., the initial WFF of size O(n) becomes an equivalent WFF of size n O(2 ), because each clause in the latter contains either xi or yi for every i.