Skip to content

Lean Formalize

Build and check Lean 4 proofs of math statements, then audit that the final theorem matches the original claim.

Stars
18,482
Licence
MIT
Files
4 files

What it does

When installed, the agent works on formal mathematical proofs written in the Lean proof assistant. It turns a mathematical statement into Lean definitions and theorems, develops the missing lemmas, connects them into the original theorem, and checks which axioms the final result depends on. It also asks other AI reviewers from different model families to check key steps, and produces a reproducible handoff with build commands. It is meant for cases where formal verification adds real value, not for routine proofs.

Great for

  • Mathematicians or students who want a claim checked in Lean and need help with the Lean code
  • Researchers continuing an incomplete Lean project who want an audit of whether it proves the original statement
  • Anyone who needs a reproducible Lean build and a clear record of which axioms a result relies on

Skip it if

  • Ordinary mathematical derivations or short proofs, which the skill itself says should use other skills; Lean adds overhead without benefit there
  • Users without a Lean toolchain or project, since the skill expects an existing or buildable Lean environment and pinned dependencies
  • Anyone expecting a guaranteed proof of an open problem; the skill explicitly does not promise this, and a compiled conditional lemma is not a full proof

Try asking

  • “Formalize this statement in Lean and prove the main lemma, then check which axioms the final theorem uses.”
  • “Continue my incomplete Lean project in this folder and tell me the next unproved obligation.”
  • “Audit whether this Lean theorem actually proves the original statement I wrote, without changing it.”
  • “Package this finished Lean proof with portable sources and build commands.”
Step-by-step guide: how to use Lean FormalizeInstall, first run, examples, tips and FAQs

Install in 3 steps

  1. 1

    Download the skill

    The ZIP contains the 4 original files, the MIT licence and an attribution note.

    lean-formalize.zip
  2. 2

    Add it to your agent

    Claude Code (all projects)

    mkdir -p ~/.claude/skills && unzip lean-formalize.zip -d ~/.claude/skills/

    Claude Code / Agent SDK (this project only)

    mkdir -p .claude/skills && unzip lean-formalize.zip -d .claude/skills/

    Claude apps (web/desktop): Settings → Capabilities → Skills → Upload skill, and choose the ZIP.

  3. 3

    Ask for the task

    No special command needed — the agent reads the skill's description and loads it when your request matches. Try one of the prompts above.

Get better results

  • Give the exact mathematical statement, quantifiers and definitions up front so the skill can check meaning before coding.
  • If you need cross-family review, name the reviewers you want (for example Grok and Gemini), since unavailable reviewers leave that checkpoint pending.
  • Read the axiom audit and the final statement yourself; a compiled theorem is only as meaningful as its formal statement.

What's inside

  • references/adversarial-review.md
  • references/lean-working-loop.md
  • references/verification-and-handoff.md
  • SKILL.md

Redistributed unmodified from wanshuiyin/Auto-claude-code-research-in-sleep under the MIT licence. The assessment was drafted with AI from the skill's files on 2026-10-29. Skills can instruct your agent to run code — read SKILL.md and any scripts before installing.