70 discrete math and probability instructor admin cs70
play

70: Discrete Math and Probability. Instructor/Admin CS70: Lecture - PowerPoint PPT Presentation

70: Discrete Math and Probability. Instructor/Admin CS70: Lecture 1. Outline. Instructor: Satish Rao. 17th year at Berkeley. Programming Computers Superpower! Today: Note 1. Note 0 is background. Do read/skim it. PhD: Long time ago, far


  1. 70: Discrete Math and Probability. Instructor/Admin CS70: Lecture 1. Outline. Instructor: Satish Rao. 17th year at Berkeley. Programming Computers ≡ Superpower! Today: Note 1. Note 0 is background. Do read/skim it. PhD: Long time ago, far far away. What are your super powerful programs doing? Research: Theory (Algorithms) The language of proofs! Logic and Proofs! Taught: 170, 174, 70, 375, ... Induction ≡ Recursion. 1. Propositions. Helicopter(ish) parent of 3 College(ish) kids. What can computers do? 2. Propositional Forms. Course Webpage: inst.cs.berkeley.edu/~cs70/fa15 Work with discrete objects. 3. Implication. Discrete Math = ⇒ immense application. Explains policies, has homework, midterm dates, etc. 4. Truth Tables Computers learn and interact with the world? Three midterms, final. 5. Quantifiers E.g. machine learning, data analysis. midterm 1 before drop date. 6. More De Morgan’s Laws Probability! midterm 2 before grade option change. See note 1, for more discussion. Questions = ⇒ piazza: piazza.com/berkeley/fall2015/cs70 Also: Available after class. Propositions: Statements that are true or false. Propositional Forms. Propositional Forms: quick check! Put propositions together to make another... √ 2 is irrational Proposition True Conjunction (“and”): P ∧ Q √ P = “ 2 is rational” 2+2 = 4 Proposition True “ P ∧ Q ” is True when both P and Q are True . Else False . Q = “826th digit of pi is 2” 2+2 = 3 Proposition False Disjunction (“or”): P ∨ Q 826th digit of pi is 4 Proposition False P is ...False . Johny Depp is a good actor Not a Proposition Q is ...True . “ P ∨ Q ” is True when at least one P or Q is True . Else False . All evens > 2 are sums of 2 primes Proposition False Negation (“not”): ¬ P 4 + 5 Not a Proposition. P ∧ Q ... False “ ¬ P ” is True when P is False . Else False . x + x Not a Proposition. P ∨ Q ... True Examples: ¬ “ ( 2 + 2 = 4 ) ” ¬ P ... True – a proposition that is ... False Again: “value” of a proposition is ... True or False “2 + 2 = 3” ∧ “2 + 2 = 4” – a proposition that is ... False “2 + 2 = 3” ∨ “2 + 2 = 4” – a proposition that is ... True

  2. Put them together.. Truth Tables for Propositional Forms. Implication. P Q P ∧ Q P Q P ∨ Q Propositions: T T T T T T P 1 - Person 1 rides the bus. T F F T F T P = ⇒ Q interpreted as F T F F T T P 2 - Person 2 rides the bus. F F F F F F .... If P , then Q . One use for truth tables: Logical Equivalence of propositional forms! But we can’t have either of the follwing happen; That either True Statements: P , P = ⇒ Q . person 1 or person 2 ride the bus and person 3 or 4 ride the Example: ¬ ( P ∧ Q ) logically equivalent to ¬ P ∨¬ Q Conclude: Q is true. bus. Or that person 2 or person 3 ride the bus and that either ...because the two propositional forms have the same... Example: Statement: If you stand in the rain, then you’ll get person 4 ride the bus or person 5 doesn’t. ....Truth Table! wet. Propositional Form: P Q ¬ ( P ∨ Q ) ¬ P ∧¬ Q P = “you stand in the rain” ¬ ((( P 1 ∨ P 2 ) ∧ ( P 3 ∨ P 4 )) ∨ (( P 2 ∨ P 3 ) ∧ ( P 4 ∨¬ P 5 ))) T T F F Q = “you will get wet” T F F F Who can ride the bus? Statement: “Stand in the rain” F T F F What combinatations of people can ride the bus? Can conclude: “you’ll get wet.” F F T T This seems ...complicated. DeMorgan’s Law’s for Negation: distribute and flip! We need a way to keep track! ¬ ( P ∧ Q ) ≡ ¬ P ∨¬ Q ¬ ( P ∨ Q ) ≡ ¬ P ∧¬ Q Non-Consequences/consequences of Implication Implication and English. Truth Table: implication. The statement “ P = ⇒ Q ” only is False if P is True and Q is False . False implies nothing P Q P = ⇒ Q P Q ¬ P ∨ Q P False means Q can be True or False P = ⇒ Q Anything implies true. T T T T T T ◮ If P , then Q . P can be True or False when Q is True T F F T F F ◮ Q if P . F T T F T T If chemical plant pollutes river, fish die. If fish die, did chemical plant polluted river? ◮ P only if Q . F F T F F T Not necessarily. ◮ P is sufficient for Q . ¬ P ∨ Q ≡ P = ⇒ Q . ◮ Q is necessary for P . P = ⇒ Q and Q are True does not mean P is True These two propositional forms are logically equivalent! Instead we have: P = ⇒ Q and P are True does mean Q is True . Be careful out there! Some Fun: use propositional formulas to describe implication? (( P = ⇒ Q ) ∧ P ) = ⇒ Q .

  3. Contrapositive, Converse Variables. Quantifiers.. ◮ Contrapositive of P = ⇒ Q is ¬ Q = ⇒ ¬ P . There exists quantifier: ◮ If the plant pollutes, fish die. Propositions? ( ∃ x ∈ S )( P ( x )) means ” P ( x ) is true for some x in S ” ◮ If the fish don’t die, the plant does not pollute. i = 1 i = n ( n + 1 ) ◮ ∑ n For example: (contrapositive) . 2 ( ∃ x ∈ N )( x = x 2 ) ◮ x > 2 ◮ If you stand in the rain, you get wet. Equivalent to “ ( 0 = 0 ) ∨ ( 1 = 1 ) ∨ ( 2 = 4 ) ∨ ... ” ◮ If you did not stand in the rain, you did not get wet. ◮ n is even and the sum of two primes (not contrapositive!) converse! Much shorter to use a quantifier! No. They have a free variable. ◮ If you did not get wet, you did not stand in the rain. For all quantifier; (contrapositive.) We call them predicates, e.g., Q ( x ) = “ x is even” ( ∀ x ∈ S ) ( P ( x )) . means “For all x in S P(x) is True .” Logically equivalent! Notation: ≡ . Same as boolean valued functions from 61A or 61AS! Examples: P = ⇒ Q ≡ ¬ P ∨ Q ≡ ¬ ( ¬ Q ) ∨¬ P ≡ ¬ Q = ⇒ ¬ P . i = 1 i = n ( n + 1 ) ◮ P ( n ) = “ ∑ n . ” “Adding 1 makes a bigger number.” ◮ Converse of P = 2 ⇒ Q is Q = ⇒ P . ◮ R ( x ) = “ x > 2” ∀ ( x ∈ N ) ( x + 1 > x ) If fish die the plant pollutes. ◮ G ( n ) = “ n is even and the sum of two primes” Not logically equivalent! ”the square of a number is always non-negative” ◮ Definition: If P = ⇒ Q and Q = ⇒ P is P if and only if Q Next: Statements about boolean valued functions!! ( ∀ x ∈ N )( x 2 > = 0 ) or P ⇐ ⇒ Q . Wait! What is N ? (Logically Equivalent: ⇐ ⇒ . ) Quantifiers: universes. More for all quantifiers examples. Quantifiers..not commutative. ◮ ”doubling a number always makes it larger” ◮ In English: ”there is a natural number that is the square of ( ∀ x ∈ N ) ( 2 x > x ) False Consider x = 0 Proposition: “For all natural numbers n , ∑ n i = 1 i = n ( n + 1 ) every natural number”, i.e the square of every natural . ” 2 number is the same number! Proposition has universe : “the natural numbers”. Can fix statement... Universe examples include.. ( ∃ y ∈ N ) ( ∀ x ∈ N ) ( y = x 2 ) False ( ∀ x ∈ N ) ( 2 x > = x ) True ◮ N = { 0 , 1 ,... } (natural numbers). ◮ Z = { ..., − 1 , 0 ,... } (integers) ◮ In English: ”the square of every natural number is a natural ◮ Z + (positive integers) ◮ ”Square of any natural number greater than 5 is greater number”... ◮ See note 0 for more! than 25.” ( ∀ x ∈ N )( ∃ y ∈ N ) ( y = x 2 ) True ⇒ x 2 > 25 ) . ( ∀ x ∈ N )( x > 5 = Idea alert: Restrict domain using implication. Note that we may omit universe if clear from context.

  4. Quantifiers....negation...DeMorgan again. Negation of exists. Which Theorem? Consider ¬ ( ∀ x ∈ S )( P ( x )) , ⇒ a n + b n = c n ) Theorem: ( ∀ n ∈ N ) ¬ ( ∃ a , b , c ∈ N ) ( n > 3 = English: there is an x in S where P ( x ) does not hold. Which Theorem? Consider That is, Fermat’s Last Theorem! ¬ ( ∃ x ∈ S )( P ( x )) Remember Special Triangles: for n = 2, we have 3,4,5 and 5,7, ¬ ( ∀ x ∈ S )( P ( x )) ⇐ ⇒ ∃ ( x ∈ S )( ¬ P ( x )) . English: means that for all x in S , P ( x ) does not hold. 12 and ... What we do in this course! We consider claims. That is, 1637: Proof doesn’t fit in the margins. Claim: ( ∀ x ) P ( x ) “For all inputs x the program works.” ¬ ( ∃ x ∈ S )( P ( x )) ⇐ ⇒ ∀ ( x ∈ S ) ¬ P ( x ) . 1993: Wiles ...(based in part on Ribet’s Theorem) For False , find x , where ¬ P ( x ) . DeMorgan Restatement: Counterexample. ⇒ a n + b n = c n ) Theorem: ¬ ( ∃ n ∈ N ) ( ∃ a , b , c ∈ N ) ( n > 3 = Bad input. Case that illustrates bug. For True : prove claim. Next lectures... Summary. Propositions are statements that are true or false. Proprositional forms use ∧ , ∨ , ¬ . Propositional forms correspond by truth tables. Logical equivalence of forms means same truth tables. Implication: P = ⇒ Q ⇐ ⇒ P ∨ Q . Contrapositive: ¬ Q = ⇒ ¬ P Converse: Q = ⇒ P Predicates: Statements with “free” variables. Quantifiers: ∀ x P ( x ) , ∃ y Q ( y ) Now can state theorems! And disprove false ones! DeMorgans Laws: “Flip and Distribute negation” ¬ ( P ∨ Q ) ⇐ ⇒ ( ¬ P ∧¬ Q ) ¬∀ x P ( x ) ⇐ ⇒ ∃ x ¬ P ( x ) . Next Time: proofs!

Recommend


More recommend