AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified Apache-2.0 Self-run

Lean Proving

skill-matt-w-horn-lean-skills-lean-proving · by matt-w-horn

Write and plan Lean 4 proofs and definitions. Use whenever a task adds or changes Lean source — proving a new theorem, stating a definition, fixing a broken proof, closing a `sorry` — and equally for the design questions that come first: "could we prove X?", "how would I show Y?", "is this feasible in Lean?", "how should I phrase this statement?", "where do the quantifiers go?", "do I actually ne…

No reviews yet
0 installs
38 views
0.0% view→install

Install

$ agentstack add skill-matt-w-horn-lean-skills-lean-proving

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-matt-w-horn-lean-skills-lean-proving)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
1mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Lean Proving? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Writing Lean

Lean gives you a kernel that cannot be fooled and an error surface that is frequently opaque. The work divides into two halves that fail in different ways: getting the statement right, which the kernel cannot help you with, and getting the proof through, which it can. Most wasted effort in a Lean session comes from proving a statement that did not say what the author meant, or from guessing lemma names instead of looking them up.

Repo conventions override everything here, so read the project's CLAUDE.md and any repo-local build or verify skill first. Every lemma name and tactic below is true only relative to a version, so establish the pin:

cat lean-toolchain           # e.g. leanprover/lean4:v4.32.0
cat lakefile.toml            # or lakefile.lean, for the Mathlib rev

Design the statement before writing any tactic (references/statement-design.md); a statement that is junk-true at a degenerate corner passes the kernel and proves nothing. Search before proving, because Mathlib has ~200k declarations and the odds of guessing a name are low (references/finding-lemmas.md). Then end green: lake build plus whatever the project adds on top, such as a linter, an axiom audit, or negative tests.

Never cite a lemma or tactic you have not confirmed at this pin

Mathlib renames and deprecates continuously. At v4.32.0, push_neg still elaborates but logs "push_neg" has been deprecated. Prefer using "push Not" instead, and div_add_div_same is gone. A remembered name is a hypothesis until confirmed, and the feedback loop for a wrong guess is a full rebuild.

Three ways to confirm, fastest first:

# 1. Grep the Mathlib source that is already on disk at your exact pin
grep -rn "theorem mul_le_mul_left" .lake/packages/mathlib/Mathlib/ | head

# 2. Ask loogle by shape rather than by name (see the `loogle` skill)
loogle '|- _ * _ ≤ _ * _'
-- 3. Ask Lean itself, in the file, where the context is exact
#check @mul_le_mul_left
example (a b : ℝ) (h : a ≤ b) : a + 1 ≤ b + 1 := by exact?

exact? and apply? search the loaded environment and print an exact … you can paste; rw? does the same for rewrites. Slow, but authoritative.

When a proof will not go through

After a tactic path fails twice, the problem is usually the statement or the lemma choice rather than the tactic. Permuting simp sets is cheap to try and expensive to finish, so it feels productive while consuming the session.

Print the goal with set_option pp.all true or pp.explicit true before the failing tactic: goals that look identical often differ in an implicit argument, a coercion, or an instance. Check the claim is true at all by instantiating at concrete numbers with norm_num, or by looking for the degenerate corner; a surprising number of stuck proofs are stuck because the claim is false as written. Localize the difficulty with have h : ⟨smaller claim⟩ := by sorry and see whether the rest closes. If the ambient theory is in Mathlib there is usually a named road in, findable by searching on conclusion shape rather than concept name.

Adding a declaration

Name it by Mathlib convention (references/naming.md) so that readers can guess it and search finds it. Give it a docstring that claims exactly what the statement proves, no more: docstring honesty is the review boundary the kernel cannot check. Prefer a corollary of existing machinery to a fresh proof, and resist factoring out a helper used once, since every named declaration widens the surface that later changes have to preserve.

References

| File | Read it when | |---|---| | references/tactics.md | Choosing a tactic; needing the verified inventory at a pin | | references/finding-lemmas.md | Looking for an existing lemma, definition, or idiom | | references/statement-design.md | Writing a statement or definition; worried it is junk-true | | references/errors.md | An error message or elaboration failure is opaque | | references/naming.md | Naming a declaration Mathlib-style |

Sibling skills: lean-refactoring for golfing, simplifying, or restructuring existing proofs while every statement stays frozen; lean-verification for checking that a finished proof proves what it claims; lean-latex-sync for the prose or LaTeX that has to change alongside the Lean; lake for builds, toolchains, and dependencies; loogle for shape-based lemma search.

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.