25c8c011700b0d21931386684ee7c1af.ppt
- Количество слайдов: 56
Course Summary CS 202 Aaron Bloomfield 1
Outline A review of the proof methods gone over in class Interspersed with the most demotivators from CS 101 popular Course summary 2
Demotivator winners! n Methodology – 1 st place vote counted for 3 points – 2 nd place vote counted for 2 points – 3 rd place vote counted for 1 point n Have not tallied the Toolkit ones yet – I won’t get those for a few weeks n Will then buy two demotivators and hang them in my office… 3
Proof methods learned so far Logical equivalences n n via truth tables via logical equivalences Set equivalences n n via membership tables via set identities via mutual subset proof via set builder notation and logical equivalences Ten proof methods in section 1. 5: n n n n Rules of inference n n for propositions for quantified statements Constructive Non-constructive n n Pigeonhole principle Combinatorial proofs Direct proofs Indirect proofs Vacuous proofs Trivial proofs Proof by contradiction Proof by cases Proofs of equivalence Existence proofs Uniqueness proofs Counterexamples Induction n Weak mathematical induction Strong mathematical induction Structural induction 4
Using Logical Equivalences Original statement Definition of implication De. Morgan’s Law Associativity of Or Re-arranging Idempotent Law 5
In 12 th place (11 votes) 6
Set equivalences (§ 1. 7) Prove that A∩B=B-(B-A) Definition of difference De. Morgan’s law Complementation law Distributive law Complement law Identity law Commutative law 7
Proof by set builder notation and logical equivalences 2 Original statement Definition of difference Negating “element of” Definition of difference De. Morgan’s Law Distributive Law Negating “element of” Negation Law Identity Law Definition of intersection 8
In 11 th place (1/3) (12 votes) 9
Rules of inference (§ 1. 5) Example 6 of Rosen, section 1. 5 We have the hypotheses: p q n n r s t n n “It is not sunny this afternoon and it “It is colder than yesterday” “We will go swimming only if it is sunny” “If we do not go swimming, then we swimming, will take a canoe trip” “If we take a canoe trip, then we will trip, be home by sunset” Does this imply that “we will be “we home by sunset”? ¬p q r→p ¬r → s s→t t 10
Rules of inference (§ 1. 5) 1. 2. 3. 4. 5. 6. 7. 8. ¬p q ¬p r→p ¬r ¬r → s s s→t t 1 st hypothesis Simplification using step 1 2 nd hypothesis Modus tollens using steps 2 & 3 3 rd hypothesis Modus ponens using steps 4 & 5 4 th hypothesis Modus ponens using steps 6 & 7 11
In 11 th place (2/3) (12 votes) 12
Rules of inference (§ 1. 5) Rosen, section 1. 5, question 10 a Given the hypotheses: n n “Linda, a student in this class, owns a red convertible. ” “Everybody who owns a red convertible has gotten at least one speeding ticket” Can you conclude: “Somebody in this class has gotten a speeding ticket”? C(Linda) R(Linda) x (R(x)→T(x)) x (C(x) T(x)) 13
Rules of inference (§ 1. 5) 1. 2. 3. 4. 5. 6. 7. x (R(x)→T(x)) R(Linda) → T(Linda) R(Linda) T(Linda) C(Linda) T(Linda) x (C(x) T(x)) 3 rd hypothesis Universal instantiation using step 1 2 nd hypothesis Modes ponens using steps 2 & 3 1 st hypothesis Conjunction using steps 4 & 5 Existentialgeneralizationusing step 6 Thus, we have shown that “Somebody in this class has gotten a speeding ticket” 14
In 11 th place (3/3) (12 votes) 15
Proof methods (§ 1. 5) Ten proof methods: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. Direct proofs Indirect proofs Vacuous proofs Trivial proofs Proof by contradiction Proof by cases Proofs of equivalence Existence proofs Uniqueness proofs Counterexamples 16
In 10 th place (1/5) (13 votes) 17
Direct proof example Rosen, section 1. 5, question 20 n n Show that the square of an even number is an even number Rephrased: if n is even, then n 2 is even Assume n is even n Thus, n = 2 k, for some k (definition of even numbers) n 2 = (2 k)2 = 4 k 2 = 2(2 k 2) As n 2 is 2 times an integer, n 2 is thus even 18
Indirect proof example If n 2 is an odd integer then n is an odd integer Prove the contrapositive: If n is an even integer, then n 2 is an even integer Proof: n=2 k for some integer k (definition of even numbers) n 2 = (2 k)2 = 4 k 2 = 2(2 k 2) Since n 2 is 2 times an integer, it is even 19
In 10 th place (2/5) (13 votes) 20
Proof by contradiction Given a statement p, assume it is false n Assume ¬p Prove that ¬p cannot occur n A contradiction exists Given a statement of the form p→q n To assume it’s false, you only have to consider the case where p is true and q is false 21
Proof by contradiction Theorem (by Euclid): There are infinitely many prime numbers. Proof. Assume there a finite number of primes List them as follows: p 1, p 2 …, pn. Consider the number q = p 1 p 2 … pn + 1 n This number is not divisible by any of the listed primes If we divided pi into q, there would result a remainder of 1 n We must conclude that q is a prime number, not among the primes listed above This contradicts our assumption that all primes are in the list p 1, p 2 …, pn. 22
Proof by contradiction example 2 Rosen, section 1. 5, question 21 (b) n Prove that if n is an integer and n 3+5 is odd, then n is even n Rephrased: If n 3+5 is odd, then n is even Thus, p is “n 3+5” is odd, q is “n is even” Assume p and q n Assume that n 3+5 is odd, and n is odd Since n is odd: n n=2 k+1 for some integer k (definition of odd numbers) n n 3+5 = (2 k+1)3+5 = 8 k 3+12 k 2+6 k+6 = 2(4 k 3+6 k 2+3 k+3) n As n 3+5 = 2(4 k 3+6 k 2+3 k+3) is 2 times an integer, n must be even n Thus, we have concluded q Contradiction! n n We assumed q was false, and showed that this assumption implies that q must be true As q cannot be both true and false, we have reached our contradiction 23
In 10 th place (3/5) (13 votes) 24
Vacuous proof example When the antecedent is false Consider the statement: n n All criminology majors in CS 202 are female Rephrased: If you are a criminology major and you are in CS 202, then you are female Could also use quantifiers! Since there are no criminology majors in this class, the antecedent is false, and the implication is true 25
Trivial proof example When the consequence is true Consider the statement: n If you are tall and are in CS 202 then you are a student Since all people in CS 202 are students, the implication is true regardless 26
Proof by cases example Prove that n Note that b ≠ 0 Cases: n Case 1: a ≥ 0 and b > 0 Then |a| = a, |b| = b, and n Case 2: a ≥ 0 and b < 0 Then |a| = a, |b| = -b, and n Case 3: a < 0 and b > 0 Then |a| = -a, |b| = b, and n Case 4: a < 0 and b < 0 Then |a| = -a, |b| = -b, and 27
In 10 th place (4/5) (13 votes) 28
Proofs of equivalence example Rosen, section 1. 5, question 40 n n Show that m 2=n 2 if and only if m=n or m=-n Rephrased: (m 2=n 2) ↔ [(m=n) (m=-n)] Need to prove two parts: n [(m=n) (m=-n)] → (m 2=n 2) Proof by cases! Case 1: (m=n) → (m 2=n 2) n (m)2 = m 2, and (n)2 = n 2, so this case is proven Case 2: (m=-n) → (m 2=n 2) n n (m)2 = m 2, and (-n)2 = n 2, so this case is proven (m 2=n 2) → [(m=n) (m=-n)] Subtract n 2 from both sides to get m 2 -n 2=0 Factor to get (m+n)(m-n) = 0 Since that equals zero, one of the factors must be zero Thus, either m+n=0 (which means m=n) Or m-n=0 (which means m=-n) 29
In 10 th place (5/5) (13 votes) 30
Constructive existence proof example Show that a square exists that is the sum of two other squares n Proof: 32 + 42 = 52 Show that a cube exists that is the sum of three other cubes n Proof: 33 + 43 + 53 = 63 31
Non-constructive existence proof example Rosen, section 1. 5, question 50 Prove that either 2*10500+15 or 2*10500+16 is not a perfect square n n A perfect square is a square of an integer Rephrased: Show that a non-perfect square exists in the set {2*10500+15, 2*10500+16} Proof: The only two perfect squares that differ by 1 are 0 and 1 n n n Thus, any other numbers that differ by 1 cannot both be perfect squares Thus, a non-perfect square must exist in any set that contains two numbers that differ by 1 Note that we didn’t specify which one it was! 32
In 9 th place (14 votes) 33
Uniqueness proof example If the real number equation 5 x+3=a has a solution then it is unique Existence n n We can manipulate 5 x+3=a to equal (a-3)/5 Is this constructive or nonconstructive? Uniqueness n n If there are two such numbers, then they would fulfill the following: a = 5 x+3 = 5 y+3 We can manipulate this to yield that x = y Thus, the one solution is unique! 34
In 8 th place (15 votes) 35
Counterexamples Given a universally quantified statement, find a single example which it is not true Note that this is DISPROVING a UNIVERSAL statement by a counterexample x ¬R(x), where R(x) means “x has red hair” n Find one person (in the domain) who has red hair Every positive integer is the square of another integer n The square root of 5 is 2. 236, which is not an integer 36
In 7 th place (16 votes) 37
Weak mathematical induction (§ 3. 3) Rosen, question 7: Show Base case: n = 1 Inductive hypothesis: assume 38
Weak mathematical induction (§ 3. 3) Inductive step: show 39
In 6 th place (18 votes) 40
Strong mathematical induction (§ 3. 3) Show that any number > 1 can be written as the product of primes Base case: P(2) n 2 is the product of 2 (remember that 1 is not prime!) Inductive hypothesis: P(1), P(2), P(3), …, P(k) are all true Inductive step: Show that P(k+1) is true 41
Strong mathematical induction (§ 3. 3) Inductive step: Show that P(k+1) is true There are two cases: n k+1 is prime It can then be written as the product of k+1 n k+1 is composite It can be written as the product of two composites, a and b, where 2 ≤ a ≤ b < k+1 By the inductive hypothesis, both P(a) and P(b) is true 42
In 5 th place (1/2) (21 votes) 43
Structural induction (§ 3. 4) Show that n(T) ≥ 2 h(T) + 1 Inductive hypothesis: n Let T 1 and T 2 be full binary trees Assume that n(T 1) ≥ 2 h(T 1) + 1 for some tree T 1 Assume that n(T 2) ≥ 2 h(T 2) + 1 for some tree T 2 Recursive step: n Let T = T 1 ∙ T 2 Here the ∙ operator means creating a new tree with a root note r and subtrees T 1 and T 2 New element is T n By the definition of height and size, we know: n (T ) = 1 + n (T 1 ) + n (T 2 ) h(T) = 1 + max ( h(T 1), h(T 2) ) n Therefore: n (T ) = 1 + n (T 1 ) + n (T 2 ) ≥ 1 + 2 h (T 1 ) + 1 + 2 h (T 2 ) + 1 ≥ 1 + 2*max ( h(T 1), h(T 2) ) = 1 + 2*h(T) n Thus, n(T) ≥ 2 h(T) + 1 the sum of two non-neg #’s is at least as large as the larger of the two 44
In 5 th place (2/2) (21 votes) 45
Induction methods compared Weak mathematical Used for Assumption Strong Mathematical Structural Usually formulae not provable via mathematical induction Only things defined via recursion Assume P(1), P(2), …, P(k) Assume statement is true for some "old" elements Assume P(k) Statement is true for some "new" elements created with "old" elements What to prove True for P(k+1) Step 1 called Base case Basis step Step 3 called Inductive step Recursive step 46
In 4 th place (25 votes) 47
Pigeonhole principle (§ 4. 2) Consider 5 distinct points (xi, yi) with integer values, where i = 1, 2, 3, 4, 5 Show that the midpoint of at least one pair of these five points also has integer coordinates Thus, we are looking for the midpoint of a segment from (a, b) to (c, d) n The midpoint is ( (a+c)/2, (b+d)/2 ) Note that the midpoint will be integers if a and c have the same parity: are either both even or both odd n Same for b and d There are four parity possibilities n (even, even), (even, odd), (odd, even), (odd, odd) Since we have 5 points, by the pigeonhole principle, there must be two points that have the same parity possibility n Thus, the midpoint of those two points will have integer coordinates 48
In 3 rd place (1/2) (27 votes) 49
Combinatorial proof (§ 4. 3) Let n be a non-negative integer. Then Combinatorial proof n A set with n elements has 2 n subsets By definition of power set n Each subset has either 0 or 1 or 2 or … or n elements There are subsets with 0 elements, subsets with 1 element, … and subsets with n elements Thus, the total number of subsets is n Thus, 50
In 3 rd place (2/2) (27 votes) 51
Official course goals 1. 2. 3. 4. 5. Logic: Introduce a formal system (propositional and predicate logic) which mathematical reasoning is based on. (sections 1. 11. 4) Proofs: Develop an understanding of how to read and construct valid mathematical arguments (proofs) and understand mathematical statements (theorems), including inductive proofs. Also, introduce and work with various problem solving strategies and techniques. (sections 1. 5, 3. 1, 3. 3, 3. 4) Counting: Introduce the basics of integer theory, combinatorics, and counting principles, including a brief introduction to discrete probability. (sections 2. 4, 4. 1 -4. 4, 5. 1) Structures: Introduce and work with important discrete data structures such as sets, relations, sequences, and discrete functions. (sections 1. 6 -1. 8, 2. 7, 3. 2, 7. 1, 7. 3 -7. 6) Applications: Gain an understanding of some application areas of the material covered in the course. (sections 2. 6, 3. 6, 10. 3) The written final will be based on these goals! 52
In 2 nd place (30 votes) 53
Unofficial course goals Ensure that all students have a “base” level of discrete mathematical proficiency n n In particular, ensure that they know a number of covered topics, such as sets, logic, etc. Used in CS 216, in particular To prepare for more advanced computer theory classes (CS 302, CS 432) To give the students more experience in math n The best way to get better at anything is through practice To help create a computer scientist, not a computer programmer 54
And the winner is… with 45 votes… 55
Have a summer! Final is 9 a. m. this Saturday! 56
25c8c011700b0d21931386684ee7c1af.ppt