code-transform
Code transformation tools for repairing, simplifying, and extracting Lean proofs
Isolates failing proof steps by replacing them with `sorry` and extracting them into standalone lemmas to modularize and decouple complex Lean 4 proofs.
$ npx -y skills add project-numina/numina-lean-agent --skill sorrifier --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/sorrifierContext preview
The summary Claude sees to decide when to auto-load this skill.
Isolates failing proof steps by replacing them with `sorry` and extracting them into standalone lemmas to modularize and decouple complex Lean 4 proofs.
name: sorrifier description: "Isolates failing proof steps by replacing them with `sorry` and extracting them into standalone lemmas to modularize and decouple complex Lean 4 proofs."
Structural refactoring workflow for isolating broken proof steps. Replaces failing logic with `sorry`, extracts it into a standalone lemma, and reconstructs the call site so the main theorem compiles cleanly.
This workflow uses two tools from other skills. All commands go through the logging wrapper.
| Tool | Skill | Purpose | |------|-------|---------| | `python skills/cli/lean_check.py FILE` | [verification](../verification/SKILL.md) | Diagnose compilation errors and pinpoint failing lines | | `python skills/cli/axle.py sorry2lemma` | [code-transform](../code-transform/SKILL.md) | Extract sorry into standalone lemma with `--reconstruct-callsite` |
For full parameter reference, see `verification/reference-lean-check.md` and `code-transform/reference-axle-sorry2lemma.md`.
Follow these steps sequentially:
Run `python skills/cli/lean_check.py FILE` to identify failing lines.
Edit the Lean code: replace the failing tactic/expression with `sorry`.
Run `python skills/cli/lean_check.py FILE` again.
Run `python skills/cli/axle.py sorry2lemma` with:
Run `python skills/cli/lean_check.py FILE` one last time.
**Broken state:**
import Mathlib.Tactic theorem sum_of_squares_helper (n : ℕ) : (n + 1)^2 = n^2 + 2*n + 1 := by have h1 : (n + 1)^2 = (n + 1) * (n + 1) := by ring rw [h1] exact magic_solve n -- error: unknown identifier
**After sorrify + extract:**
python skills/cli/axle.py sorry2lemma file.lean --environment lean-4.28.0 --names sum_of_squares_helper --reconstruct-callsite
import Mathlib.Tactic lemma sum_of_squares_helper_lemma_1 (n : ℕ) (h1 : (n + 1) ^ 2 = (n + 1) * (n + 1)) : (n + 1) * (n + 1) = n ^ 2 + 2 * n + 1 := by sorry theorem sum_of_squares_helper (n : ℕ) : (n + 1)^2 = n^2 + 2*n + 1 := by have h1 : (n + 1)^2 = (n + 1) * (n + 1) := by ring rw [h1] exact sum_of_squares_helper_lemma_1 n h1
Paper | Leandex | Demo | Putnam 2025 An agent built on Claude Code for formal theorem proving tasks. We used this system to prove all 12 problems from Putnam 2025, and completed a paper-level formalization of Effective Brascamp-Lieb inequalities.
Code transformation tools for repairing, simplifying, and extracting Lean proofs
LLM-assisted tools for informal proofs, proof strategy discussion, and code simplification
Search tools for finding Lean theorems, lemmas, and definitions in Mathlib
Verification tools for compiling, validating, and disproving Lean theorems