CSE390D Notes for Friday, 9/27/24

Predicate logic is like methods that take arguments and return a boolean result For example, given: odd(x) means "x is odd" even(x) means "x is even" We can use predicates with constants: odd(5) ^ ~even(22) odd(4) -> even(19) More often we use variables: odd(x) -> ~even(x) Variables need to be bound to make a proposition. So bind them to constants: odd(x) -> ~even(x) for x = 17 or bind them with quantifiers: (all x) (odd(x) -> ~even(x)) Is this a true statement? Depends. What is the domain? Does it include things other than integers? Can people be odd? Might have to say something like: (all x) (integer(x) ^ odd(x) -> ~even(x)) Two different quantifiers: universal: (all x), "for all x" existential: (exists x), "there exists an x" What about negation? More DeMorgan's Laws: ~(all x) P(x) <--> (exists x) ~P(x) ~(exists x) P(x) <--> (all x) ~P(x) ------------------------------------------------------------------------------- Programming analogy for quantifiers: Is it true that "All unicorns are President of the United States?" need domain: all living things on Earth answer? maybe...not clear Think of "(all x) P(x)" as boolean method with this pseudocode: for (d : domain) { if (!P(d)) return false; } return true; Then unicorn answer is clear: true (vacuously true) Think of "(exists x) P(x)" as boolean method with this pseudocode: for (d : domain) { if (P(d)) return true; } return false; ------------------------------------------------------------------------------- Aristotelian forms: All P's are Q's: All men are mortal. (all x) (P(x) -> Q(x)) ~(exists x) (P(x) ^ ~Q(x)) bad: (all x) (P(x) ^ Q(x)) Some P's are Q's: Some cars are green. (exists x) (P(x) ^ Q(x)) ~(all x) (P(x) -> ~Q(x)) bad: (exists x) (P(x) -> Q(x)) No P's are Q's: No strawberries are blue. (all x) (P(x) -> ~Q(x)) ~(exists x) (P(x) ^ Q(x)) Some P's are not Q's: Some cars are not green. (exists x) (P(x) ^ ~Q(x)) ~(all x) (P(x) -> Q(x)) ------------------------------------------------------------ Practice: P(x): x is a professor I(x): x is ignorant V(x): x is vain No professors are ignorant (all x) (P(x) -> ~I(x)) All ignorant people are vain (all x) (I(x) -> V(x)) No professors are vain (all x) (P(x) -> ~V(x)) ------------------------------------------------------------ S(x): x is a student in this class C(x): x has visited Canada M(x): x has visited Mexico Some student in this class has visited Mexico: (exists x) (S(x) ^ M(x)) Every student in the class has visited Canada or Mexico (all x) (S(x) -> (C(x) v M(x)))
Stuart Reges
Last modified: Mon Sep 30 10:58:21 PDT 2024