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 two implementations of the power function. We used standard/mathematical induction for one implementation and strong/complete induction for a different implementation of that same function.
We also proved totality of our implementation of the length function, using structural induction over lists.

Key Concepts

Sample Code

Some Notes on Induction

Here is an introduction to lists.
(There will be additional notes about structural induction over lists and trees next time.)

Slides from Lecture