{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lecture09 - Induction COMPUTER SCIENCE 51 Spring 2009...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
3/3/2009 1 COMPUTER SCIENCE 51 Spring 2009 cs51.seas.harvard.edu Prof. Greg Morrisett Prof. Ramin Zabih Induction Computers are discrete & finite But we don’t want to argue based on their current hardware Want our programs to run correctly and efficiently on arbitrary inputs Prove an infinite set of statements? P[1] = “my factorial program is correct when the input is 1” P[2], P[3], … Gets old fast! Induction recipe 1. What variable n are you doing induction on, and what is its type? 2. What statement P[n] will you prove? 3. Prove P[1] (first element, can be 0) 4. For an arbitrary n, prove P[n+1] follows from P[n]. Induction Hypothesis (must be used!) Recipe use (math) 1. Variable is positive integer n 2. Statement: 3. Proof of P[1] 4. Want to show (via IH!): English ambiguity in IH Need: for all n, P[n] implies P[n+1] We pick an n and assume P[n] (IH) Then derive P[n+1] It’s always true that For all n, P[n] implies For all n, P[n+1] Math notation helps n ( P[n] P[n+1] ) versus n ( P[n]) n(P[n+1] ) Example notes IH versus statement This theorem is very easy in binary Related to many exponentially growing functions “Everything is at the leaves”
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern