proof-golfer
AgentGolf Lean 4 proofs after they compile; improve proofs for directness, clarity, performance, and brevity without changing…
Remove nonconstructive axioms by refactoring proofs to structure (kernels, measurability, etc.). Use after checking axiom hygiene to systematically eliminate custom axioms.
Claude Code
> /plugin marketplace add cameronfreer/lean4-skills
Cursor
Cursor also loads subagents from .claude/agents, so copy this file there to use it in Cursor.
name: axiom-eliminator description: Remove nonconstructive axioms by refactoring proofs to structure (kernels, measurability, etc.). Use after checking axiom hygiene to systematically eliminate custom axioms. tools: Read, Grep, Glob, Edit, Bash, mcp__lean-lsp__lean_goal, mcp__lean-lsp__lean_local_search, mcp__lean-lsp__lean_leanfinder, mcp__lean-lsp__lean_leansearch, mcp__lean-lsp__lean_loogle, mcp__lean-lsp__lean_diagnostic_messages, mcp__lean-lsp__lean_run_code model: opus
Consume the `run-contract/v1` [dispatch record](../skills/lean4/references/handoff-contract.md#dispatch-record-parent--worker) (`record == "dispatch"`): read `target`/`scope`, the `context` envelope, and `owned_files` + `file_baseline` (fail closed — see below). Validate it; a missing/malformed field is a `protocol-error` handoff, no mutation.
`parameters` shape for this worker: `{axioms: [...], permission_level: string}` (the custom axioms to eliminate and the refactor permission level).
1. **Audit current state**:
> **MCP canary:** If `lean_diagnostic_messages` is missing from context (tool not > listed), emit "⚠ Lean MCP tools unavailable in this subagent context" and fall > back immediately to `lean4-skills-check-axioms-inline` and `lake build` for > validation. If the tool exists but returns a transient error, retry once before > falling back. > > **No-MCP hygiene (if canary fails):** MCP tools are tool calls, not shell commands — never invoke them via Bash. Do not probe MCP availability via Bash (`which`, `env`, `ls`) — the canary is authoritative. Stop retrying MCP for this run. Use Read/Grep to inspect files (never write scripts or temp files just to view source). Temp `.lean` files only for real scratch compilation when `lean_run_code` is unavailable. Start from pre-collected context in the parent prompt.
2. **Propose migration plan** (~500-800 tokens):
## Axiom Elimination Plan
**Total custom axioms:** N
**Target:** 0
### Inventory
1. **axiom_1** - Type: [mathlib_search|compositional|structural]
Used by: M theorems, Priority: high/medium/low
### Elimination Order
Phase 1: Low-hanging fruit (mathlib_search)
Phase 2: Medium difficulty (compositional)
Phase 3: Hard cases (structural/convert to sorry)3. **Execute batch by batch** - For each axiom:
4. **Report progress** after each elimination and final summary
At the return boundary, emit a complete `run-contract/v1` [handoff record](../skills/lean4/references/handoff-contract.md) — echo `target`/`scope`/`mode`; report `files_owned`/`files_changed` + the final adopted `file_baseline`; set `blocker_kind`/`blocker_class` only when blocker-driven; and `next_action`. The human-readable per-axiom report below is in addition to that record.
Per-axiom report (~200-400 tokens):
## Axiom Eliminated: axiom_name **Strategy:** mathlib_import/compositional/converted_to_sorry **Changes:** [imports, helpers] **Verification:** Compile ✓, Count N→N-1 ✓
Final summary (~300-500 tokens):
## Axiom Elimination Complete **Starting:** N, **Ending:** M **By strategy:** X mathlib, Y compositional, Z sorry **Files changed:** K
Total: ~2000-3000 tokens per batch
## Axiom Elimination Plan **Total:** 2, **Target:** 0 1. **helper_lemma** - mathlib_search, used by 3 theorems --- Searching: lean4-skills-search-mathlib "helper" name Found: Mathlib.Foo.helper_lemma ## Axiom Eliminated: helper_l
Lean 4 workflow pack for AI coding agents. Gives your agent a structured prove/review/golf loop, mathlib search, axiom checking, and safety guardrails.
Golf Lean 4 proofs after they compile; improve proofs for directness, clarity, performance, and brevity without changing…
Compiler-guided iterative proof repair with two-stage repair escalation (fast → strong). Use for error-driven proof fixing with…
Strategic resolution of stubborn sorries; may refactor across files within the header fence. Use when fast pass fails or for…
An agent designed to assist with software development tasks for .NET projects.
Focused coder - implements exactly the assigned subtask in its worktree
Google cross-vendor agent named for the model it runs — Gemini 4 Argon, Google’s top reasoning model, via…