Announcements Quiz 10: on Canvas. Due 6/18, noon. CPSC 121: Models of Computation HW5: available 6/14, due 6/21. 2018 Summer Term 1 Exam2 recap Intro to Induction Final exam: 6/25, 8:30a Tutorials will meet 6/21 – all are welcome. Cinda Heeren, based on notes by Steve Wolfman, Patrice Belleville and others Lots of exam prep support—see piazza. 1 2 H This work is licensed under a Creative Commons Attribution 3.0 Unported License. Outline Learning Goals: Pre-Class • Prereqs and Learning Goals By the start of class, you should be able to: • Problems and Discussion – Given a theorem to prove and the insight into how to break the problem down in terms of – Introductions smaller problems , write out the skeleton of an – Odd Numbers inductive proof including: the base case(s) – Horse Colours that need to be proven, the induction – CS Induction: Duplicate Detection, Binary hypothesis, and the inductive step that needs Search, MergeSort to be proven. – More examples • Next Lecture Notes 3 4
Learning Goals: In-Class Outline • Prereqs and Learning Goals By the end of this unit, you should be able to: • Problems and Discussion – Formally prove properties of the non-negative integers (or a subset like integers larger than 3) – Introductions that have appropriate self-referential structure— – Odd Numbers including both equalities and inequalities—using – Horse Colours either weak or strong induction as needed. – CS Induction: Duplicate Detection, Binary – Critique formal inductive proofs to determine Search, MergeSort whether they are valid and where the error(s) lie if – More examples they are invalid. • Next Lecture Notes 5 6 Worked Problem: How Many Introductions? Worked Problem: How Many Introductions? Problem: n people would like to introduce Def’n : When two people meet each other, that themselves to each other. How many counts as two intros. introductions does it take? Let’s do a few steps concretely to find insight… For 2 people? For 3 people? For 1 person? For 4 people? For 5 people? Given the number for 1 , for 2 ? … For n people? Given the number for 2 , for 3 ? Sound familiar? Let’s prove it. 7 8
A Pattern for Induction Worked Problem: Self-referential structure? It’s usually good to name things! 1. Identify the recursive structure in the problem. Let’s let I(n) be the number of introductions required for 2. Circle each recursive appearance of the a group of n people… structure inside its definition. My turn! I(1) ? 0 introductions. 3. Divide the cases into: those without recursive appearances (“base cases”) and those with Given I(k-1) , what’s I(k) ? (“recursive” or “inductive” cases) a. I(k-1) + 1 b. I(k-1) * (k-1) 4. Write a predicate P( a ) describing what you c. I(k-1) + 2(k – 1) want to say about the structure. d. I(k-1) + 2k 5. Write your theorem " a Î ?,P( a ) e. None of these 6. Complete the proof template. 9 10 Once we have this, we’re ready for our pattern! P( a ) ≡ [fill in predicate definition] A Pattern for Induction Theorem: For all [recursive structure] a , P( a ) holds. Proof by structural induction: 1. Identify the recursive structure in the problem. Consider an arbitrary [recursive structure] a . I(k) Base case: [For each non-recursive case, prove the theorem holds for that 2. Circle each recursive appearance of the case. End by showing your theorem true for the base case structure!] structure inside its definition. I(k-1) Inductive Step: a is recursively defined. 3. Divide the cases into: those without recursive Induction Hypothesis: Assume the theorem holds for [each recursive appearances (“base cases”) and those with appearance of the structure in this case]. “0” base case, We now show the theorem holds for a . [And then do so! You should: (“recursive” or “inductive” cases) “> 0” inductive case 1) END by showing that your theorem holds for a . 4. Write a predicate P( a ) describing what you 2) USE the “Induction Hypothesis” assumption(s) you made. want to say about the structure. I(k) = k(k-1) 3) NEVER take a recursive appearance and use the recursive definition to break it down further, like this BAD example: “each subtree is a binary 5. Write your theorem " a Î ?,P( a ) tree that can have subtrees and so on until we reach an empty tree.”] 6. Complete the proof template. 11 It helps to write out what you want to prove rather than just “show the theorem holds for a ”. 12 (Even though neither one is strictly necessary.)
If the recursive structure is parameterized by P( k ) ≡ I(k) = k(k-1) something, we use that thing inside P( ? ). Outline Theorem: For all natural numbers k , P( k ) holds. Proof by structural induction: • Prereqs and Learning Goals Consider an arbitrary non-zero natural number k . Base case (k=0): We know I(0) = 0. 0(0-1) = 0(-1) = 0, as expected. P • Induction as a Formal Argument Form • Problems and Discussion Inductive Step: (k>0) – Introductions Induction Hypothesis: – Odd Numbers Assume the theorem holds for any j < k: that is, I(j) = j*(j-1). – Horse Colours We now show the theorem holds for k . That is, I(k) = k(k-1). – CS Induction: Duplicate Detection, Binary Search, I(k) = I(k-1) + 2(k-1) by definition MergeSort = (k-1)((k-1)-1) + 2(k-1) by the IH – More examples = (k-1)(k-2) + 2k – 2 • Next Lecture Notes = k^2 – 3k + 2 + 2k – 2 = k^2 – k = k(k-1) as expected P 13 14 QED Historical Problem: Sum of Odd Numbers Sum of Odd Numbers: Recursive Structure Problem: What is the sum of the first n odd Problem: Prove that the sum of the first n numbers? odd numbers is n 2 . First, find the pattern. Then, prove it’s correct. How can we break the sum of the first, second, …, n th odd number up in terms of The first 1 odd number? The first 2 odd numbers? a simpler sum of odd numbers? The first 3 odd numbers? The first n odd numbers? Historical note: Francesco Maurolico made the first 15 16 recorded use of induction in 1575 to prove this theorem!
A Pattern for Induction Sum of Odd Numbers: Recursive Structure Problem: Prove that the sum of the first n 1. Identify the recursive structure in the problem. odd numbers is n 2 . 2. Circle each recursive appearance of the structure inside its definition. 3. Divide the cases into: those without recursive The sum of the first n odd numbers is the appearances (“base cases”) and those with sum of the first n-1 odd numbers plus the n th odd number. (“recursive” or “inductive” cases) 4. Write a predicate P( a ) describing what you want to say about the structure. (See our recursive formulation of S from the last slides!) 5. Write your theorem " a Î ?,P( a ) 6. Complete the proof template. 17 18 P( a ) ≡ [fill in predicate definition] Theorem: For all [recursive structure] a , P( a ) holds. Historical Problem: Sum of Odd Numbers Proof by induction: Consider an arbitrary [recursive structure] a . Theorem: For all positive integers n, the sum of the first n Base case: [For each non-recursive case, prove the theorem holds for that odd natural numbers is n 2 . case. End by showing your theorem true for the base case structure!] C Inductive Step: a is recursively defined. Base Case (n= ___): Induction Hypothesis: Assume the theorem holds for [each recursive appearance of the structure in this case]. We now show the theorem holds for a . [And then do so! You should: Induction Hypothesis: Assume... 1) END by showing that your theorem holds for a . Inductive Step: 2) USE the “Induction Hypothesis” assumption(s) you made. 3) NEVER take a recursive appearance and use the recursive definition to break it down further, like this BAD example: “each subtree is a binary tree that can have subtrees and so on until we reach an empty tree.”] It helps to write out what you want to prove rather than just “show the theorem holds for a ”. 19 20 H (Even though neither one is strictly necessary.)
Outline Historical Problem: Sum of Odd Numbers • Prereqs and Learning Goals • Induction as a Formal Argument Form • Problems and Discussion – Introductions – Odd Numbers – Horse Colours – CS Induction: Duplicate Detection, Binary Search, MergeSort (by the IH) – More examples • Next Lecture Notes 21 22 Problem : Proof Critique Problem : Proof Critique Theorem : All horses are the same colour. Theorem : All horses are the same colour. See handout. See handout. Proof critique: Is the proof valid? a. Yes, because each step follows irrefutably Problem : Critique the proof. from the previous steps. b. Yes, because the premises are false. c. Yes, but not for the reasons listed here. d. No, because the inductive step fails for n=2. e. No, but not for the reasons listed here. 23 24 H
Recommend
More recommend