70: Discrete Math and Probability Theory The Truth about CS70 Satish Rao Programming + Microprocessors ≡ Superpower! ...according to me. What are your super powerful programs/processors doing? It’s transformative. 21st year at Berkeley. Logic and Proofs! PhD: Long time ago, far far away. Programming is a superpower. Induction ≡ Recursion. Research: Theory (Algorithms) Reasoning is perhaps even better. What can computers do? Taught in CS: 70, 170, 174, 188, 270, 273, 294, 375, ... Work with discrete objects. Each Topic: Other: Three adult kids. One Cal Grad! Discrete Math = ⇒ immense application. Define, understand, and build. Lecturing Style: I have used slides. Computers learn and interact with the world? Clearly and correctly. E.g. machine learning, data analysis, robotics, ... Probability! Rate of Change + Newton –¿ Calculus. See Professor Sahai’s note under Resources, for more discussion. Why I use Slides and some Advice. Admin Wason’s experiment:1 Lots of arguments are demonstrated well by examples or verbal explanations, but sometimes painful to write down, which works for Suppose we have four cards on a table: me with slides. Course Webpage: http://www.eecs70.org/ ◮ 1st about Alice, 2nd about Bob, 3rd Charlie, 4th Donna. (1) Is there value for you to watch me write on screen or paper? Explains policies, has office hours, homework, midterm dates, etc. ◮ Card contains person’s destination on one side, (2) You have them! One midterm, final. and mode of travel. Use the slides to guide you. midterm. ◮ Consider the theory: Handout Version: for getting landscape. Questions = ⇒ piazza: “If a person travels to Chicago, he/she flies.” Slide Version: for detailed understanding. Logistics, etc. ◮ Suppose you see that Alice went to Baltimore, Bob drove, It is easier to present more. Content Support: other students! Charlie went to Chicago, and Donna flew. Plus Piazza hours. “More” is overview, connections, insights, some jokes (breaks), the details. Weekly Post. Alice Bob Charlie Donna Risk: Students get frustrated at not understanding everything. It’s weekly. Baltimore drove Chicago flew Read it!!!! The truth: Students don’t understand everything. Announcements, logistics, critical advice. ◮ Which cards must you flip to test the theory? I certainly don’t in real time or sometimes ever. It is ok: many levels to grok. Lecture is one pass. Answer: Later. Notes are sufficient.

CS70: Lecture 1. Outline. Propositions: Statements that are true or false. Propositional Forms. √ Put propositions together to make another... 2 is irrational Proposition True Today: Note 1. Note 0 is background. Do read it. Conjunction (“and”): P ∧ Q 2+2 = 4 Proposition True 2+2 = 3 Proposition False The language of proofs! “ P ∧ Q ” is True when both P and Q are True . Else False . 826th digit of pi is 4 Proposition False Disjunction (“or”): P ∨ Q Johnny Depp is a good actor Not Proposition 1. Propositions. Any even > 2 is sum of 2 primes Proposition False “ P ∨ Q ” is True when at least one P or Q is True . Else False . 2. Propositional Forms. 4 + 5 Not Proposition. Negation (“not”): ¬ P x + x 3. Implication. Not a Proposition. “ ¬ P ” is True when P is False . Else False . Alice travelled to Chicago Proposition. False 4. Truth Tables I love you. Hmmm. Its complicated. Examples: 5. Quantifiers ¬ “ ( 2 + 2 = 4 ) ” – a proposition that is ... False 6. More De Morgan’s Laws “2 + 2 = 3” ∧ “2 + 2 = 4” – a proposition that is ... False Again: “value” of a proposition is ... True or False “2 + 2 = 3” ∨ “2 + 2 = 4” – a proposition that is ... True Propositional Forms: quick check! Put them together.. Truth Tables for Propositional Forms. “ P ∧ Q ” is True when “ P ∨ Q ” is True when both P and Q are True . ≥ one of P or Q is True . Propositions: P 1 - Person 1 rides the bus. P Q P ∧ Q P Q P ∨ Q P 2 - Person 2 rides the bus. √ T T T T T T P = “ 2 is rational” .... T F F T F T Q = “826th digit of pi is 2” F T F But we can’t have either of the following happen; That either person 1 F T T F F F F F F P is ...False . or person 2 ride the bus and person 3 or 4 ride the bus. Or that Q is ...True . person 2 or person 3 ride the bus and that either person 4 rides the Check: ∧ and ∨ are commutative. bus or person 5 doesn’t. One use for truth tables: Logical Equivalence of propositional forms! Example: ¬ ( P ∧ Q ) logically equivalent to ¬ P ∨¬ Q . Same Truth Propositional Form: P ∧ Q ... False ∧ True → False Table! ¬ ((( P 1 ∨ P 2 ) ∧ ( P 3 ∨ P 4 )) ∨ (( P 2 ∨ P 3 ) ∧ ( P 4 ∨¬ P 5 ))) P ∨ Q ... False ∨ True → True P Q ¬ ( P ∨ Q ) ¬ P ∧¬ Q Can person 3 ride the bus? ¬ P ... ¬ False → True T T F F Can person 3 and person 4 ride the bus together? T F F F This seems ...complicated. F T F F We can program!!!! F F T T We need a way to keep track! DeMorgan’s Law’s for Negation: distribute and flip! ¬ ( P ∧ Q ) ≡ ¬ P ∨¬ Q ¬ ( P ∨ Q ) ≡ ¬ P ∧¬ Q

