15-150: Principles of Functional Programming

Lecture 3: Recursion and Induction

Today we wrote some recursive functions for integers and lists. We proved correctness of one such function (using strong induction) and termination of another (using structural induction over lists).

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.

Key Concepts

Sample Code

Some Notes on Induction

(There will be additional notes about structural induction next time.)