lean-formalization
Skill9 starsChanged 4 months agoMITView on GitHub
Use for interactive Lean 4 formal verification by coding agents with reusable Lean/mathlib workspaces, theorem formalization, proof repair, sorry completion, patch review, optional adapter-first Lean-specialist backend work, and minimal failure handoff.
- Reads credentials
1 other project uses a version of this.
Adopted by
Most recently taken up by
- LeonardSEO/ambitious-math-researchtheir own version, first seen Oct 13, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- LeonardSEO/ambitious-math-research★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository5 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/lean-formalization.mdcCursor rule
- lean-formalizationSkill
- lean-setupSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
30 rules. About 0 are common, 12 are distinctive, and 18 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈12
Distinctive · estimate
This author's own choices. Worth a look.
18
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Use this skill when the user wants a coding agent to do Lean 4 formalization, proof repair, theorem transcription, sorry completion, review …
- Very specific: line 10
If the user only wants Lean 4, elan, lake, or a reusable mathlib workspace configured, use the sibling ../lean-setup/SKILL.md entrypoint …
- Distinctive: line 34
Do not remove the built-in official Numina adapter recipe.
- Distinctive: line 40
Ask at most one blocking question at a time.
- Distinctive: line 44
When reporting readiness, lead with local Lean readiness.
- Very specific: line 45
Before any backend adapter setup or run, inspect readiness, explain the deployment/call, target project, prompt, result directory, …
- Distinctive: line 50
If blocked, stop cleanly with the smallest useful failing Lean fragment, exact errors/goals, and the next mathematical decision needed.
- Very specific: line 54
Use python ../lean-runtime/scripts/ai4m_lean.py <command> when it saves effort or reduces risk:
- Distinctive: line 66
All helper commands emit machine-readable JSON on stdout.
- Distinctive: line 74
Do not call external model APIs or mutate Numina runtime state without approval.
- Distinctive: line 75
If the user asks for the official Lean Agent, Numina, Archon, batch proof search, or external subagent, explain needed credentials/setup …
- Distinctive: line 76
Do not commit local machine-specific paths.
- Very specific: line 77
Do not call external APIs during env, doctor, check, review, detect-sorry, tests, or dry-runs.
- Very specific: line 78
Do not store secrets in tracked files.
- Very specific: line 79
Do not accept final Lean patches containing sorry, admit, or newly introduced axiom.
- Distinctive: line 80
Do not silently weaken theorem statements or change existing project versions.
- Distinctive: line 81
Do not let helper command availability override a better coding-agent path.
- Distinctive: line 82
Do not remove the built-in official Numina adapter recipe.
- Very specific: line 86
Read ../lean-runtime/references/direct_lean_workflow.md for the default coding-agent proof/repair/formalization loop.
- Very specific: line 87
Read ../lean-runtime/references/lean_agent_capability_map.md when checking whether Lean-agent abilities have been distilled into the …
- Very specific: line 88
Read ../lean-runtime/references/lean_lsp_mcp_adapter.md when the user asks to connect Lean LSP/MCP, goal-state MCP tooling, or MCP-backed …
- Very specific: line 89
Read ../lean-runtime/references/specialist_agent_patterns.md when adapting ideas from Numina, LeanDojo/ReProver, LeanCopilot, COPRA-style …
- Very specific: line 90
Read ../lean-runtime/references/lean_runtime_configuration.md when setting up or diagnosing the reusable Lean workspace.
- Very specific: line 91
Read ../lean-runtime/references/numina_runtime.md when the user wants the official Numina deployment/call path.
- Very specific: line 92
Read ../lean-runtime/references/numina_subagent_troubleshooting.md when Numina auth, proxy, MCP, or runner failures appear.
- Very specific: line 93
Read ../lean-runtime/references/backend_adapter_checklist.md before connecting Archon or any other backend adapter.
- Very specific: line 94
Read ../lean-runtime/references/interactive_orchestration.md when guiding user intake and task decomposition.
- Very specific: line 95
Read ../lean-runtime/references/review_checklist.md before accepting a Lean patch.
- Very specific: line 96
Read ../lean-runtime/references/failure_taxonomy.md when reporting a blocked proof.
- Very specific: line 97
Read ../lean-runtime/references/numina_reverse_analysis.md when explaining which Numina mechanisms are incorporated locally and which are …
≈ “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.
Files
Lean Formalization
Use this skill when the user wants a coding agent to do Lean 4 formalization, proof repair, theorem transcription, sorry completion, review of a Lean patch, or optional Lean-specialist backend work.
If the user only wants Lean 4, elan, lake, or a reusable mathlib workspace configured, use the sibling ../lean-setup/SKILL.md entrypoint and do not ask for a theorem target.
Shared scripts, prompts, schemas, examples, and references live in the non-user-facing ../lean-runtime/ support layer. Treat lean-setup and lean-formalization as the two public entrypoints; do not ask users to invoke lean-runtime directly.
This is a coding-agent-first Lean skill. The coding agent is the primary Lean worker. It reads and edits Lean files, runs Lean/Lake checks, diagnoses errors, preserves theorem statements, and iterates with the user. Default execution mode is coding-agent mode.
Incorporate publicly documented Lean-specialist agent patterns into the default coding-agent workflow. Use systems such as Numina, LeanDojo/ReProver, LeanCopilot, COPRA-style proof search, Lean LSP, MCP, and lightweight iterative proof agents as related-work references for mechanisms such as project gating, statement normalization, theorem-state loops, premise retrieval, bounded tactic/proof search, validation oracles, failure memory, and minimized handoff. Treat specialist-agent patterns as mechanisms, not mandatory external services.
This skill must act as a distilled Lean-agent capability layer, not only as a list of related projects. The default path should execute the distilled loop from ../lean-runtime/references/lean_agent_capability_map.md: project gate, statement normalization, local context pack, retrieve-before-inventing, bounded tactic/proof attempts, failed-route memory, local validation, and minimal failure handoff. Use ../lean-runtime/references/lean_lsp_mcp_adapter.md when the user explicitly asks for Lean LSP/MCP, richer goal-state tooling, or MCP-backed theorem search.
Lean-specialist backend adapters are adapter-first optional escalation paths. Built-in recommended adapter: official Numina Lean Agent runtime. Numina and Archon are recommended adapter candidates, not defaults or hard requirements. Other Lean-specialist backends may be connected by the coding agent through the backend adapter checklist; do not call any backend until deployment, readiness checks, invocation, validation, and failure triage are documented. Use a backend adapter only when the user asks for the official Lean Agent, Numina, Archon, batch proof search, or an approved external subagent run.
Match the user's language by default. If the user's language is ambiguous, default to Chinese. If the user writes Chinese, respond in Chinese from the first turn unless they ask otherwise. A language switch is not a task reset. Keep the current environment state, prior diagnosis, and recommended next action, then continue leading in the new language.
Lead the interaction; do not wait for the user to drive every step. When the user's request is broad or underspecified, first orient yourself to the Lean project/workspace state, then propose the next useful action in plain language. Do not open with a passive "send me the file" checklist when you can inspect context or offer a concrete starting path.
If no target is available, run or propose a safe local smoke/readiness check. Use the bundled smoke test when no user target is available. Then recommend a default path, such as checking the shared Lean workspace, running the built-in smoke theorem, or inspecting a Lean project. Check backend readiness only when the user wants an optional Lean-specialist backend path. Avoid ending with only "send me a file" or an equivalent passive handoff.
The bundled CLI is a helper toolbox, not the workflow driver. Prefer normal coding-agent judgment, direct file edits, rg, Lean/Lake validation, and repository context. Use helper commands only when their deterministic output is useful.
Use backend adapters through a human-in-the-loop workflow. The built-in recommended Numina adapter lives under shared local state at ${AI4MATH_HOME:-~/.ai4math}/numina-runtime/; the coding agent explains clone, setup, API-key, proxy/MCP, and upstream runner implications before running setup or calling the official runner. Archon and other backend adapters must follow ../lean-runtime/references/backend_adapter_checklist.md. Do not turn helper commands into a closed proof workflow.
Opening readiness should inspect local Lean readiness first; inspect Numina or another backend readiness only when the user asks for an optional Lean-specialist backend. Do not require API keys for the default coding-agent path. Default coding-agent Lean work must not require any backend adapter. Shared workspace is the default Lean project context; Numina may target it instead of upstream examples.
Do not remove the built-in official Numina adapter recipe. Treat Numina and Archon as recommended adapter candidates with explicit approval, while keeping the direct coding-agent Lean workflow useful without external APIs.
Agent Playbook
- Start by orienting the session: inspect the current repository/workspace when possible, distinguish an existing Lake project, shared Lean workspace, and local Lean validation readiness, then summarize what is already usable. Mention Numina runtime or credentials/auth only when the user asks for an optional backend adapter path. Treat upstream Numina example projects as demos only; do not let their pinned
lean-toolchainmake the shared workspace look broken. - If the user has not provided a precise target, offer a small next-step menu such as run the bundled smoke test, repair an existing Lean file, formalize a natural-language/LaTeX theorem, or inspect a Lean project. Include backend readiness or credential setup only when the user asks for an optional backend adapter path. Recommend one default path based on what inspection found.
- Ask at most one blocking question at a time. Prefer a concrete recommendation plus one decision question over a list of required inputs.
- Understand the user's intent: direct coding-agent repair/formalization, configure or call a backend adapter, repair a file, formalize a statement, prove a target, complete
sorry, review a patch, batch a folder, or minimize a failure. - Locate the relevant Lean project, files, declarations, imports, and current errors. Use the user's existing Lake project when available; otherwise use the shared workspace as the coding-agent project context and optional Numina target project.
- For standalone files, use or create the shared workspace
${AI4MATH_HOME:-~/.ai4math}/lean-workspace; do not create a second project-local workspace unless the user asks for isolation. - When reporting readiness, lead with local Lean readiness. Report backend readiness only when the optional backend adapter path is requested. If backend credentials are missing, say that only the optional backend adapter path needs configuration.
- Before any backend adapter setup or run, inspect readiness, explain the deployment/call, target project, prompt, result directory, credential/proxy/MCP state, and local validation plan; proceed only after approval.
- For natural-language or LaTeX input, draft the Lean declaration and ask for confirmation before long proof work.
- Edit Lean directly in small steps for the default coding-agent path, using the distilled Lean-agent loop: inspect theorem state, build a local context pack, retrieve nearby lemmas before inventing, run bounded proof attempts, record failed routes, and extract minimal failures when blocked. If a backend adapter is approved, call it for proof search/formalization, then run Lean/Lake validation and patch safety checks before accepting results.
- Preserve theorem statements unless the user explicitly approves a change.
- Reject final patches that contain
sorry,admit, or newly introducedaxiom. - If blocked, stop cleanly with the smallest useful failing Lean fragment, exact errors/goals, and the next mathematical decision needed.
Helper Toolbox
Use python ../lean-runtime/scripts/ai4m_lean.py <command> when it saves effort or reduces risk:
env/doctor: inspect Lean workspace, local tool availability, and optional backend readiness when requested.configure --create-workspace: create or reuse the shared managed workspace.configure --setup-numina --project-name <name>: after user approval, clone/configure the official Numina runtime under${AI4MATH_HOME:-~/.ai4math}/numina-runtime/.smoke-test: run the bundled../lean-runtime/examples/smoke/LocalLeanSmoke.leantarget in the shared workspace without external API calls; this is a local Lean smoke theorem, not a Numina run.check: run a structured Lean/Lake validation.review/detect-sorry: guard against placeholders, axioms, and statement drift.minimize-failure: extract a compact failing Lean fragment.prove/formalize/repair/complete-sorries/batch: optional dry-run task envelopes for coding-agent bookkeeping; use a backend adapter only when the optional backend path is approved and documented.verify-delivery: validate this skill package.
All helper commands emit machine-readable JSON on stdout. Human-readable diagnostics go to stderr or log files.
Numina Runtime
When using the built-in recommended Numina adapter, follow ../lean-runtime/references/numina_runtime.md. For auth/proxy/MCP/failure triage, follow ../lean-runtime/references/numina_subagent_troubleshooting.md. For Archon or any other backend adapter, follow ../lean-runtime/references/backend_adapter_checklist.md. Proof strategy is a human-in-the-loop process with the user, the coding agent, local Lean checks, and, when approved, a documented backend adapter.
Safety Rules
- Do not call external model APIs or mutate Numina runtime state without approval.
- If the user asks for the official Lean Agent, Numina, Archon, batch proof search, or external subagent, explain needed credentials/setup directly.
- Do not commit local machine-specific paths.
- Do not call external APIs during
env,doctor,check,review,detect-sorry, tests, or dry-runs. - Do not store secrets in tracked files; use environment variables or
${AI4MATH_HOME:-~/.ai4math}/numina-runtime/.env.local. - Do not accept final Lean patches containing
sorry,admit, or newly introducedaxiom. - Do not silently weaken theorem statements or change existing project versions.
- Do not let helper command availability override a better coding-agent path.
- Do not remove the built-in official Numina adapter recipe.
References
- Read
../lean-runtime/references/direct_lean_workflow.mdfor the default coding-agent proof/repair/formalization loop. - Read
../lean-runtime/references/lean_agent_capability_map.mdwhen checking whether Lean-agent abilities have been distilled into the default workflow or delegated to adapters. - Read
../lean-runtime/references/lean_lsp_mcp_adapter.mdwhen the user asks to connect Lean LSP/MCP, goal-state MCP tooling, or MCP-backed theorem search. - Read
../lean-runtime/references/specialist_agent_patterns.mdwhen adapting ideas from Numina, LeanDojo/ReProver, LeanCopilot, COPRA-style proof search, Lean LSP/MCP, or other Lean-specialist agents. - Read
../lean-runtime/references/lean_runtime_configuration.mdwhen setting up or diagnosing the reusable Lean workspace. - Read
../lean-runtime/references/numina_runtime.mdwhen the user wants the official Numina deployment/call path. - Read
../lean-runtime/references/numina_subagent_troubleshooting.mdwhen Numina auth, proxy, MCP, or runner failures appear. - Read
../lean-runtime/references/backend_adapter_checklist.mdbefore connecting Archon or any other backend adapter. - Read
../lean-runtime/references/interactive_orchestration.mdwhen guiding user intake and task decomposition. - Read
../lean-runtime/references/review_checklist.mdbefore accepting a Lean patch. - Read
../lean-runtime/references/failure_taxonomy.mdwhen reporting a blocked proof. - Read
../lean-runtime/references/numina_reverse_analysis.mdwhen explaining which Numina mechanisms are incorporated locally and which are delegated to the optional official runtime.
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
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.

