cpsc 121 mode els of computation
play

CPSC 121: Mode els of Computation Un nit 6 Rewriting Predicat te - PDF document

CPSC 121: Mode els of Computation Un nit 6 Rewriting Predicat te Logic Statements Based on slides by Patrice Be Based on slides by Patrice Be lleville and Steve Wolfman lleville and Steve Wolfman Pre-Class Learning Pre-Class Learning


  1. CPSC 121: Mode els of Computation Un nit 6 Rewriting Predicat te Logic Statements Based on slides by Patrice Be Based on slides by Patrice Be lleville and Steve Wolfman lleville and Steve Wolfman Pre-Class Learning Pre-Class Learning Goals Goals � By the start of class you s � By the start of class, you s hould be able to: hould be able to: � Determine the negation of a any quantified statement. � Given a quantified statemen � Given a quantified statemen nt and an equivalence rule, apply nt and an equivalence rule apply the rule to create an equiva lent statement (particularly the De Morgan’s and contrapos sitive rules). � Prove and disprove quantifi ed statements using the “challenge” method (Epp, 4t th edition, page 119). � Apply universal instantiation � Apply universal instantiation n universal modus ponens and n, universal modus ponens, and universal modus tollens to p predicate logic statements that correspond to the rules’ pre mises to infer statements implied by the premises. Unit 6 - Rewriting Predicate Logic Statements 2

  2. Quiz 6 Feedback Quiz 6 Feedback � Overall: � Overall: � Issues: � Open-ended question: p q Unit 6 - Rewriting Predicate Logic Statements 3 In-Class Learning G In-Class Learning G oals oals � By the end of this unit you � By the end of this unit, you u should be able to: u should be able to: � Explore alternate forms of p predicate logic statements using the logical equivalences you g q y u have already learned plus y p negation of quantifiers (a ge eneralized form of the De Morgan’s Law). Unit 6 - Rewriting Predicate Logic Statements 4

  3. ? ? Related to CPSC 12 ? ? Related to CPSC 12 21 Big Questions 21 Big Questions ? ? ? ? � How can we convince ou urselves that an algorithm does what it's supposed to do? s that arise when we discuss ? � We continue discussing h how to prove various types of ? predicate logic statements algorithm correctness. algorithm correctness ? ? ? ? ? ? Unit 5 - Predicate Logic 5 Outline Outline � Thinking of quantifiers d ifferently. � R les and Transformations � Rules and Transformations s � The challenge method. g Unit 6 - Rewriting Predicate Logic Statements 6

  4. Relation between , Relation between , ˄ , ˅ ˄ ˅ � Suppose D contains value � Suppose D contains value s x1, x2, ..., xn s x1 x2 xn � What does x D, P(x) re ally mean? � It s the same as � It's the same as P(x1) ^ P(x2) ^ ... ^ P P(xn). � Similarly, y, � y � D, P(x) ≡ P(x1) v P( (x2) v ... v P(xn) � Thinking of quantifiers this g q way explains y p � Negation � Universal instantiation � Universal Modus Ponens, T Tollens Unit 6 - Rewriting Predicate Logic Statements 7 Negation Negation � ~ x D, P(x) ≡ ~(P(x1) ^ ^ P(x2) ^ ... ^ P(xn)) ≡ ~P(x1) v ~P(x2) v ... v ~P(xn) ≡ x D, ~ ~P(x) � ~ x D, P(x) ≡ ~(P(x1) v v P(x2) v ... v P(xn)) ≡ ~P(x1) ^ ( ) ~P(x2) ^ ... ^ ~P(xn) ( ) ( ) ≡ x D, ~ ~P(x) Unit 6 - Rewriting Predicate Logic Statements 8

  5. Negation Negation � What can we do with the n � What can we do with the n negation in: negation in: ~ � c � R+ � n0 � N � n � N, n n ≥ n0 → f(n) ≤ cg(n) ? A. A It cannot be moved inward It cannot be moved inward d. B. It can only move across o ne quantifier because the generalized De Morgan’s la aw can only handle one quantifier. C. It can only be moved acro oss all three quantifiers because a negation can't a because a negation can t a appear between quantifiers appear between quantifiers. D. It could be moved across one, two or all three q quantifiers. E. None of the above. Unit 6 - Rewriting Predicate Logic Statements 9 Negation Negation Which of the following are equ ivalent to: ~ ∃ n 0 ∈ Z 0 , ∀ n ∈ Z 0 , n > n 0 → F(a 1 , a 2 , n). A. ∀ n 0 ∈ Z 0 , ~ ∀ n ∈ Z 0 , n n > n 0 → F(a 1 , a 2 , n). B. ∀ n 0 ∈ Z 0 , ∃ n ∈ Z 0 , ~ (n > n 0 ) → F(a 1 , a 2 , n). C. ∀ n 0 ∈ Z 0 , ∃ n ∈ Z 0 , ~ (n > n 0 → F(a 1 , a 2 , n)). 0 0 D. ∃ n 0 ∈ Z 0 , ∀ n ∈ Z 0 , ~ (n > n 0 → F(a 1 , a 2 , n)). , , ( ( 1 , 2 , )) 0 0 E. ∀ n 0 ∈ Z 0 , ∃ n ∈ Z 0 , n > n 0 ∧ ~F(a 1 , a 2 , n). 10

  6. Exercise Exercise � Let A be the set of amoeba � Let A be the set of amoeba ae and Parent(x y) be true if ae, and Parent(x,y) be true if amoeba x is amoeba y's pa arent. � Use logical equivalences to � Use logical equivalences to o show that these two o show that these two translations of “an amoeba a has only one parent” are logically equivalent: logically equivalent: � x � A, � y � A, Parent(y, x) � y (y ) ( � z � A, Parent(z, x) → y = z) ( ( ) y ) � x � A, � y � A, Parent(x, y) � (~ � z � A, Parent(z, x) � y ≠ z) Unit 6 - Rewriting Predicate Logic Statements 11 Outline Outline � Thinking of quantifiers diffe erently. � R les and Transformatio � Rules and Transformatio ons ons � The challenge method. g Unit 6 - Rewriting Predicate Logic Statements 12

  7. Universal Instantiatio Universal Instantiatio on on � If a is an element of D the � If a is an element of D the n: n: � x � D, P(x) P(a) � Proving it is a valid inferen ce: � Suppose � x � D, P(x) is true pp , ( ) e. � Hence P(x 1 ) � P(x 2 ) � ... � P P(x n ) holds. � If a = x i is an element of D, t then by specialization we have P(x i ). Unit 6 - Rewriting Predicate Logic Statements 13 Is Existential Instantiat Is Existential Instantiat tion a Valid Rule? tion a Valid Rule? � Consider an existential ins � Consider an existential ins stantiation rule: stantiation rule: � x � D, P(x) a � D a � D P(a) A. This argument is valid: P(a a) is true. B B. This argument is invalid: P Thi t i i lid P P(a) is false. P( ) i f l C. This argument is invalid: P P(a) might be false. D. This argument is invalid fo or another reason. Unit 6 - Rewriting Predicate Logic Statements 14

  8. Existential Generaliz Existential Generaliz zation zation � If a is an element of D the � If a is an element of D the n: n: P(a) � x � D, P(x) � Proving it is a valid inferen ce: � Suppose P(a) is true and a = x i � Hence P(x 1 ) v … v P(x i ) v .. . v P(x n ) holds. � Therefore � x � D, P(x) is t rue. Unit 6 - Rewriting Predicate Logic Statements 15 Universal Generaliza Universal Generaliza ation ation � If y is a non-specific ( arb � If y is a non-specific ( arb bitrary ) element of D then: bitrary ) element of D then: P(y) for a non-specific y � x � D, P(x) � Proving it is a valid inferen ce: specific y � D � Suppose P(y) is true a non- � Since y can be anyone of th he elements of D, P(x 1 ) � … � P(x n ) holds. � Therefore � x � D, P(x) is tr � � D P( ) i t � Th f rue. Unit 6 - Rewriting Predicate Logic Statements 16

  9. Universal Modus Po Universal Modus Po onens/Tollens onens/Tollens � If a is an element of D then n: � x � D, P(x) → Q(x) P(a) Q(a) � Proof: 1. � x � D, P(x) → Q(x) premise 2. P(a) premise 3. P(a) → Q(a) 1, universal instantiation 4. Q(a) 3, modus ponens � The proof for universal mo odus tollens is similar. Unit 6 - Rewriting Predicate Logic Statements 17 Is Existential Modus Is Existential Modus s Ponens Valid? s Ponens Valid? � Is this rule valid? � Is this rule valid? � x � D, P(x) → Q(x) P(a) P(a) Q(a) A. This argument is valid, and d Q(a) is true. B. The argument is valid, but t the 1st premise can not be true; so Q(a) might be false. Q( ) i ht b f l C. This argument is invalid be ecause Q(a) is false. D This argument is invalid be D. This argument is invalid be ecause the premises can be true ecause the premises can be true and Q(a) can be false. E. The argument is invalid fo e a gu e s a d o or another reason. o a o e easo Unit 6 - Rewriting Predicate Logic Statements 18

  10. Logical Equivalence Logical Equivalence es es � Applying logical equivalenc � Applying logical equivalenc ces to predicate logic: ces to predicate logic: � Suppose we have o � x � D, P(x) → Q(x) o � x � D P(x) → Q(x) � and we know that o P(x) → Q(x) ≡ ~P(x) v Q ( ) ( ) ( ) (x) ( ) � Can we infer o � x � D, ~P(x) v Q(x) ? � Can we infer o ~ � x � D, P(x) v Q(x) ? D P( ) Q( ) ? � I � Is any of these valid? f th lid? Unit 6 - Rewriting Predicate Logic Statements 19 Logical Equivalence Logical Equivalence es es � Which propositional logic e � Which propositional logic e equivalences apply to equivalences apply to predicate logic? A A. De Morgan s De Morgan's ~(P(x) → Q(x)) ≡ P(x) � ~Q B. Q(x) C. Commutative, Associative , e, and the “definition of , conditional” D. All propositional logic equ ivalences apply to predicate logic, but… we have to be l i b t h t b sure to carefully “line up” the t f ll “li ” th parts of the logical equivale ence with the parts of the logical statement. E. None of the above. Unit 6 - Rewriting Predicate Logic Statements 20

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend