This course teaches formal verification with the Lean 4 proof assistant, starting from one idea: a theorem is a type, a proof is a program of that type, and checking the proof is checking the type. Everything else, from tactics to Mathlib to AI provers, is machinery for producing such programs and trusting the checker that reads them.

The lectures have three goals. First, explain how Lean works, down to the small kernel that has the last word. Second, give you a repeatable method for formalizing a subject you care about, with quantum information as the worked case study. Third, survey what has actually been verified recently, from Fermat’s Last Theorem and the Navier–Stokes controversy to GPU memory models, with a clear label on every claim.

Start here

Read Lecture 1, then open Notebook 1, where Lean draws its own proof terms. Keep the cheatsheet open in another tab: every lecture links to its cards.

Part I: How Lean works

  1. 00 Orientation testing vs proving, the trust pyramid, setup
  2. 01 Propositions as types why type checking is proof checking
  3. 02 Dependent type theory and the kernel universes, inductive types, definitional equality, axioms
  4. 03 Tactics goals, the core vocabulary, automation
  5. 04 Induction and recursion recursors, termination, inductive predicates

Part II: How to formalize anything

  1. 05 The formalization recipe representations, statement fidelity, blueprints
  2. 06 Mathlib's architecture type classes, hierarchies, finding lemmas
  3. 07 Case study: quantum information qubits, unitaries, no-cloning

Part III: Verifying programs and systems

  1. 08 Verified functional programs specifications, sorting, intrinsic vs extrinsic
  2. 09 Semantics and verified compilers interpreters, a compiler proof, Hoare logic
  3. 10 Verifying systems state machines, bit-vectors, GPU memory models

Part IV: Automation, AI and the frontier

  1. 11 Metaprogramming and automation macros, MetaM, writing a tactic
  2. 12 AI meets Lean provers, benchmarks, autoformalization
  3. 13 Recent applications, 2023–2026 what was verified, and how to read the claims
  4. 14 Capstone: formalize your own subject a blueprint for your project

Part V: Lean for theoretical computer science

  1. 15 Lean for theoretical computer science query complexity, codes, cost, RSA and reductions

Notebooks, homework and the cheatsheet

  • Notebooks: ten Jupyter notebooks in which you run Lean from Python with a %%lean cell magic. Every output on the notebook pages is exactly what Lean printed when the site was built.
  • Homework: seven problem sets. Each one has a Lean file with sorry placeholders for you to fill in (lean/LeanFV/Homework/); the solutions are collapsed on the page and compiled in lean/LeanFV/Solutions/.
  • Cheatsheet: one card per concept, tactic or common error. Each card opens into short notes with compiled examples, and self-test mode turns the faces into questions.

Running the notebooks

You need elan (the Lean version manager), uv for Python, and about 6 GB of disk for Mathlib’s compiled library. From the course folder:

make setup        # Python env, Lean toolchain, Mathlib cache, Lean REPL
uv run jupyter lab notebooks/build/nb

The first cell of each notebook starts one Lean process and imports what that notebook needs, which takes 5 to 40 seconds depending on how much of Mathlib it loads. After that each %%lean cell answers in well under a second. A memory guard stops Lean if it grows past 16 GB, and the notebooks never touch the network.