# 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

- Recursive functions
- Proof of correctness
- 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.
- Correspondence between recursive function
clauses and proof by induction.