300 likes | 529 Views
Propositional Equivalences. CS/APMA 202, Spring 2005 Rosen, section 1.2 Aaron Bloomfield. Tautology and Contradiction. A tautology is a statement that is always true p ¬p will always be true (Negation Law) A contradiction is a statement that is always false
E N D
Propositional Equivalences CS/APMA 202, Spring 2005 Rosen, section 1.2 Aaron Bloomfield
Tautology and Contradiction • A tautology is a statement that is always true • p ¬p will always be true (Negation Law) • A contradiction is a statement that is always false • p ¬p will always be false (Negation Law)
Logical Equivalence • A logical equivalence means that the two sides always have the same truth values • Symbol is ≡or (we’ll use ≡)
Logical Equivalences of And • p T ≡ p Identity law • p F ≡ F Domination law
Logical Equivalences of And • p p ≡ p Idempotent law • p q ≡ q p Commutative law
Logical Equivalences of And • (p q) r ≡ p (q r) Associative law
Logical Equivalences of Or • p T ≡ T Identity law • p F ≡ pDomination law • p p ≡ p Idempotent law • p q ≡ q p Commutative law • (p q) r ≡ p (q r) Associative law
Corollary of the Associative Law • (p q) r ≡ p q r • (p q) r ≡ p q r • Similar to (3+4)+5 = 3+4+5 • Only works if ALL the operators are the same!
Logical Equivalences of Not • ¬(¬p) ≡ p Double negation law • p ¬p ≡ T Negation law • p ¬p ≡ F Negation law
Sidewalk chalk guy • Source: http://www.gprime.net/images/sidewalkchalkguy/
DeMorgan’s Law • Probably the most important logical equivalence • To negate pq (or pq), you “flip” the sign, and negate BOTH p and q • Thus, ¬(p q) ≡ ¬p ¬q • Thus, ¬(p q) ≡ ¬p ¬q
Yet more equivalences • Distributive: p (q r) ≡ (p q) (p r) p (q r) ≡ (p q) (p r) • Absorption p (p q) ≡ p p (p q) ≡ p
How to prove two propositions are equivalent? • Two methods: • Using truth tables • Not good for long formula • In this course, only allowed if specifically stated! • Using the logical equivalences • The preferred method • Example: Rosen question 23, page 27 • Show that:
p q r p→r q →r (p→r)(q →r) pq (pq) →r Using Truth Tables
Using Logical Equivalences Original statement Definition of implication DeMorgan’s Law Associativity of Or Re-arranging Idempotent Law
Quick survey • I understood the logical equivalences on the last slide • Very well • Okay • Not really • Not at all
Logical Thinking • At a trial: • Bill says: “Sue is guilty and Fred is innocent.” • Sue says: “If Bill is guilty, then so is Fred.” • Fred says: “I am innocent, but at least one of the others is guilty.” • Let b = Bill is innocent, f = Fred is innocent, and s = Sue is innocent • Statements are: • ¬s f • ¬b → ¬f • f (¬b ¬s)
b f s ¬b ¬f ¬s ¬sf ¬b→¬f ¬b¬s f(¬b¬s) Can all of their statements be true? • Show: (¬s f) (¬b → ¬f) (f (¬b ¬s))
Are all of their statements true?Show values for s, b, and f such that the equation is true Original statement Definition of implication Associativity of AND Re-arranging Idempotent law Re-arranging Absorption law Re-arranging Distributive law Negation law Domination law Associativity of AND
What if it weren’t possible to assign such values to s, b, and f? Original statement Definition of implication ... (same as previous slide) Domination law Re-arranging Negation law Domination law Domination law Contradiction!
Quick survey • I feel I can prove a logical equivalence myself • Absolutely • With a bit more practice • Not really • Not at all
Logic Puzzles • Rosen, page 20, questions 51-55 • Knights always tell the truth, knaves always lie • A says “At least one of us is a knave” and B says nothing • A says “The two of us are both knights” and B says “A is a knave” • A says “I am a knave or B is a knight” and B says nothing • Both A and B say “I am a knight” • A says “We are both knaves” and B says nothing
Functional completeness • Functional completeness is discussed on page 27 (questions 37-39) of the text • All the “extended” operators have equivalences using only the 3 basic operators (and, or, not) • The extended operators: nand, nor, xor, conditional, bi-conditional • Given a limited set of operators, can you write an equivalence of the 3 basic operators? • If so, then that group of operators is functionally complete
Rosen, § 1.2 question 46 • Show that | (NAND) is functionally complete • Equivalence of NOT: • p | p ≡ p • (p p) ≡ p Equivalence of NAND • (p) ≡ p Idempotent law
Rosen, § 1.2 question 46 • Equivalence of AND: • p q≡ (p| q) Definition of nand • p | p How to do a not using nands • (p | q) | (p | q) Negation of (p| q) • Equivalence of OR: • p q≡ (p q) DeMorgan’s equivalence of OR • As we can do AND and OR with NANDs, we can thus do ORs with NANDs • Thus, NAND is functionally complete
Quick survey • I felt I understood the material in this slide set… • Very well • With some review, I’ll be good • Not really • Not at all
Quick survey • The pace of the lecture for this slide set was… • Fast • About right • A little slow • Too slow