Quick Questions Distributive? Implication. P ∧ ( Q ∨ R ) ≡ ( P ∧ Q ) ∨ ( P ∧ R ) ? P = ⇒ Q interpreted as Simplify: ( T ∧ Q ) ≡ Q , ( F ∧ Q ) ≡ F . If P , then Q . P Q P ∧ Q P Q P ∨ Q Cases: T T T T T T True Statements: P , P = ⇒ Q . P is True . T F F T F T Conclude: Q is true. LHS: T ∧ ( Q ∨ R ) ≡ ( Q ∨ R ) . F T F F T T RHS: ( T ∧ Q ) ∨ ( T ∧ R ) ≡ ( Q ∨ R ) . Examples: F F F F F F P is False . Statement: If you stand in the rain, then you’ll get wet. Is ( T ∧ Q ) ≡ Q ? Yes? No? LHS: F ∧ ( Q ∨ R ) ≡ F . P = “you stand in the rain” RHS: ( F ∧ Q ) ∨ ( F ∧ R ) ≡ ( F ∨ F ) ≡ F . Yes! Look at rows in truth table for P = T . Q = “you will get wet” What is ( F ∧ Q ) ? F or False. P ∨ ( Q ∧ R ) ≡ ( P ∨ Q ) ∧ ( P ∨ R ) ? Statement: “Stand in the rain” Can conclude: “you’ll get wet.” Simplify: T ∨ Q ≡ T , F ∨ Q ≡ Q . ... What is ( T ∨ Q ) ? T Statement: Foil 1: What is ( F ∨ Q ) ? Q If a right triangle has sidelengths a ≤ b ≤ c , then a 2 + b 2 = c 2 . ( A ∨ B ) ∧ ( C ∨ D ) ≡ ( A ∧ C ) ∨ ( A ∧ D ) ∨ ( B ∧ C ) ∨ ( B ∧ D ) ? P = “a right triangle has sidelengths a ≤ b ≤ c ”, Foil 2: Q = “ a 2 + b 2 = c 2 ”. ( A ∧ B ) ∨ ( C ∧ D ) ≡ ( A ∨ C ) ∧ ( A ∨ D ) ∧ ( B ∨ C ) ∧ ( B ∨ D ) ? Non-Consequences/consequences of Implication Implication and English. Truth Table: implication. The statement “ P = ⇒ Q ” P = ⇒ Q only is False if P is True and Q is False . ◮ If P , then Q . False implies nothing ◮ Q if P . P False means Q can be True or False Just reversing the order. P Q P = ⇒ Q P Q ¬ P ∨ Q Anything implies true. T T T T T T ◮ P only if Q . P can be True or False when Q is True T F F T F F Remember if P is true then Q must be true. If chemical plant pollutes river, fish die. F T T F T T this suggests that P can only be true if Q is true. If fish die, did chemical plant pollute river? F F T F F T since if Q is false P must have been false. Not necessarily. ◮ P is sufficient for Q . ¬ P ∨ Q ≡ P = ⇒ Q . P = ⇒ Q and Q are True does not mean P is True This means that proving P allows you These two propositional forms are logically equivalent! to conclude that Q is true. Be careful! Example: Showing n > 4 is sufficient for showing n > 3. Instead we have: ◮ Q is necessary for P . P = ⇒ Q and P are True does mean Q is True . For P to be true it is necessary that Q is true. The chemical plant pollutes river. Can we conclude fish die? Or if Q is false then we know that P is false. Some Fun: use propositional formulas to describe implication? Example: It is necessary that n > 3 for n > 4. (( P = ⇒ Q ) ∧ P ) = ⇒ Q .

Recommend

More recommend