## Presentation on theme: "Tautologies, contradictions, contingencies"— Presentation transcript:

ICS 253: Discrete Structures I Propositional Logic Logical Equivalence
Spring Semester 2014 (2013-2) Propositional Logic Logical Equivalence Dr. Nasir Al-Darwish Computer Science Department King Fahd University of Petroleum and Minerals

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

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.

Tautology Example - Part 1: by truth table
q ¬p p q ¬p  (p q) [¬p  (p q)]q F T

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, p q  ¬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 p q  ¬q ¬p? T F p q q p T F ¬q¬p p ¬p q ¬q 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 p q is q p. 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: p q and q p are not logically equivalent.

Logical Non-Equivalence of Conditional and Converse
p q p q q p (p q)  (q p) T F Note that because the columns for p q and qp 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(pr ))  ((sr)t) )  (qr) ? 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 )  ((sr)t) )  (qr ) 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 )  ((sr)t ))  (qr ) T  ((sr)t ))  (qr ) T Derivational techniques formalize the intuition of this example.

Tables of Logical Equivalences
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

DeMorgan Identities DeMorgan’s identities allow for simplification of negations of complex expressions Conjunctional negation: (p1p2…pn)  (p1p2…pn) “It’s not the case that all are true iff one is false.” Disjunctional negation: (p1p2…pn)  (p1p2…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  [(¬p p)(¬p q)]q Distributive
 [ F  (¬p q)]q ULE  [¬p q ]q Identity  ¬ [¬p q ]  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