# 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 (not correctness) of our implementation of the length function, using structural induction over lists. (Exercise: How might you modify that proof to prove correctness?)

### Key Concepts

• Recursive functions
• Proofs of correctness
• Standard (mathematical) induction --- Mathematical induction can be useful when an integer variable is reduced by 1 in the recursive part of a function.
• Strong induction --- Strong induction can be useful when an integer variable is reduced by more than 1.
• Structural induction --- Structural induction can be useful for recursion over datatypes more general than integers.
• Correspondence between recursive function clauses and proof by induction.

### Some Notes on Induction

Here is another introduction to lists, with a bit more formal detail than in the previous lecture's notes.
(There will be additional notes about structural induction over lists and trees next time.)