Prove by Induction

Prove by Induction

<p>SAMPLE SOLUTIONS, question 8, 1995 to 1998 plus this extra example: Prove by induction that n, 1 + 2 + 3 + … + n = n(n 1) 2 1(11) Base case: 1  2 Inductive Step: k(k 1) for some k Assume: 1 2  3  ...  k  2 (k 1)((k 1) 1) for some k Show: 1 2  3... (k 1)  2</p><p>1 2  3  ... (k 1)  [1 2  3  ... k]  (k 1) k(k 1)   (k 1) 2 k(k 1)  2(k 1)  2 (k 1)(k  2)  2 Therefore, the proof is complete.</p><p>Final 1995 #8 Proof by Induction that n2-2n > 0 for all n > 2 Base case: n=3, 32-2(3) = 3 > 0 Inductive Step Assume: k2-2k > 0 for any= k > 2</p><p>Show: (k+1)2 – 2(k+1) > 0 LHS = k2 + 2k + 1 – 2k - 2 = k2 – 2k + 2k –1 Since k2-2k > 0 by hypothesis, we need to prove that 2k-1 >= 0. Given that k > 2, 2k-1 is obviously > 0. Therefore the proof is complete. Final 1996 #8 Use structural induction on the length of the input list to prove that the length of the output from the following program is greater than the length of the input, for all finite lists. expand [ ] = [3] expand (x:xs) = expand xs ++ expand xs</p><p>Base case: To prove that #(expand [ ]) > #[ ] LHS = #(expand [ ]) = #[3] = 1 RHS = #[ ] = 0 LHS > RHS Base case proved Inductive Step Assume: #(expand (a:as)) > #(a:as)</p><p>Show: #(expand (e:a:as)) > #(e:a:as) LHS => #(expand (e:a:as)) (def. of expand) => #(expand (a:as) ++ expand (a:as)) (def. of ++ and #) => #(expand (a:as)) + #(expand (a:as)) RHS => #(e:a:as) (def. of : and #) => 1 + #(a:as)</p><p>Comparing LHS with RHS: #(expand (a:as)) > #(a:as) by hypothesis. Therefore we now need only show that #(expand (a:as)) >= 1 With the help of the base case, we can see that #(expand with any list, the simplest being [ ]) must be >= 1, as it is the base case (of length 1) or is made by appending two results of applying expand . Therefore, the proof is complete. Final 1997 #8 Use structural induction on the length of the input list to show that the length of the output is greater than the length of the input. That is, show that #p8 n > #n, for p8 defined as follows: p8 [ ] = [3] p8 (x:xs) = x : (p8 xs)</p><p>Base case: To prove #(p8 [ ]) > #[ ] LHS => #(p8 [ ]) => #[3] => 1 RHS => #[ ] => 0 Therefore, #(p8 [ ]) > #[ ] Base case proved.</p><p>Inductive Step Assume for some list a that: #(p8 a) > #(a)</p><p>Show #(p8 (e:a)) > #(e:a) LHS => #(p8 (e:a)) (def. of p8) => #(e : p8 a) (def. of : and #) => 1 + #(p8 a) RHS => #(e:a) (def. of : and #) => 1 + #(a)</p><p>Since #(p8 a) > #(a) by hypothesis, we can conclude that LHS > RHS and the proof is complete. Final 1998 #8 Consider the following program p [ ] y = [ ] p (x:xs) y = y : p xs y, if y > x = x : p xs y, otherwise Prove by induction on the length of the first input that the length of the output is equal to the length of the first input. That is, prove that #(p m n) = #m for all finite lists. Base case: To show #(p [ ] y) = #[ ] LHS => #(p [ ] y) = #[ ] => 0 RHS = #[ ] => 0</p><p>Inductive Step Assume for some list a that: #(p a y) = #a Show: #(p (e:a) y) = #(e:a)</p><p>LHS => #(p (e:a) y) Case 1: (y>e) Case 2: (y <= e) => #(y : p a y) (def. of p) => #(e : p a y) (def. of p) => 1 + #(p a y) (by hypothesis) => 1 + #(p a y) (by hypothesis) => 1 + #a => 1 + #a</p><p>RHS => #(e:a) => 1 + #a => LHS</p><p>Therefore, the proof is complete.</p>

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    4 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us