logic
play

Logic It s so easy even Through the computers can Looking Glass - PowerPoint PPT Presentation

Logic It s so easy even Through the computers can Looking Glass do it! 0 SAFE test Can you see the Welcome quiz on SAFE? A. Yes :-) B. No :-/ Story So Far x Winged(x) Flies(x) Pink(x) Alice FALSE FALSE FALSE


  1. Logic It’ s so easy even Through the computers can Looking Glass do it!

  2. 0 SAFE test Can you see the “Welcome” quiz on SAFE? A. Yes :-) B. No :-/

  3. Story So Far ∃ ∀ x Winged(x) Flies(x) Pink(x) Alice FALSE FALSE FALSE Jabberwock TRUE TRUE FALSE Flamingo TRUE TRUE TRUE ∧ ∨ Propositions from predicates ∨ ¬ Propositions by applying formulas to propositions Propositions by applying quantifiers to predicates ∀ x P(x), ∃ x P(x) Today: Manipulating propositions

  4. 
 Question 1 p → q is equivalent to 
 A. p ∨ q 
 B. p ∧ q 
 C. ¬p ∨ q 
 D. ¬p ∧ q 
 E. ¬p ∨ ¬q

  5. 
 
 Question 2 Everyone who flies is winged 
 
 A. ∀ x Flies(x) ∨ Winged(x) B. ∀ x Flies(x) ∧ Winged(x) C. ∀ x Flies(x) ∧ ¬Winged(x) ∀ x Flies(x) → Winged(x) D. ∀ x ¬Flies(x) ∨ Winged(x) E. ∀ x ¬Flies(x) ∧ Winged(x)

  6. 
 
 Manipulating Propositions (Exercise) T ∧ q ≡ q F ∨ q ≡ q Conjunction and disjunction with T and F 
 F ∧ q ≡ F T ∨ q ≡ T T → q ≡ q F → q ≡ T Implication involving T and F 
 q → T ≡ T q → F ≡ ¬q q → ¬q ≡ ¬q ¬q → q ≡ q Implication involving negation Contrapositive 
 p → q ≡ (¬q) → (¬p) p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r) Distributive Property p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r)

  7. The Looking Glass A mirror which shows the negation of every proposition Reflection changes T & F to F & T (resp.) ∨ & ∧ are reflected as ∧ & ∨ (resp.) Flies(Alice) ¬ Flies(Alice) Flies(Alice) ∨ ? ¬Flies(Alice) ∧ 
 ∨ T F ∧ F T ? Flies(J’wock) 
 ¬Flies(J’wock) 
 T T T F F F is True is False F T F T F T ∧ F T ∨ T F F F F T T T T F T F T F

  8. 
 The Looking Glass wire A mirror which shows the negation of every proposition Reflection changes T & F to F & T (resp.) ∨ & ∧ are reflected as ∧ & ∨ (resp.) De Morgan’ s Law ¬(p ∧ q) ≣ (¬p) ∨ (¬q) ¬(p ∨ q) ≣ (¬p) ∧ (¬q) p ¬p p ∧ q ¬p ∨ ¬q ∧ ∨ q ¬q p ¬p p ∨ q ¬p ∧ ¬q ∨ ∧ q ¬q

  9. The Looking Glass wire A mirror which shows the negation of every proposition Reflection changes T & F to F & T (resp.) ∨ & ∧ are reflected as ∧ & ∨ (resp.) p ¬p ∧ ∨ ∨ ∧ f(p,q) f’(¬p,¬q) q ¬q ¬ ∨ ¬ ∧ ¬ f(p,q) ≣ f’(¬p,¬q)

  10. Quantified Propositions (First-Order) Predicate Calculus x Winged(x) Flies(x) Pink(x) ¬Winged(x) Alice FALSE FALSE FALSE TRUE Jabberwock TRUE TRUE FALSE FALSE Flamingo TRUE TRUE TRUE FALSE ∀ x Winged(x) is False Not everyone is winged Same as saying, there is someone who is not winged i.e., ∃ x ¬Winged(x) is True 
 ¬( W(a) ∧ W(j) ∧ W(f) ) 
 ≡ 
 ¬W(a) ∨ ¬W(j) ∨ ¬W(f) ¬ ( ∀ x Winged(x) ) ≣ ∃ x ¬Winged(x)

  11. The Looking Glass Reflection changes T & F to F & T (resp.) ∨ & ∧ are reflected as ∧ & ∨ (resp.) ∀ & ∃ are reflected as ∃ & ∀ (resp.) p ¬p p ∧ q ¬p ∨ ¬q ∧ ∨ q ¬q p ¬p p ∨ q ¬p ∧ ¬q ∨ ∧ q ¬q ∃ x ¬Pred(x) ∀ x Pred(x) ∃ x Pred(x) ∀ x ¬Pred(x)

  12. Predicates, again A predicate can be defined over any number of elements from the domain e.g., Likes(x,y): “x likes y” x,y Likes(x,y) Alice, Alice TRUE Alice, Jabberwock FALSE Alice, Flamingo TRUE Jabberwock, Alice FALSE Jabberwock, Jabberwock TRUE Jabberwock, Flamingo FALSE Flamingo, Alice FALSE Flamingo, Jabberwock FALSE Flamingo, Flamingo TRUE

  13. Two quantifiers x,y Likes(x,y) Alice, Alice TRUE Alice, Jabberwock FALSE Alice, Flamingo TRUE Jabberwock, Alice FALSE Jabberwock, Jabberwock TRUE Jabberwock, Flamingo FALSE Flamingo, Alice FALSE Flamingo, Jabberwock FALSE Flamingo, Flamingo TRUE And we can quantify all the variables of a predicate e.g. ∀ x,y Likes(x,y) Everyone likes everyone False!

  14. Two quantifiers x,y Likes(x,y) Alice, Alice TRUE Alice, Jabberwock FALSE Alice, Flamingo TRUE Jabberwock, Alice FALSE Jabberwock, Jabberwock TRUE Jabberwock, Flamingo FALSE Flamingo, Alice FALSE Flamingo, Jabberwock FALSE Flamingo, Flamingo TRUE ∀ x ∃ y Likes(x,y) Order of Everyone likes someone (True) quantifiers ∃ y ∀ x Likes(x,y) is important! Someone is liked by everyone (False)

  15. Two quantifiers ∃ y Likes(x,y) 
 x y Likes(x,y) i.e., LikesSomeone(x) Alice TRUE Alice TRUE Jabberwock FALSE Flamingo TRUE Alice FALSE Jabberwock Jabberwock TRUE TRUE Flamingo FALSE Alice FALSE Jabberwock FALSE Flamingo TRUE Flamingo TRUE ∀ x ∃ y Likes(x,y) Everyone likes someone ∀ x LikesSomeone(x) True

  16. Two quantifiers ∃ y Likes(x,y) 
 x y Likes(x,y) i.e., LikesSomeone(x) Alice TRUE Alice TRUE Jabberwock FALSE Flamingo TRUE Alice FALSE Jabberwock Jabberwock TRUE TRUE Flamingo FALSE Alice FALSE Jabberwock FALSE Flamingo TRUE Flamingo TRUE ∃ x ¬( ∃ y Likes(x,y) ) ∀ x ∃ y Likes(x,y) Everyone likes someone ∀ x LikesSomeone(x) True

  17. Two quantifiers ∃ y Likes(x,y) 
 x y Likes(x,y) i.e., LikesSomeone(x) Alice TRUE Alice TRUE Jabberwock FALSE Flamingo TRUE Alice FALSE Jabberwock Jabberwock TRUE TRUE Flamingo FALSE Alice FALSE Jabberwock FALSE Flamingo TRUE Flamingo TRUE ∃ x ∀ y ¬Likes(x,y) ∀ x ∃ y Likes(x,y) Someone doesn’ t like anyone Everyone likes someone ∀ x LikesSomeone(x) ∃ x DoesntLikeAnyone(x) True False

  18. Two quantifiers x y Likes(x,y) Alice TRUE Alice Jabberwock FALSE Flamingo TRUE Alice FALSE Jabberwock Jabberwock TRUE Flamingo FALSE Alice FALSE Jabberwock FALSE Flamingo Flamingo TRUE ∃ y ∀ x Likes(x,y)

  19. Two quantifiers ∀ x Likes(x,y) 
 x y Likes(x,y) i.e., EveryoneLikes(y) Alice TRUE Alice FALSE Jabberwock FALSE Flamingo FALSE Alice FALSE Jabberwock Jabberwock TRUE FALSE Flamingo FALSE Alice TRUE Jabberwock FALSE Flamingo FALSE Flamingo TRUE ∃ y ∀ x Likes(x,y) ∀ y ∃ x ¬Likes(x,y) Someone is liked by Everyone is disliked everyone by someone False True

  20. Moving the Quantifiers ∀ x ∀ y P(x,y) ≡ ∀ y ∀ x P(x,y) for all pairs (x,y), P(x,y) holds ∃ x ∃ y P(x,y) ≡ ∃ y ∃ x P(x,y) for some pair (x,y), P(x,y) holds ∀ x P(x) ∨ R ≡ ( ∀ x P(x) ) ∨ R (where R is independent of x) R evaluates to True or False (indep of x) When R is True, both equivalent (to True) Scope of x extends to 
 Also, when R is False, both equivalent the end: ∀ x (P(x) ∨ R) Hence both equivalent i.e., if domain is {a 1 ,…,a N } 
 (P(a 1 ) ∨ R) ∧ … ∧ (P(a N ) ∨ R)

  21. Moving the Quantifiers ∀ x ∀ y P(x,y) ≡ ∀ y ∀ x P(x,y) for all pairs (x,y), P(x,y) holds ∃ x ∃ y P(x,y) ≡ ∃ y ∃ x P(x,y) for some pair (x,y), P(x,y) holds ∀ x P(x) ∨ R ≡ ( ∀ x P(x) ) ∨ R (where R is independent of x) ∀ x P(x) ∧ R ≡ ( ∀ x P(x) ) ∧ R 
 ∃ x P(x) ∨ R ≡ ( ∃ x P(x) ) ∨ R 
 ∃ x P(x) ∧ R ≡ ( ∃ x P(x) ) ∧ R ∀ x R → P(x) ≡ R → ( ∀ x P(x) ) 
 ∃ x R → P(x) ≡ R → ( ∃ x P(x) )

  22. 
 
 Question 3 ∀ x P(x) → R is equivalent to: 
 ∀ x ¬P(x) ∨ R 
 A. ( ∀ x P(x) ) → R ≡ ( ∀ x ¬P(x)) ∨ R 
 ≡ ¬ ( ∃ x P(x)) ∨ R B. ( ∃ x P(x) ) → R C. ( ∀ x P(x) ) ∨ R D. ( ∃ x P(x) ) ∨ R E. ( ∀ x P(x) ) ∧ R

  23. Moving the Quantifiers ∀ x ∀ y P(x,y) ≡ ∀ y ∀ x P(x,y) ∃ x ∃ y P(x,y) ≡ ∃ y ∃ x P(x,y) When R is independent of x 
 ∀ x P(x) ∨ R ≡ ( ∀ x P(x) ) ∨ R ∀ x P(x) ∧ R ≡ ( ∀ x P(x)) ∧ R 
 ∃ x P(x) ∨ R ≡ ( ∃ x P(x) ) ∨ R ∃ x P(x) ∧ R ≡ ( ∃ x P(x)) ∧ R 
 ∀ x R → P(x) ≡ R → ( ∀ x P(x)) ∃ x R → P(x) ≡ R → ( ∃ x P(x)) 
 ∀ x P(x) → R ≡ ( ∃ x P(x)) → R ∃ x P(x) → R ≡ ( ∀ x P(x)) → R 
 Not equivalent to! ( ∀ x P(x)) ∧ ( ∀ x Q(x)) ≡ ∀ x (P(x) ∧ Q(x)) But ( ∀ x P(x)) ∨ ( ∀ x Q(x)) ≢ ∀ x (P(x) ∨ Q(x)) ( ∃ x P(x)) ∨ ( ∃ x Q(x)) ≡ ∃ x (P(x) ∨ Q(x)) But ( ∃ x P(x)) ∧ ( ∃ x Q(x)) ≢ ∃ x (P(x) ∧ Q(x))

  24. Today Negating propositions (the looking glass) De Morgan’ s law When quantifiers are involved Multiple quantifiers Order of quantifiers matters Negation Moving quantifiers around

Recommend


More recommend