Discussion #10 Logical Equivalences Discussion #10 1/16 Topics • • • • Laws Duals Manipulations / simplifications Normal forms – Definitions – Algebraic manipulation – Converting truth functions to logic expressions Discussion #10 2/16 Laws of , , and Law P P T P P F PFP PTP PTT PFF PPP PPP (P) P Discussion #10 Name Excluded middle law Contradiction law Identity laws Domination laws Idempotent laws Double-negation law 3/16 Law PQQP PQQP (P Q) R P (Q R) (P Q) R P (Q R) (P Q) (P R) P (Q R) (P Q) (P R) P (Q R) (P Q) P Q (P Q) P Q P (P Q) P P (P Q) P Discussion #10 Name Commutative laws Associative laws Distributive laws De Morgan’s laws Absorption laws 4/16 Can prove all laws by truth tables… P Q (P Q) P Q T T F T T F F F T F T F T F T T F T T F T T T F F F T F T T T T De Morgan’s law holds. Discussion #10 5/16 Absorption Laws P (P Q) P Venn diagram proof … P (P Q) P P Q Prove algebraically … P (P Q) (P T) (P Q) Discussion #10 identity P (T Q) distributive (factor) PT domination P identity 6/16 Duals • To create the dual of a logical expression 1) swap propositional constants T and F, and 2) swap connective operators and . P P T P P F Excluded Middle Contradiction • The dual of a law is always a law! • Thus, most laws come in pairs pairs of duals. Discussion #10 7/16 Why Duals of Laws are Always Laws We can always do the following: Start with law P P T Negate both sides (P P) T Apply De Morgan’s law P P T Simplify negations Since a law is a tautology, substitute X for X Simplify negations Discussion #10 P P F (P ) (P ) F P P F 8/16 Normal Forms • Normal forms are standard forms, sometimes called canonical or accepted forms. • A logical expression is said to be in disjunctive normal form (DNF) if it is written as a disjunction, in which all terms are conjunctions of literals. • Similarly, a logical expression is said to be in conjunctive normal form (CNF) if it is written as a conjunction of disjunctions of literals. Discussion #10 9/16 DNF and CNF • Disjunctive Normal Form (DNF) ( .. .. .. ) ( .. .. .. ) … ( .. .. ) Term Examples: Literal, i.e. P or P (P Q) (P Q) P (Q R) • Conjunctive Normal Form (CNF) ( .. .. .. ) ( .. .. .. ) … ( .. .. ) Examples: Discussion #10 (P Q) (P Q) P (Q R) 10/16 Converting Expressions to DNF or CNF The following procedure converts an expression to DNF or CNF: 1. Remove all and . 2. Move inside. (Use De Morgan’s law.) 3. Use distributive laws to get proper form. Simplify as you go. (e.g. double-neg., idemp., comm., assoc.) Discussion #10 11/16 CNF Conversion Example ( .. .. .. ) ( .. .. .. ) … ( .. .. ) ((P Q) R (P Q)) ((P Q) R (P Q)) (P Q) R (P Q) (P Q) R (P Q) (DNF) (P Q) R (P Q) ((P R) (Q R)) (P Q) ((P R) (P Q)) ((Q R) (P Q)) (((P R) P) ((P R) Q)) (((Q R) P) ((Q R) Q)) (P R) (P R Q) (Q R) Discussion #10 impl. deM. deM. double neg. distr. distr. distr. assoc. comm. idemp. 12/16 CNF Conversion Example ( .. .. .. ) ( .. .. .. ) … ( .. .. ) ((P Q) R (P Q)) ((P Q) R (P Q)) (P Q) R (P Q) (P Q) R (P Q) (DNF) (P Q) R (P Q) ((P R) (Q R)) (P Q) ((P R) (P Q)) ((Q CNF R) (P Q)) Using the commutative idempotent (((P R) P) and ((P R) Q)) laws on the previous step and then the (((Q R) P) ((Q R) Q)) distributive law, we obtain this formula as(Pthe conjunctive R) (P normal R Q) (Q R) form. Discussion #10 impl. deM. deM. double neg. distr. distr. distr. assoc. comm. idemp. 13/16 CNF Conversion Example ( .. .. .. ) ( .. .. .. ) … ( .. .. ) (P R) (P R Q) ((P Q) R (P Q)) (Q R) ((P Q) R (P Q)) impl. (P R) (P R Q) (P Q) R (P Q) (F Q deM. R) - ident. (P Q) R (P Q) (P R) ((PdeM. F) double neg. distr. (DNF) (P Q) R (P Q) (Q R)) - comm., ((P R) (Q R)) (P Q) (P R) (Fdistr. (Q R)) ((P R) (P Q)) distr.- dominat. (P R) (Q R) - ident. ((Q R) (P Q)) (((P R) P) ((P R) Q)) distr. (((Q R) P) ((Q R) Q)) (P R) (P R Q) (Q R) assoc. comm. idemp. Discussion #10 14/16 DNF Expression Generation P Q R T T T F T T F T T F T T T F F F F T T F F T F F F F T T F F F F The only definition of is the truth table (P Q R) (P Q R) minterms (P Q R) (P Q R) (P Q R) (P Q R) Discussion #10 15/16 CNF Expression Generation 1. 2. 3. Find . Find the DNF of . Then, use De Morgan’s law to get the CNF of (i.e. () ) P Q T T T F T F F T F T T F F F F T } Form a conjunction of max terms max terms (P Q) (P Q) (P Q) (P Q) (P Q) (P Q) DNF of f ((P Q) (P Q)) (P Q) (P Q) De Morgan’s (P Q) (P Q) De Morgan’s, double neg. Discussion #10 16/16