Lean 4 Automated & Interactive Proof Repair
Diagnose and repair broken Lean 4 tactic scripts caused by toolchain bumps, Mathlib API renames, simp
normal-form drift, or
upstream
definition changes without weakening theorem statements.
Routing
- USE FOR: fixing broken proofs after
lean-toolchainorlake-manifest.jsonupdates, replacing renamed Mathlib lemmas, stabilizing brokensimpcalls intosimp only [...], and recovering fromomega/ring/aesopregressions. - DO NOT USE FOR: authoring new proofs from scratch (delegate to
@lean-proof); bisecting toolchain commits (delegate to@lean-bisect); refactoring already-green proofs (delegate to@lean-proof-refactor). - TRIGGERS: proof repair, broken proof, toolchain upgrade, Mathlib bump, unknown identifier in proof,
simp made no progress,unsolved goalsafter bump.
Workflow
- Snapshot Diagnostics via LSP (
lean_diagnostics): Calllean_diagnosticson the broken file to collect exact line/column error spans and classify each failure (UnknownIdentifier,TypeMismatch,UnsolvedGoals,SimpNoProgress,HeartbeatTimeout). - Inspect Pre/Post Goal State (
lean_goal): Calllean_goalat the failing tactic line withtarget: "tactic"andtarget: "altproof"to compare the live goal against the expected intermediate state. - Apply Targeted Repair Pattern:
- Renamed / moved lemma: inspect live hover/signatures with
lean_navigate(operation: "hover" | "definition")or querylean_search(source: "code" | "loogle")for the type shape and substitute the new identifier.
- Renamed / moved lemma: inspect live hover/signatures with
Recovery & STOP
- STOP if repairing the proof appears to require weakening the theorem statement or adding a new
hypothesis; escalate to
@lean-specification(specifierrole). - STOP after 3 failed repair attempts on the same goal and run
lean_counterexample_search(strategy: "dense")to check whether an upstream definition change invalidated the theorem statement.
Handoffs
- Predecessors:
skill:lean-gateway,skill:lean-build(surfaces broken build targets),skill:lean-bisect(identifies breaking commit),skill:lean-proof. - Successors:
skill:lean-proof-review(4-layer soundness audit),skill:lean-verification-gate(fresh kernel replay),skill:lean-verification-gate.
Detailed reference
- Layer-1 Fast Lookup Card (read first):
references/cards/lean-proof-repair-tables.mdFull encyclopedic reference, decision trees, and lookup tables live inreferences/handbooks/lean-proof-repair-handbook.md.
See also
../../references/handbooks/lean-proof-repair-handbook.md-- Completelean-proof-repairHandbook../lean-gateway/SKILL.md-- Top-level skill router
