mutable-state-inc/lean-collab/lean-syntax
Claude Code and agent skill by mutable-state-inc/lean-collab
- community
Checking that the SKILL.md file is still in the repository.
Install
npx vskill@latest install mutable-state-inc/lean-collab/lean-syntaxSKILL.md
Lean 4 Syntax Guide for Goal Generation
Use this skill when creating goals with `./bin/lc create-goal`.
This ensures your --goal-type and --hypotheses are syntactically valid Lean 4.
Function Application (NO PARENTHESES)
Lean 4 uses juxtaposition, not parentheses:
| WRONG | CORRECT | |||
|---|---|---|---|---|
sin(x) | Real.sin x | |||
cos(y) | Real.cos y | |||
exp(x) | Real.exp x | |||
log(x) | Real.log x | |||
sqrt(x) | Real.sqrt x | |||
abs(x) | ` | x | or abs x` | |
f(x, y) | f x y |
Multi-argument functions:
Real Number Constants
| WRONG | CORRECT | |
|---|---|---|
π | Real.pi | |
e | Real.exp 1 | |
0.5 | 1/2 (prefer rationals) | |
pi/2 | Real.pi / 2 |
Set Notation
Intervals
| Interval | Lean 4 Syntax | |
|---|---|---|
[a, b] | Set.Icc a b | |
(a, b) | Set.Ioo a b | |
[a, b) | Set.Ico a b | |
(a, b] | Set.Ioc a b |
Examples:
Set Membership
Hypotheses Format
Format: Double-semicolon (;;) separated name : type pairs
Why `;;`? Commas appear inside Lean types (like ∀ x ∈ S, P x), so we use ;; which never appears in valid Lean.
Quantifiers Are Now Safe
With ;; delimiter, quantified hypotheses work correctly:
Examples
| After decomposition | Hypotheses to pass | |
|---|---|---|
intro x hx | --hypotheses "x : ℝ;;hx : x ∈ Set.Icc 0 Real.pi" | |
intro c hc (membership) | --hypotheses "c : ℝ;;hc : ∀ x ∈ S, P x" | |
| Multiple intros | --hypotheses "a : ℝ;;ha : a > 0;;b : ℝ;;hb : b < 1" |
Parentheses Must Match
Count your parentheses! Common error:
Empty Hypotheses
Operators and Inequalities
| Symbol | Lean 4 | |
|---|---|---|
≤ | ≤ (Unicode) or <= | |
≥ | ≥ (Unicode) or >= | |
< | < | |
> | > | |
≠ | ≠ (Unicode) or != | |
∧ | ∧ (Unicode) or /\ | |
∨ | ∨ (Unicode) or \/ | |
→ | → (Unicode) or -> | |
∀ | ∀ (Unicode) or forall | |
∃ | ∃ (Unicode) or exists |
Division and Powers
Common Goal Patterns
IsGreatest / IsLeast
Quantifier Introduction
Conjunction
Validation Checklist
Before calling ./bin/lc create-goal, verify:
- Parentheses match - count
(and), must be equal - No commas in types - split quantified hypotheses
- Function application -
Real.sin xnotsin(x) - Intervals -
Set.Icc a bnot[a, b] - Constants -
Real.pinotπ - Spaces around operators -
a ≤ bnota≤b
🚨 Commonly Hallucinated Lemmas → Correct Names
LLMs frequently guess lemma names that don't exist. Use ./bin/lc suggest to get real ones, or consult this table.
Set/Metric Theory
| WRONG (Hallucinated) | CORRECT (Mathlib) | Notes | |
|---|---|---|---|
Metric.Sphere.infinite | Metric.sphere_infinite | Lowercase, underscore | |
Set.Infinite.diff | Set.Infinite.diff | Check signature - needs Finite second arg | |
Set.infinite_sphere | Metric.sphere_infinite | In Metric namespace | |
Metric.sphere.nonempty | Metric.nonempty_sphere | Prefix not suffix | |
Set.Infinite.inter | Set.Infinite.inter_of_left | Needs side specification |
Geometry/Euclidean
| WRONG (Hallucinated) | CORRECT (Mathlib) | Notes | |
|---|---|---|---|
EuclideanGeometry.sphere_infinite | Metric.sphere_infinite | It's in Metric | |
Affine.Simplex.circumcenter | Affine.Simplex.circumcenter | ✓ exists, check args | |
circumcenter_mem_sphere | Affine.Simplex.circumsphere_center_eq_circumcenter | Different name | |
Simplex.monochromatic | N/A | You need to define this |
Trigonometry
| WRONG (Hallucinated) | CORRECT (Mathlib) | Notes | |
|---|---|---|---|
Real.sin_le_one | Real.sin_le_one | ✓ exists | |
Real.two_div_pi_mul_le_sin | Real.two_div_pi_mul_le_sin | ✓ exists (Jordan) | |
sin_pos_of_pos_of_lt_pi | Real.sin_pos_of_pos_of_lt_pi | Need Real. prefix | |
sin_nonneg_of_nonneg_of_le_pi | Real.sin_nonneg_of_nonneg_of_le_pi | Need Real. prefix | |
cos_pos_of_mem_Ioo | Real.cos_pos_of_mem_Ioo | Need Real. prefix |
Cardinality/Finiteness
| WRONG (Hallucinated) | CORRECT (Mathlib) | Notes | |
|---|---|---|---|
Finset.card_le_three | N/A | Use Finset.card_le_of_subset | |
Set.nontrivial_of_card_ge_two | Set.nontrivial_of_two_le_card | Reversed name | |
Finite.of_card_le | Set.Finite.of_card_le | Need Set. prefix |
Convexity/Concavity
| WRONG (Hallucinated) | CORRECT (Mathlib) | Notes | |
|---|---|---|---|
ConcaveOn.sin | strictConcaveOn_sin_Icc | Different structure | |
concave_sin_Icc | strictConcaveOn_sin_Icc.concaveOn | Need .concaveOn | |
ConvexOn.le_right | ConvexOn.le_right_of_lt_left | Full name needed |
General Patterns
Naming conventions in Mathlib:
snake_casenotcamelCasefor lemmas- Prefix with namespace:
Real.sin_zeronotsin_zero - Predicates often have
_of_for implications:sin_pos_of_pos - Interval versions often have
_Icc,_Ioosuffix
When you get "unknown identifier":
Quick Reference
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/lean-syntax/SKILL.md
Popularity
- Repository stars
- 67
- Repository forks
- 1
- 7-day trend score
- 21
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 17 Mar 2026, 7 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/lean-syntax)