lean4-theorem-proving
БесплатноБез исполняемых скриптовНе проверенUse when working with Lean 4 (.lean files), writing mathematical proofs, seeing "failed to synthesize instance" errors, managing sorry/axiom elimination, or…
Об этом скилле
Lean 4 Theorem Proving
Core Principle
Build incrementally, structure before solving, trust the type checker. Lean's type checker is your test suite.
Success = lake build passes + zero sorries + zero custom axioms. Theorems with sorries/axioms are scaffolding, not results.
Quick Reference
| Resource | What You Get | Where to Find |
|---|---|---|
| Interactive Commands | 10 slash commands for search, analysis, optimization, repair | Type /lean in Claude Code (full guide) |
| Automation Scripts | 19 tools for search, verification, refactoring, repair | Plugin scripts/ directory (scripts/README.md) |
| Subagents | 4 specialized agents for batch tasks (optional) | subagent-workflows.md |
| LSP Server | 30x faster feedback with instant proof state (optional) | lean-lsp-server.md |
| Reference Files | 18 detailed guides (phrasebook, tactics, patterns, errors, repair, performance) | List below |
When to Use
Use for ANY Lean 4 development: pure/applied math, program verification, mathlib contributions.
Critical for: Type class synthesis errors, sorry/axiom management, mathlib search, measure theory/probability work.
Tools & Workflows
7 slash commands for search, analysis, and optimization - type /lean in Claude Code. See COMMANDS.md for full guide with examples and workflows.
16 automation scripts for search, verification, and refactoring. See scripts/README.md for complete documentation.
Lean LSP Server (optional) provides 30x faster feedback with instant proof state and parallel tactic testing. See lean-lsp-server.md for setup and workflows.
Subagent delegation (optional, Claude Code users) enables batch automation. See subagent-workflows.md for patterns.
Build-First Principle
ALWAYS compile before committing. Run lake build to verify. "Compiles" ≠ "Complete" - files can compile with sorries/axioms but aren't done until those are eliminated.
The 4-Phase Workflow
- Structure Before Solving - Outline proof strategy with
havestatements and documented sorries before writing tactics - Helper Lemmas First - Build infrastructure bottom-up, extract reusable components as separate lemmas
- Incremental Filling - Fill ONE sorry at a time, compile after each, commit working code
- Type Class Management - Add explicit instances with
haveI/letIwhen synthesis fails, respect binder order for sub-structures
Finding and Using Mathlib Lemmas
Philosophy: Search before prove. Mathlib has 100,000+ theorems.
Use /search-mathlib slash command, LSP server search tools, or automation scripts. See mathlib-guide.md for detailed search techniques, naming conventions, and import organization.
Essential Tactics
Key tactics: simp only, rw, apply, exact, refine, by_cases, rcases, ext/funext. See tactics-reference.md for comprehensive guide with examples and decision trees.
Domain-Specific Patterns
Analysis & Topology: Integrability, continuity, compactness patterns. Tactics: continuity, fun_prop.
Algebra: Instance building, quotient constructions. Tactics: ring, field_simp, group.
Measure Theory & Probability (emphasis in this skill): Conditional expectation, sub-σ-algebras, a.e. properties. Tactics: measurability, positivity. See measure-theory.md for detailed patterns.
Complete domain guide: domain-patterns.md
Managing Incomplete Proofs
Standard mathlib axioms (acceptable): Classical.choice, propext, quot.sound. Check with #print axioms theorem_name or /check-axioms.
CRITICAL: Sorries/axioms are NOT complete work. A theorem that compiles with sorries is scaffolding, not a result. Document every sorry with concrete strategy and dependencies. Search mathlib exhaustively before adding custom axioms.
When sorries are acceptable: (1) Active work in progress with documented plan, (2) User explicitly approves temporary axioms with elimination strategy.
Not acceptable: "Should be in mathlib", "infrastructure lemma", "will prove later" without concrete plan.
Compiler-Guided Proof Repair
When proofs fail to compile, use iterative compiler-guided repair instead of blind resampling.
Quick repair: /lean4-theorem-proving:repair-file FILE.lean
How it works:
- Compile → extract structured error (type, location, goal, context)
- Try automated solver cascade first (many simple cases handled mechanically, zero LLM cost)
- Order: `rfl → simp → ring → linarith → nlinarith → o
Установить lean4-theorem-proving в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл lean4-theorem-proving?
Use when working with Lean 4 (.lean files), writing mathematical proofs, seeing "failed to synthesize instance" errors, managing sorry/axiom elimination, or searching mathlib for lemmas - provides build-first workflow, haveI/letI patterns, compiler-guided repair, and LSP integration
Как установить скилл lean4-theorem-proving?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл lean4-theorem-proving запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic