Formalising in Lean loses a lot of time to small things: finding the right Mathlib lemma, decoding a type class error, rewriting an inequality into the shape a tactic expects. Combining Lean with coding agents has a special advantage: unlike prose, every suggestion is checked by the Lean kernel, so a wrong proof cannot slip through. In this masterclass you set up Claude Code for a Lean project, let the agent iterate against the compiler and break theorems into checkable subgoals with sorry placeholders. You also see where agents reach their limits and your mathematical judgement remains essential.
Who the Lean masterclass is for
Mathematicians, doctoral researchers and advanced students who have some experience with Lean and Mathlib and want to speed up formalisation projects with coding agents.
What you'll walk away with
- Set up a Lean project with Mathlib so that a coding agent can build, check and iterate
- Break theorems into subgoals with sorry placeholders and have the agent close specific gaps
- Find suitable Mathlib lemmas with search tactics and support from the agent
- Feed error messages and goal states back to the agent so that it makes useful corrections
- Judge whether a formalisation captures the intended statement rather than merely compiling
Typical scenarios
- A research group formalises a lemma on convergent sequences; the agent closes the routine estimates while the group concentrates on choosing the right definitions.
- In a doctoral project the agent resolves a type class error, and review reveals that in doing so it had weakened the statement of the theorem.
- For a course, Lean exercises are created whose model proofs the agent writes and the kernel checks before they reach students.
Does this fit your team?
Pick a few dates that suit you. The request is non-binding, and the agenda is tailored in a short call beforehand.
What the Lean masterclass covers
- Lean, Mathlib and the agentProject setup with Lake, build commands, an instruction file for the agent and why the compiler is the decisive check.
- Breaking proofs into subgoalsBlueprint thinking on a small scale: helper lemmas with sorry, dependencies and a sensible order for the agent.
- Finding lemmasSearch tactics such as exact? and apply?, Mathlib naming conventions and prompts that make the agent cite matches instead of guessing.
- Iterating against the compilerError messages and goal states as feedback, stopping criteria and dealing with slow tactics such as simp in large contexts.
- Protecting statementsHow to stop the agent from weakening theorems, adding hypotheses or hiding sorry, and how to spot it in review.
- Limits and division of labourWhere agents help dependably, where they fail on new mathematics and how groups share out the formalisation work.
Before the Lean masterclass: prerequisites
- Some experience with Lean and Mathlib, for example from tutorials or small proofs of your own
- A laptop with a working Lean installation, VS Code and a coding agent
- Optional: a theorem of your own or an ongoing formalisation project
Materials you keep
- A project template with an instruction file and a check script against hidden sorry placeholders
- Prompt patterns for subgoals, lemma search and error messages
- A review checklist that protects statements and hypotheses from silent changes