Sources and coverage
This book teaches programming and proofs through a shared account model. It also covers package maintenance, a CLI with a checked contract, integration testing, and debugging, and concludes with an independent transfer exercise.
Primary sources
- David Thrane Christiansen, Functional Programming in Lean. Source snapshot:
leanprover/fp-leanat13db7a0a90f3. The upstream book attributes its original text to Microsoft Corporation and its subsequent revisions to Lean FRO; consult its source for licence and attribution details. - Jeremy Avigad, Leonardo de Moura, Soonho Kong, Sebastian Ullrich, and community contributors, Theorem Proving in Lean 4. Source snapshot:
leanprover/theorem_proving_in_lean4at2ef2a3e43cb5. - Lean’s executable definitions, interfaces, and tactics:
leanprover/lean4, Lean 4.35.0. The compiler in the pinned deva Nix environment is the validation target for this book. - The Lean Language Reference provides detailed API and semantic explanations. Its “latest” version may differ from the checked workbook, so match reference details to your project’s toolchain.
- Mathlib’s source at Lean 4.35.0, learning guide, and library documentation.
Use these references for further detail and to identify the versions covered in this book.
Integrated coverage
| Source topic | Where it is taught here |
|---|---|
| Expressions, types, functions, structures, pattern matching | Chapters 1–4 |
| Polymorphism, universes, implicit arguments | Chapters 2, 9, 12, and 14 |
| Propositions, proofs, quantifiers, equality | Chapters 5–7 |
| Tactic proofs, interaction, conversion mode | Chapters 6–8 and 19 |
| Inductive types, recursion, induction | Chapters 3–4 and 8 |
| Overloading, type classes, coercions | Chapter 9 |
| Functors, applicatives, monads, and IO | Chapter 10 |
| Readers, state, exceptions, transformer order | Chapter 11 |
| Dependent programming, indices, proof-carrying data | Chapter 12 |
| Connecting programs to contracts | Chapters 8, 13, 16, and 18 |
| Runtime behaviour and efficient representations | Chapter 16 |
| Classical reasoning, axioms, erasure, trust | Chapters 5 and 17 |
| Project structure, dependencies, mathematical libraries | Chapters 14–15 |
| Practical text handling and syntax extensions | Appendices A–B |
The sequence introduces each concept before relying on it. Logical constructors follow the corresponding data constructors. The book introduces induction after recursion, dependent types after proof construction, and optimisation after proving a specification.
Validation and scope
Run nix develop --command make check from the deva repository. The command checks formatting, extracts and checks every lean fence in chapter order within its page, builds the workbook’s native executable, checks its proof file with warnings treated as errors, runs 6 CLI integration cases, and builds every mdBook. The standard-library examples target Lean 4.35.0.
The Mathlib track uses the separate pinned package described in Chapter 15. It requires its own dependency cache and check command.
The shell setup instructions assume an Elan installation. The deva development shell supplies Lean directly.
Successful completion establishes a foundation for ordinary Lean programming and proof development. Advanced mathematical formalisation, substantial tactic implementation, compiler work, concurrent systems, and production persistence require domain-specific practice beyond the examples here. In the transfer assessment, you implement a new operation, state and prove its contract, and connect it to a tested executable.