mutable-state-inc/lean-collab/mathlib-knowledge
Claude Code and agent skill by mutable-state-inc/lean-collab
- community
Checking that the SKILL.md file is still in the repository.
Mathlib reference for lean-prover agents. Use AFTER MATH CARD analysis.
Install
npx vskill@latest install mutable-state-inc/lean-collab/mathlib-knowledgeSKILL.md
Mathlib Reference
This is a REFERENCE, not a decision tree. Use it AFTER your MATH CARD analysis to find the right tactic.
How to Use This Skill
- Complete MATH CARD analysis first (understand what hypotheses you need to use)
- Based on your analysis, consult this reference for:
- Tactic syntax for your approach
- Lemma names that match your strategy
- Common patterns for your goal structure
Never pattern-match goal type → tactic blindly. Always reason first.
Tactic Reference
| When your analysis shows... | Tactic | |
|---|---|---|
| Pure computation needed | norm_num, decide | |
| Ring/field algebra | ring, field_simp | |
| Linear arithmetic | omega, linarith | |
| Nonlinear with known bounds | nlinarith [hints] | |
| Need to use a hypothesis | exact h, apply h, rw [h] | |
| Need to construct a pair/tuple | exact ⟨_, _⟩, constructor | |
| Need to provide a witness | use witness, refine ⟨w, ?_⟩ |
Mathlib Naming Conventions
Learn these patterns - they unlock the library:
Operations
| Pattern | Meaning | Example | |
|---|---|---|---|
add_ | About addition | add_comm, add_assoc | |
mul_ | About multiplication | mul_comm, mul_one | |
sub_ | About subtraction | sub_self, sub_add_cancel | |
div_ | About division | div_self, div_mul_cancel | |
pow_ | About powers | pow_zero, pow_succ | |
neg_ | About negation | neg_neg, neg_add | |
inv_ | About inverse | inv_inv, mul_inv_cancel |
Relations
| Pattern | Meaning | Example | |
|---|---|---|---|
_le_ | Less or equal | add_le_add, mul_le_mul | |
_lt_ | Strictly less | add_lt_add, mul_lt_mul | |
_eq_ | Equality | add_eq_zero, mul_eq_one | |
_ne_ | Not equal | mul_ne_zero | |
_pos | Positive | mul_pos, add_pos | |
_neg | Negative | mul_neg, neg_neg_of_pos | |
_nonneg | Non-negative | mul_nonneg, sq_nonneg | |
_nonpos | Non-positive | mul_nonpos_of_nonneg_of_nonpos |
Transformations
| Pattern | Meaning | Example | |
|---|---|---|---|
_of_ | Derives from | le_of_lt, pos_of_ne_zero | |
_iff_ | Biconditional | lt_iff_le_not_le | |
_comm | Commutativity | add_comm, mul_comm | |
_assoc | Associativity | add_assoc, mul_assoc | |
_cancel | Cancellation | add_left_cancel, mul_right_cancel | |
_inj | Injectivity | add_left_inj |
Structures
| Pattern | Meaning | Example | |
|---|---|---|---|
IsLeast | Minimum element | IsLeast.mem, IsLeast.le | |
IsGreatest | Maximum element | IsGreatest.mem, IsGreatest.le | |
Monotone | Order preserving | Monotone.comp | |
StrictMono | Strictly increasing | StrictMono.lt_iff_lt | |
Convex | Convex set/function | ConvexOn.le_right | |
Concave | Concave function | ConcaveOn.le_left |
Critical Lemmas by Domain
Real Analysis (Mathlib.Analysis.SpecialFunctions)
Sine and Cosine:
Exponential and Logarithm:
Pi:
Inequalities (Mathlib.Algebra.Order)
The Big Three - Memorize These:
Squares and Positivity:
Monotonicity Helpers:
Convexity (Mathlib.Analysis.Convex)
The Secret Weapon for Transcendental Inequalities:
Key Concavity Facts:
Using Concavity for sin x ≥ linear bounds:
Sets and Intervals (Mathlib.Order.Interval)
Number Theory (Mathlib.NumberTheory)
Strategic Patterns
Pattern 1: Prove Inequality via Monotonicity
Pattern 2: Prove Inequality via Convexity
Pattern 3: Prove Bound via Known Bounds
Pattern 4: Prove Equality via Squeeze
Pattern 5: Prove Positivity
Pattern 6: Transcendental Inequality
nlinarith Mastery
nlinarith is your workhorse for nonlinear arithmetic. Feed it the right hints:
Pro tip: If nlinarith fails, try:
- Adding more
sq_nonneghints - Multiplying inequalities:
have := mul_nonneg h1 h2 - Rewriting to simpler form first:
ring_nfthennlinarith
Common Proof Skeletons
Proving IsLeast/IsGreatest
Proving ∀ x ∈ Interval
Proving Existential with Specific Witness
Debugging Failed Tactics
| Tactic | Common Failure | Fix | |
|---|---|---|---|
norm_num | Non-numeric terms | Extract numeric part, prove separately | |
ring | Non-ring structure | Check for division, use field_simp first | |
nlinarith | Missing nonlinear facts | Add sq_nonneg, mul_pos hints | |
omega | Non-integer types | Only works on ℤ, ℕ, convert first | |
simp | Wrong lemmas | Use simp only [specific_lemmas] | |
exact | Type mismatch | Check implicit arguments with @exact |
Import Checklist
If a lemma isn't found, you may need these imports:
Quick Reference Card
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/mathlib-knowledge/SKILL.md
Popularity
- Repository stars
- 72
- Repository forks
- 2
- 7-day trend score
- 21
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 25 Apr 2026, 6 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/mutable-state-inc/lean-collab/mathlib-knowledge)