skills/43-wentorai-research-plugins/skills/domains/math/lean-theorem-proving-guide/SKILL.md
LLM agent for formal theorem proving in Lean 4
npx skillsauth add brycewang-stanford/Awesome-Agent-Skills-for-Empirical-Research lean-theorem-proving-guideInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
LeanAgent is an LLM-based agent for automated theorem proving in Lean 4, a modern proof assistant. It combines LLM reasoning with formal verification — proposing proof steps that are verified by Lean's type checker. Can prove novel theorems, not just benchmarks, by exploring proof strategies, backtracking on failures, and learning from successful proofs.
Theorem Statement (Lean 4)
↓
Goal Analysis Agent (understand proof obligations)
↓
Tactic Suggestion Agent (propose proof steps)
↓
Lean 4 Verification (check tactic correctness)
↓
Backtracking (if tactic fails, try alternatives)
↓
Proof or timeout
from lean_agent import LeanAgent
agent = LeanAgent(
llm_provider="anthropic",
lean_path="/path/to/lean4",
)
# Prove a theorem
result = agent.prove(
theorem="""
theorem add_comm (m n : Nat) : m + n = n + m := by
sorry
""",
max_attempts=50,
timeout=120,
)
if result.proved:
print("Proof found!")
print(result.proof)
else:
print(f"Failed. Best attempt:\n{result.best_attempt}")
print(f"Remaining goals: {result.remaining_goals}")
# Configure search strategy
agent = LeanAgent(
search_config={
"strategy": "best_first", # best_first, bfs, dfs
"max_depth": 20, # Max proof steps
"beam_width": 5, # Tactics to try per step
"temperature": 0.7, # LLM sampling temp
"backtrack_on_fail": True,
},
)
# Interactive proof mode
session = agent.interactive_prove(
theorem="theorem my_thm : ∀ n : Nat, n + 0 = n := by"
)
while not session.done:
print(f"Current goals:\n{session.goals}")
tactics = session.suggest_tactics(k=5)
for i, t in enumerate(tactics):
print(f" {i}: {t.tactic} (confidence: {t.score:.2f})")
# Agent automatically picks best tactic
session.step()
-- Common tactics LeanAgent uses:
-- intro, apply, exact, rfl, simp, omega
-- induction, cases, constructor, ext
-- rw, calc, have, let, show
-- Example theorem + proof
theorem list_append_nil (l : List α) : l ++ [] = l := by
induction l with
| nil => simp
| cons h t ih => simp [ih]
# Prove multiple theorems
theorems = [
"theorem t1 : 1 + 1 = 2 := by sorry",
"theorem t2 (n : Nat) : n + 0 = n := by sorry",
"theorem t3 (n m : Nat) : n + m = m + n := by sorry",
]
results = agent.prove_batch(
theorems=theorems,
parallel=True,
timeout_per=60,
)
for thm, result in zip(theorems, results):
status = "PROVED" if result.proved else "FAILED"
print(f"[{status}] {thm[:50]}...")
tools
Recommend AND run open-source AI tools, agents, Claude Code / Codex skills, and MCP servers for any stage of a literature review — searching, reading, extracting, synthesizing, screening, citation-checking, and paper writing. Use when the user asks "what tool should I use to..." OR "install/run/use <tool> to ..." for research/lit-review work: automating a survey or related-work section, PDF→Markdown extraction for LLMs (MinerU/marker/docling), PRISMA / systematic review (ASReview), citation-backed Q&A over PDFs (PaperQA2), wiring papers into Claude/Cursor via MCP (arxiv/paper-search/zotero servers), or chatting with a Zotero library. Ships a launcher (scripts/litrun.py) that installs each tool in an isolated venv and runs it. Curated catalog of 70+ vetted projects. 支持中英文(用于「文献综述工具选型」与「一键安装/运行」)。
development
Route empirical-research requests through the Auto-Empirical Research Skills catalog when this whole repository is installed as one skill in Codex, CodeBuddy, Claude Code, or another IDE. Use to choose and load the right vendored AERS skill for causal inference, econometrics, replication, data acquisition, manuscript writing, peer review and referee responses, citation checking, de-AIGC editing, or full empirical-paper workflows without reading the entire repository at once.
documentation
Use when the project collects primary data or runs a field, lab, or survey experiment, before the intervention begins — write the pre-analysis plan, size the sample from a power calculation, and register with the AEA RCT Registry. Apply after the design is chosen in aer-identification and before any outcome data are seen.
tools
Guide economists to authoritative data sources with explicit, confirmed data specifications before retrieval; interfaces with Playwright MCP to navigate portals and extract real data, not articles about data.