cpsc 121 models of computation
play

CPSC 121: Models of Computation Module 6: Rewriting predicate logic - PowerPoint PPT Presentation

CPSC 121: Models of Computation Module 6: Rewriting predicate logic statements Module 6: Rewriting predicate logic statements Pre-class quiz #7 is due Wednesday October 24 th at 19:00. Assigned reading for the quiz: Epp, 4 th edition: 4.1, 4.6,


  1. CPSC 121: Models of Computation Module 6: Rewriting predicate logic statements

  2. Module 6: Rewriting predicate logic statements Pre-class quiz #7 is due Wednesday October 24 th at 19:00. Assigned reading for the quiz: Epp, 4 th edition: 4.1, 4.6, Theorem 4.4.1 Epp, 3 rd edition: 3.1, 3.6, Theorem 3.4.1. Rosen, 6 th edition: 1.6, 1.7. 3.4 (theorem 2 only). Rosen 7 th edition: 1.7, 1.8, 4.1 (theorem 2 only). Assignment #3 is due Friday October 26 th at 19:00 CPSC 121 – 2018W T1 2

  3. Module 6: Rewriting predicate logic statements Pre-class quiz #8 is tentatively due Monday November 5 th at 19:00 Epp, 4th edition: 12.2, pages 791 to 795. Epp, 3rd edition: 12.2, pages 745 to 747, 752 to 754 Rosen, 6th edition: 12.2 pages 796 to 798, 12.3 Rosen, 7th edition: 13.2 pages 858 to 861, 13.3 CPSC 121 – 2018W T1 3

  4. Module 6: Rewriting predicate logic statements By the start of class, you should be able to: Determine the negation of any quantified statement. Given a quantified statement and an equivalence rule, apply the rule to create an equivalent statement (particularly the De Morgan’s and contrapositive rules). Prove and disprove quantified statements using the “challenge” method (Epp, 4th edition, page 119). Apply universal instantiation, universal modus ponens, and universal modus tollens to predicate logic statements that correspond to the rules’ premises to inf er statements implied by the premises. CPSC 121 – 2018W T1 4

  5. Module 6: Rewriting predicate logic statements Quiz 6 feedback: Once again well done overall. Two questions seemed more difficult (next slides). Not much to say about the open-ended question: most people gave correct strategies. Great! CPSC 121 – 2018W T1 5

  6. Module 6: Rewriting predicate logic statements How many of the following statements are log. equivalent to x ∀ ∈ B ∃ ∈ y C, P(x) → Q(y) ? ∀ x ∈ B y ∃ ∈ C, ~Q(y) → ~P(x) ∃ ∈ ∀ ∈ ~ ( x B y C, P(x) ^ ~Q(y)) ∃ ∈ ∀ ∈ ~ ( x B y C, ~P(x) v Q(y)) ∀ y ∈ B x ∃ ∈ C, P(y) → Q(x) a) None of them b) One of them c) Two of them d) Three of them e) All four of them ▷ CPSC 121 – 2018W T1 6

  7. Module 6: Rewriting predicate logic statements Which of the following could be the result of applying one of the negation equivalence laws to the statement: ∀ x ∈ ∃ ∈ ∧ ∀ ∈ D, Q(x)→[( y D, P(x, y)) ~( y D, P(x, y))] a) ∀ x ∈ D, Q(x) → F b) F c) None: we can not apply the law to just the right side of the statement. d) None: the law doesn't match the right side of the statement. ▷ CPSC 121 – 2018W T1 8

  8. Module 6: Rewriting predicate logic statements CPSC 121: the BIG questions: ? ? ? How can we convince ourselves that an algorithm ? ? does what it's supposed to do? We continue discussing how to prove various types of ? ? predicate logic statements that arise when we discuss ? ? algorithm correctness. ? ? ? ? ? ? ? ? CPSC 121 – 2018W T1 10

  9. Module 6: Rewriting predicate logic statements By the end of this module, you should be able to: Explore alternate forms of predicate logic statements using the logical equivalences you have already learned plus negation of quantifiers (a generalized form of t he De Morgan’s Law). CPSC 121 – 2018W T1 11

  10. Module 6: Rewriting predicate logic statements Summary Thinking of quantifiers differently. Transformations: allowed or forbidden? The challenge method. CPSC 121 – 2018W T1 12

  11. Module 6.1: Thinking of quantifiers differently Suppose D contains values x 1 , x 2 , ..., x n ∀ ∈ What does x D, P(x) really mean? I t's the same as P(x 1 ) ^ P(x 2 ) ^ ... ^ P(x n ). Similarly, ∃ x ∈ D, P(x) ≡ P(x 1 ) v P(x 2 ) v ... v P(x n ) Thinking of quantifiers this way explains Negation Universal instantiation Universal Modus Ponens, Tollens CPSC 121 – 2018W T1 13

  12. Module 6.1: Thinking of quantifiers differently Negation: ∀ ∈ ~ x D, P(x) ≡ ~(P(x 1 ) ^ P(x 2 ) ^ ... ^ P(x n )) ≡ ~P(x 1 ) v ~P(x 2 ) v ... v ~P(x n ) ≡ ∃ x ∈ D, ~P(x) ~ x ∃ ∈ D, P(x) ≡ ~(P(x 1 ) v P(x 2 ) v ... v P(x n )) ≡ ~P(x 1 ) ^ ~P(x 2 ) ^ ... ^ ~P(x n ) ≡ ∀ x ∈ D, ~P(x) CPSC 121 – 2018W T1 14

  13. Module 6.1: Thinking of quantifiers differently What can we do with the negation in: ~ c ∃ ∈ R + n ∃ ∈ N n ∀ ∈ N, n ≥ n 0 → f(n) ≤ cg(n) ? 0 a) It cannot be moved inward. b) It can only move across one quantifier because the generalized De Morgan’s law can only handle one quantifier. c) It can only be moved across all three quantifiers because a negation can't appear between quantifiers. d) It could be moved across one, two or all three quantifiers. e) None of the above. ▷ CPSC 121 – 2018W T1 15

  14. Module 6.1: Thinking of quantifiers differently Exercise : Let A be the set of amoebae, and Parent(x,y) be true if amoeba x is amoeba y's parent. Use logical equivalences to show that these two translations of “an amoeba has only one parent” are logically equivalent: (1) ∀ x ∈ ∃ ∈ ∧ ∀ ∈ A, y A, Parent(y, x) ( z A, Parent(z, x) → y = z). (2) ∀ x ∈ ∃ ∈ ∧ ∃ ∈ ∧ A, y A, Parent(y, x) (~ z A, Parent(z, x) y ≠ z). CPSC 121 – 2018W T1 17

  15. Module 6: Rewriting predicate logic statements Summary Thinking of quantifiers differently. Transformations: allowed or forbidden? The challenge method. CPSC 121 – 2018W T1 18

  16. Module 6.2: Transformations (allowed or forbidden?) Universal instantiation: ( x ∀ ∈ D, P(x)) ^ (a ∈ D) → P(a) Proving it is a valid inference: ∀ ∈ Suppose x D, P(x) is true. Hence P(x 1 ) ^ P(x 2 ) ^ ... ^ P(x n ) holds. If a = x i is an element of D, then by specialization we have P(x i ). CPSC 121 – 2018W T1 19

  17. Module 6.2: Transformations (allowed or forbidden?) Universal modus ponens: Suppose ∀ x ∈ D, P(x) → Q(x) is true. P(x i ) holds where x i is an element of D. Hence (P(x 1 ) → Q(x 1 )) ^ ... ^ (P(x n )→ Q(x n )). By specialization P(x i ) → Q(x i ) holds. By modus ponens, we deduce Q(x i ). The same reasoning explains why universal modus tollens is valid. CPSC 121 – 2018W T1 20

  18. Module 6.2: Transformations (allowed or forbidden?) Consider existential instantiation: ∃ x ∈ D, P(x) ∈ a D \ P(a) a) This argument is valid: P(a) is true. b) This argument is invalid: P(a) is false. c) This argument is invalid: P(a) might be false. d) This argument is invalid for another reason. ▷ CPSC 121 – 2018W T1 21

  19. Module 6.2: Transformations (allowed or forbidden?) What about existential modus ponens? ∃ x ∈ D, P(x) → Q(x) P(a) \ Q(a) a) This argument is valid, and Q(a) is true. b) The argument is valid, but the 1st premise can not be true; so Q(a) might be false. c) This argument is invalid because Q(a) is false. d) The argument is invalid for another reason. ▷ CPSC 121 – 2018W T1 23

  20. Module 6.2: Transformations (allowed or forbidden?) Applying logical equivalences to predicate logic: Suppose we have ∀ x ∈ D, P(x) → Q(x) We know that P(x) → Q(x) ≡ ~P(x) v Q(x) We might want to write ∀ x ∈ D, ~P(x) v Q(x) Is this valid? CPSC 121 – 2018W T1 25

  21. Module 6.2: Transformations (allowed or forbidden?) Which propositional logic equivalences apply to predicate logic? a) Double negative, Identity, and De Morgan's (not all equivalences!) ∧ b) ~(P(x) → Q(x)) ≡ P(x) ~Q(x) c) Commutative, Associative, and the “definition of conditional” d) All propositional logic equivalences apply to predicate logic. e) None of the above. ▷ CPSC 121 – 2018W T1 26

  22. Module 6.2: Transformations (allowed or forbidden?) Applying rules of inference to predicate logic: Suppose we have ∀ x ∈ D, P(x) → Q(x) We know that ∀ x ∈ D, P(x) We might want to write ∀ x ∈ D, Q(x) Is this valid? CPSC 121 – 2018W T1 28

  23. Module 6.2: Transformations (allowed or forbidden?) Which rules of inference apply to predicate logic? a) Modus ponens, modus tollens and elimination only. b) All rules apply, but only if they follow universal quantifiers, not existential quantifiers. c) All rules apply, but only if they follow existential quantifiers, not universal quantifiers. d) All rules apply, no matter what quantifiers are used. e) None of the above. ▷ CPSC 121 – 2018W T1 29

  24. Module 6.2: Transformations (allowed or forbidden?) The only rules we really need: Universal Instantiation: for any a in D ∀ x ∈ D, P(x) P(a) Universal Generalization: P(x) for an arbitrary element x of D ∀ x ∈ D, P(x) CPSC 121 – 2018W T1 31

  25. Module 6.2: Transformations (allowed or forbidden?) The only rules we really need (continued) Existential Instantiation: ∃ x ∈ D, P(x) P(w) for an unspecified (new) witness w in D Existential Generalization: P(a) for a given element a of D ∃ x ∈ D, P(x) CPSC 121 – 2018W T1 32

  26. Module 6: Rewriting predicate logic statements Summary Thinking of quantifiers differently. Transformations: allowed or forbidden? The challenge method. CPSC 121 – 2018W T1 33

Recommend


More recommend