agentleFS
r-irber-irbe/proof-skills/skills/lean-proof-repair/SKILL.md

lean-proof-repair

Skill3 starsChanged 25 days agoApache-2.0View on GitHub

USE FOR: repairing broken Lean 4 proofs after toolchain upgrades, Mathlib bumps, or simp drift. DO NOT USE FOR: writing new proofs (@lean-proof) or bisecting commits (@lean-bisect). TRIGGERS: proof repair, broken proof, toolchain upgrade, Mathlib bump, simp drift.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 0 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Snapshot Diagnostics via LSP (lean_diagnostics): Call lean_diagnostics on the broken file to collect exact line/column error spans and …

    line 37
  2. Very specific:

    Inspect Pre/Post Goal State (lean_goal): Call lean_goal at the failing tactic line with target: "tactic" and target: "altproof" to …

    line 42
  3. Very specific:

    STOP: if repairing the proof appears to require weakening the theorem statement or adding a new hypothesis.

    line 49
  4. Very specific:

    STOP: after 3 failed repair attempts on the same goal and run lean_counterexample_search(strategy: "dense") to check whether an upstream …

    line 52

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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-toolchain or lake-manifest.json updates, replacing renamed Mathlib lemmas, stabilizing broken simp calls into simp only [...], and recovering from omega/ring/aesop regressions.
  • 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 goals after bump.

Workflow

  1. Snapshot Diagnostics via LSP (lean_diagnostics): Call lean_diagnostics on the broken file to collect exact line/column error spans and classify each failure (UnknownIdentifier, TypeMismatch, UnsolvedGoals, SimpNoProgress, HeartbeatTimeout).
  2. Inspect Pre/Post Goal State (lean_goal): Call lean_goal at the failing tactic line with target: "tactic" and target: "altproof" to compare the live goal against the expected intermediate state.
  3. Apply Targeted Repair Pattern:
    • Renamed / moved lemma: inspect live hover/signatures with lean_navigate(operation: "hover" | "definition") or query lean_search(source: "code" | "loogle") for the type shape and substitute the new identifier.

Recovery & STOP

  • STOP if repairing the proof appears to require weakening the theorem statement or adding a new hypothesis; escalate to @lean-specification (specifier role).
  • 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-replay-verification (fresh kernel replay), skill:lean-enforcement.

Detailed reference

Full encyclopedic reference, decision trees, and lookup tables live in references/lean-proof-repair-handbook.md .

See also

  • ../../references/lean-proof-repair-handbook.md -- Complete lean-proof-repair Handbook
  • ../lean-gateway/SKILL.md -- Top-level skill router

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.