Announcement I made a few small changes to the course calendar No class on Wed eb 27 th, watch the video lecture Quiz 8 will take place on Monday April 15 th We will submit assignments using Gradescope Invite Code: 9DK28Y 1Extensible - CSE 240 Logic Networking and Discrete Platform Mathematics 1 Homework 1 Problems due next Monday Jan. 28 th Quiz 1 Wednesday Jan 30 th I will choose one problem from the set of six questions 2Extensible - CSE 240 Logic Networking and Discrete Platform Mathematics 2
Reading Read Sections 1.4(Predicates and Quantifiers) and 1.5 (Nested Quantifiers) 3Extensible - CSE 240 Logic Networking and Discrete Platform Mathematics 3 Precedence of Operators rom the table we can see that the negation operator has a higher precedence than the conjunction operator 4Extensible - CSE 240 Logic Networking and Discrete Platform Mathematics 4
Propositional Logic (Section 1) Proofs involve stepping through a mathematical argument Propositional Logic provides such steps oday we will discuss the process of moving from one proposition to the next to form a mathematical argument 5Extensible - CSE 240 Logic Networking and Discrete Platform Mathematics 5 Logical Equivalence Challenge: ry to find a proposition that is equivalent to p q, but that uses only the connectives, Ù, and Ú p q p q p q p p v q p q is logically equivalent to p Ú q or p q º p Ú q 6Extensible - CSE 240 Logic Networking and Discrete Platform Mathematics 6
Are these equivalent? Contrapositives: p q and q p Ex. If it is noon, then I am hungry. If I am not hungry, then it is not noon. Converses: p q and q p Ex. If it is noon, then I am hungry. If I am hungry, then it is noon. Inverses: p q and p q Ex. If it is noon, then I am hungry. If it is not noon, then I am not hungry. Let s take a vote 7Extensible - CSE 240 Logic Networking and Discrete Platform Mathematics 7 Are these equivalent? Contrapositives: p q º q p? Ex. If it is noon, then I am hungry. If I am not hungry, then it is not noon. Converses: p q º q p? Ex. If it is noon, then I am hungry. If I am hungry, then it is noon. Inverses: p q º p q? Ex. If it is noon, then I am hungry. If it is not noon, then I am not hungry. YES NO NO 8Extensible - CSE 240 Logic Networking and Discrete Platform Mathematics 8
Definitions A tautology is a proposition that s always RUE. A contradiction is a proposition that s always ALSE. p p p Ú p p Ù p 9Extensible - CSE 240 Logic Networking and Discrete Platform Mathematics 9 Logical Equivalences Identity Domination Idempotent p Ù º p p Ú º p p Ú º p Ù º p Ú p º p p Ù p º p p p Ù 10Extensible - CSE 240 Logic Networking and Discrete Platform Mathematics 10
Logical Equivalences Continued Excluded Middle p Ú p º Uniqueness p Ù p º Double negation ( p) º p 11Extensible - CSE 240 Logic Networking and Discrete Platform Mathematics 11 Logical Equivalences Continued Commutativity p Ú q º p Ù q º q Ú p q Ù p Associativity (p Ú q) Ú r º (p Ù q) Ù r º p Ú (q Ú r) p Ù (q Ù r) Distributivity p Ú (q Ù r) º p Ù (q Ú r) º (p Ú q) Ù (p Ú r) (p Ù q) Ú (p Ù r) 12Extensible - CSE 240 Logic Networking and Discrete Platform Mathematics 12
Proof of Distributivity p Ú (q Ù r) º (p Ú q) Ù (p Ú r) p q r q Ù r p Ú (q Ù r) p Ú q p Ú r (p Ú q) Ù (p Ú r) 13Extensible - CSE 240 Logic Networking and Discrete Platform Mathematics 13 DeMorgan s De Morgan s I (p Ú q) º p Ù q De Morgan s II (p Ù q) º p Ú q 14Extensible - CSE 240 Logic Networking and Discrete Platform Mathematics 14
Example of De Morgan s (p Ú q) º p Ù q (p Ù q) º p Ú q p q 15Extensible - CSE 240 Logic Networking and Discrete Platform Mathematics 15 De Morgan s Continued De Morgan s II (p Ù q) º p Ú q (p Ù q) º ( p Ù q) Double negation º ( p Ú q) DeMorgan s I º ( p Ú q) Double negation 16Extensible - CSE 240 Logic Networking and Discrete Platform Mathematics 16
Proof equivalence if NO (blue AND NO red) OR red then (p Ù q) Ú q º p Ú q (p Ù q) Ú q º ( p Ú q) Ú q De Morgan s II º ( p Ú q) Ú q Double negation º p Ú (q Ú q) Associativity º p Ú q Idempotent 17Extensible - CSE 240 Logic Networking and Discrete Platform Mathematics 17 Another Example Show that [p Ù (p q)] q is a tautology We use º to show that [p Ù (p q)] q º [p Ù (p q)] q º [p Ù ( p Ú q)] q º [(p Ù p) Ú (p Ù q)] q º [ Ú (p Ù q)] q º (p Ù q) q º (p Ù q) Ú q º ( p Ú q) Ú q º p Ú ( q Ú q ) º p Ú º substitution for distributive uniqueness identity substitution for De Morgan s II associative excluded middle domination 18Extensible - CSE 240 Logic Networking and Discrete Platform Mathematics 18
Another Example Consider the newspaper headline: Legislature ails to Override Governor s Veto of Bill to Cancel Sales ax Reform Did the legislature vote in favor of or against the sales tax reform? 19Extensible - CSE 240 Logic Networking and Discrete Platform Mathematics 19 Another Example Consider the newspaper headline: Legislature ails to Override Governor s Veto of Bill to Cancel Sales ax Reform Did the legislature vote in favor of or against the sales tax reform? Let s take a vote A) he legislature DID vote in favor B) he legislature DID NO vote in favor 20Extensible - CSE 240 Logic Networking and Discrete Platform Mathematics 20
Another Example Consider the newspaper headline: Legislature ails to Override Governor s Veto of Bill to Cancel Sales ax Reform Did the legislature vote in favor of or against the sales tax reform? Let s stand for sales tax reform Unravel one at a time. -he bill to cancel sales tax reform is s -he governors veto of the bill is s -Overriding this means s -he double negation cancel out, leaving just s herefore the legislature does not support sales tax reform. hey voted in favor of the bill (to cancel it). 21Extensible - CSE 240 Logic Networking and Discrete Platform Mathematics 21 Group Exercise I Break up into groups of 2 or 3 people Solve the following problem: Prove De Morgan s I Law by manipulating symbols (not a truth table) (p Ú q) º p Ù q Hint- Similar to the proof of De Morgan s II Law Reminder DeMorgan s II (p Ù q) º p Ú q 22Extensible - CSE 240 Logic Networking and Discrete Platform Mathematics 22
Predicate Logic Proposition, YES or NO? 3 + 2 = 5 Yes X + 2 = 5 No X + 2 = 5 for all choices of X in {1, 2, 3} X + 2 = 5 for some choice of X in {1, 2, 3} Yes Yes 23Extensible - CSE 240 Logic Networking and Discrete Platform Mathematics 23 Predicates Alicia eats pizza at least once a week. Define: EP(x) = x eats pizza at least once a week. Universe of Discourse - x is a student in cs240 A predicate, or propositional function, is a function that takes some variable(s) as arguments and returns rue or alse. Note that EP(x) is not a proposition, EP(Ariel) is. 24Extensible - CSE 240 Logic Networking and Discrete Platform Mathematics 24
Predicates Suppose Q(x,y) = x > y Proposition, YES or NO? Q(x,y) No Q(3,4) Yes Q(x,9) Predicate, YES or NO? No Q(x,y) Yes Q(3,4) No Q(x,9) Yes 25Extensible - CSE 240 Logic Networking and Discrete Platform Mathematics 25 Universal Quantifier Another way of changing a predicate into a proposition. Suppose P(x) is a predicate on some universe of discourse. Ex. B(x) = x is carrying a backpack, x is set of cs240 students. he universal quantifier of P(x) is the proposition: P(x) is true for all x in the universe of discourse. We write it "x P(x), and say for all x, P(x) "x P(x) is RUE if P(x) is true for every single x. "x P(x) is ALSE if there is an x for which P(x) is false. "x B(x)? What is this asking? Is it true or false? 26Extensible - CSE 240 Logic Networking and Discrete Platform Mathematics 26
Universal Quantifier Universe of discourse is people in this room. B(x) = x is enrolled in CS240. L(x) = x is signed up for at least one class. Y(x)= x is wearing sneakers. Are either of these propositions true? a) "x (B(x) Y(x)) b) "x (Y(x) Ú L(x)) What does this proposition mean? "x (Y(x) Ù B(x)) A: only a is true B: only b is true C: both are true D: neither is true Is it true? 27Extensible - CSE 240 Logic Networking and Discrete Platform Mathematics 27 Existential Quantifier Another way of changing a predicate into a proposition. Suppose P(x) is a predicate on some universe of discourse. Ex. C(x) = x has a candy bar, x is the set of cs240 students. he existential quantifier of P(x) is the proposition: P(x) is true for some x in the universe of discourse. We write it $x P(x), and say for some x, P(x) $x P(x) is RUE if there is an x for which P(x) is true. $x P(x) is ALSE if P(x) is false for every single x. $x C(x)? What is this asking? Is it true or false? 28Extensible - CSE 240 Logic Networking and Discrete Platform Mathematics 28
Existential Quantifier B(x) = x is enrolled in CS240. L(x) = x is signed up for at least one class. Universe of discourse is people in this room. Are either of these propositions true? a) $x B(x) b) $x (B(x) Ù L(x)) What does this proposition mean? $ x (B(x) L(x)) Why do I have to be careful with this proposition? A: only a is true B: only b is true C: both are true D: neither is true 29Extensible - CSE 240 Logic Networking and Discrete Platform Mathematics 29 Predicate Examples L(x) = x is a lion. (x) = x is fierce. C(x) = x drinks coffee. All lions are fierce. Universe of discourse is all creatures. "x (L(x) (x)) Some lions don t drink coffee. $x (L(x) Ù C(x)) Some fierce creatures don t drink coffee. $x ((x) Ù C(x)) 30Extensible - CSE 240 Logic Networking and Discrete Platform Mathematics 30
More Examples B(x) = x is a hummingbird. L(x) = x is a large bird. H(x) = x lives on honey. R(x) = x is richly colored. Universe of discourse is all birds. All hummingbirds are richly colored. No large birds live on honey. Birds that do not live on honey are dully colored. "x (B(x) R(x)) $x (L(x) Ù H(x)) "x ( H(x) R(x)) 31Extensible - CSE 240 Logic Networking and Discrete Platform Mathematics 31 More Examples S(x) = x is a student in this class. C(x) = x has visited Chicago. Universe of discourse is all people. "x (S(x) Ù C(x)) "x (S(x) C(x)) All people are students in this class and all people have visited Chicago All students in this class have visited Chicago $x (S(x) C(x))? $x (S(x) Ù C(x)) Some student in this class has visited Chicago 32Extensible - CSE 240 Logic Networking and Discrete Platform Mathematics 32
Quantifier Negation Not all large birds live on honey. "x (L(x) H(x)) "x P(x) means P(x) is true for every x. What about "x P(x)? Not [ P(x) is true for every x. ] here is an x for which P(x) is not true. $x P(x) So, "x P(x) is the same as $x P(x). $x (L(x) H(x)) 33Extensible - CSE 240 Logic Networking and Discrete Platform Mathematics 33 Quantifier Negation No large birds live on honey. $x (L(x) Ù H(x)) $x P(x) means P(x) is true for some x. What about $x P(x)? Not [ P(x) is true for some x. ] P(x) is not true for all x. "x P(x) So, $x P(x) is the same as "x P(x). "x (L(x) Ù H(x)) 34Extensible - CSE 240 Logic Networking and Discrete Platform Mathematics 34
Quantifier Negation So, "x P(x) is the same as $x P(x). So, $x P(x) is the same as "x P(x). General rule: to negate a quantifier, move negation to the right, changing quantifiers as you go. 35Extensible - CSE 240 Logic Networking and Discrete Platform Mathematics 35