15-150: Principles of Functional Programming

Lecture 3: Recursion and Induction

Today we write some recursive functions and prove their correctness.

Last time we discussed the 5-step methodology for writing functions. There is really an implicit "STEP 6" to the 5-step methodology: It entails proving that a function correctly implements its specifications, e.g., that it satisfies its ENSURES clause given its REQUIRES clause.

Consequently, we show how to prove correctness of some recursive functions using both mathematical induction and strong induction.

Key Concepts

Sample Code

Some Notes on Induction