Examples of programs and in Lean #
We see our first examples of programs and proofs in Lean. A major goal is to illustrate functional programming, where we use recursions for loops and avoid mutable variables.
We define recursively summing to n
and prove a theorem about it.
Lean allows imperative programming, but it is not recommended. Here is an example of a program that uses a mutable variable.
Equations
- One or more equations did not get rendered due to their size.