200 likes | 295 Views
ICS 253: Discrete Structures I. Spring Semester 2014 (2013-2). Propositional Logic Logical Equivalence. Dr. Nasir Al-Darwish Computer Science Department King Fahd University of Petroleum and Minerals darwish@kfupm.edu.sa. Tautologies, contradictions, contingencies.
E N D
ICS 253: Discrete Structures I Spring Semester 2014 (2013-2) Propositional LogicLogical Equivalence Dr. Nasir Al-Darwish Computer Science Department King Fahd University of Petroleum and Minerals darwish@kfupm.edu.sa
Tautologies, contradictions, contingencies • A compound proposition is a tautology if it is always true no matter what truth values its atomic propositions have. • Example: p ¬p • The opposite to a tautology, is a compound proposition that’s always false – a contradiction. • Example: p ¬p • On the other hand, a compound proposition whose truth value isn’t constant is called a contingency. • Example: p ¬p
Tautologies and contradictions The easiest way to see if a compound proposition is a tautology or a contradiction is to use a truth table.
Tautology Example Demonstrate that [¬p (p q)]q is a tautology in two ways: • Using a truth table – show that [¬p (p q)]q is always true • Using a proof (will get to this later). Note: The LHS asserts (states) two facts: ¬p and (p q) Clearly, these assertions taken together imply q.
Tautologies, contradictions and programming Tautologies and contradictions in your code usually correspond to poor programming design. Examples: • while(x <= 3 || x > 3) x++; • if(x > y) if(x == y) return “never got here”;
Logical Equivalence • Definition: Two compound propositions p, q are logically equivalent if their truth tables are the same. • Alternative Definition: Two compound propositions p, q are logically equivalent if their biconditional joining p q is a tautology. • Logical equivalence is denoted by p q or p q. • Example: A logical implication is equivalent to its contrapositive. That is, pq ¬q¬p.
Logical Equivalence - Example 1 The easiest way to test for logical equivalence is to check if the truth tables of both propositions have identical last columns Example: Is pq ¬q¬p? p q ¬q ¬p ¬q¬p p q p q T T F F T F T F F T F T F F T T T T F F T F T F T F T T T F T T Note that because the last columns are identical, it follows that (p q) (¬q¬p) is a tautology, which is consistent with the second def. of equivalence in previous slide.
Logical Equivalence - Example 2 • Show that ┐(p v q) and ┐p ˄┐ q are equivalent
Logical Non-Equivalence of Conditional and Converse The converse of a logical implication is the reversal of the implication. I.e. the converse of pq is qp. Example: The converse of “If Donald is a duck then Donald is a bird.” is “If Donald is a bird then Donald is a duck.” As we’ll see next: pq and qp are not logically equivalent.
Logical Non-Equivalence of Conditional and Converse Note that because the columns for p q and qp are not identical, we can immediately conclude that these propositions are not equivalent.
Derivational Proof Techniques When a compound proposition involves many atomic components, the size of the truth table for the compound proposition becomes large Q1: How many rows are required to construct the truth-table of: ((q(pr )) ((sr)t) ) (qr) ? Q2: How many rows are required to construct the truth-table of a proposition involving n atomic components? A1: 32 rows, each additional variable doubles the number of rows A2: In general, 2n rows Therefore, as compound propositions grow in complexity, truth tables become more and more unwieldy. In such cases, it is better to use derivational proof techniques
Derivational Proof Techniques Example: consider the compound proposition (p p ) ((sr)t) ) (qr ) Q: Why is this a tautology?
Derivational Proof Techniques Answer: The part (p p) is a tautology and the disjunction (or) of True with any other compound proposition always results in True: (p p ) ((sr)t )) (qr) • T ((sr)t )) (qr) • T Derivational techniques formalize the intuition of this example.
Identity laws Like adding 0 Domination laws Like multiplying by 0 Idempotent laws Delete redundancies Double negation “I don’t like you, not” Commutativity Like “x+y = y+x” Associativity Like “(x+y)+z = y+(x+z)” Distributivity Like “(x+y)z = xz+yz” Tables of Logical Equivalences
Excluded middle Negating creates opposite Definition of implication in terms of Not and Or Tables of Logical Equivalences
DeMorgan Identities DeMorgan’s identities allow for simplification of negations of complex expressions • Conjunctional negation: (p1p2…pn) (p1p2…pn) “It’s not the case that all are true iff one is false.” • Disjunctional negation: (p1p2…pn) (p1p2…pn) “It’s not the case that one is true iff all are false.”
Tautology Example - Part 2 Demonstrate that [¬p(p q )]q is a tautology in two ways: • Using a truth table (was done previously) • Using a proof relying on Tables 5 and 6 of Rosen, section 1.3 to derive True through a series of logical equivalences
Tautology by proof [¬p(p q )]q [(¬pp)(¬pq)]q Distributive [ F (¬pq)]q ULE [¬pq ]q Identity ¬ [¬pq ] q ULE [¬(¬p)¬q ] q DeMorgan [p ¬q ] q Double Negation p [¬q q ]Associative p [q ¬q ]Commutative p T ULE T Domination
Important Equivalences • p q (p q) // meaning of • p q p q // simplify RHS of 1 • p q q p // contrapositive • (p q) p q // negation of 1 • (p q) (p r) p (q r) • (p q) (p r) p (q r) • (p r) (q r) (p q) r • (p r) (q r) (p q) r • p q (p q) (q p) • (p q) p q