Apply a repeated Lean theorem change and collect the exceptions
At a glance
A Lobsters commenter used an LLM coding workflow to replace a recurring theorem pattern across more than a hundred Lean proofs. This workflow is listed under Code Refactoring, Formal Verification, Exception Review.
- Agents / tools
- LLM coding agent, Lean
SourceBuilding a tool for these workflows? See weekly rates.
What they did
1) Start with an existing Lean project and an LLM coding agent that can inspect and edit its files. Identify the exact old theorem pattern and the replacement you want; the original project and agent were not published. 2) Instruct the agent to inspect every theorem, replace that specific pattern wherever it applies, flag cases that do not work directly, and return a list of remaining exceptions. 3) Review the changed proofs and the exception list. Use Lean's compilation and proof checking to validate the transformed project, then investigate cases that fail instead of accepting the entire batch on the agent's assurance. 4) Finish with the accepted changes and an explicit list of unresolved cases, so the mechanical pass has a clear boundary.
How it went
The commenter reported updating more than a hundred theorems in roughly the time they would otherwise spend starting a custom text-processing solution.
Worth knowing
The commenter emphasized Lean's strong validation properties; ordinary code needs its own tests and checks.