Formal verification and theorem proving assistant using Lean 4.
Install
mkdir -p .claude/skills/prove && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/2012" && unzip -o skill.zip -d .claude/skills/prove && rm skill.zipInstalls to .claude/skills/prove
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Formal theorem proving with research, testing, and verification phasesKey capabilities
- →Search Mathlib for lemmas
- →Formalize theorem design
- →Verify logical statements
- →Execute Lean4 proof implementations
How it works
Utilizes a five-phase research and verification workflow to build proofs in the Lean environment.
Inputs & outputs
When to use prove
- →Formalize mathematical theorems
- →Search for existing proofs in Mathlib
- →Verify logical statements
- →Test proof implementations
About this skill
/prove - Machine-Verified Proofs (5-Phase Workflow)
For mathematicians who want verified proofs without learning Lean syntax.
Prerequisites
Before using this skill, check Lean4 is installed:
# Check if lake is available
command -v lake &>/dev/null && echo "Lean4 installed" || echo "Lean4 NOT installed"
If not installed:
# Install elan (Lean version manager)
curl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf | sh
# Restart shell, then verify
lake --version
First run of /prove will download Mathlib (~2GB) via lake build.
Usage
/prove every group homomorphism preserves identity
/prove Monsky's theorem
/prove continuous functions on compact sets are uniformly continuous
The 5-Phase Workflow
┌─────────────────────────────────────────────────────────────┐
│ 📚 RESEARCH → 🏗️ DESIGN → 🧪 TEST → ⚙️ IMPLEMENT → ✅ VERIFY │
└─────────────────────────────────────────────────────────────┘
Phase 1: RESEARCH (before any Lean)
Goal: Understand if/how this can be formalized.
-
Search Mathlib with Loogle (PRIMARY - type-aware search)
# Use loogle for type signature search - finds lemmas by shape loogle-search "pattern_here" # Examples: loogle-search "Nontrivial _ ↔ _" # Find Nontrivial lemmas loogle-search "(?a → ?b) → List ?a → List ?b" # Map-like functions loogle-search "IsCyclic, center" # Multiple conceptsQuery syntax:
_= any single type?a,?b= type variables (same var = same type)Foo, Bar= must mention both
-
Search External - What's the known proof strategy?
- Use Nia MCP if available:
mcp__nia__search - Use Perplexity MCP if available:
mcp__perplexity__search - Fall back to WebSearch for papers/references
- Check: Is there an existing formalization elsewhere (Coq, Isabelle)?
- Use Nia MCP if available:
-
Identify Obstacles
- What lemmas are NOT in Mathlib?
- Does proof require axioms beyond ZFC? (Choice, LEM, etc.)
- Is the statement even true? (search for counterexamples)
-
Output: Brief summary of proof strategy and obstacles
CHECKPOINT: If obstacles found, use AskUserQuestion:
- "This requires [X]. Options: (a) restricted version, (b) accept axiom, (c) abort"
Phase 2: DESIGN (skeleton with sorries)
Goal: Build proof structure before filling details.
-
Create Lean file with:
- Imports
- Definitions needed
- Main theorem statement
- Helper lemmas as
sorry
-
Annotate each sorry:
-- SORRY: needs proof (straightforward) -- SORRY: needs proof (complex - ~50 lines) -- AXIOM CANDIDATE: v₂ constraint - will test in Phase 3 -
Verify skeleton compiles (with sorries)
Output: proofs/<theorem_name>.lean with annotated structure
Phase 3: TEST (counterexample search)
Goal: Catch false lemmas BEFORE trying to prove them.
For each AXIOM CANDIDATE sorry:
-
Generate test cases
-- Create #eval or example statements #eval testLemma (randomInput1) -- should return true #eval testLemma (randomInput2) -- should return true -
Run tests
lake env lean test_lemmas.lean -
If counterexample found:
- Report the counterexample
- Use AskUserQuestion: "Lemma is FALSE. Options: (a) restrict domain, (b) reformulate, (c) abort"
CHECKPOINT: Only proceed if all axiom candidates pass testing.
Phase 4: IMPLEMENT (fill sorries)
Goal: Complete the proofs.
Standard iteration loop:
- Pick a sorry
- Write proof attempt
- Compiler-in-the-loop checks (hook fires automatically)
- If error, Godel-Prover suggests fixes
- Iterate until sorry is filled
- Repeat for all sorries
Tools active:
- compiler-in-the-loop hook (on every Write)
- Godel-Prover suggestions (on errors)
Phase 5: VERIFY (audit)
Goal: Confirm proof quality.
-
Axiom Audit
lake build && grep "depends on axioms" output- Standard: propext, Classical.choice, Quot.sound ✓
- Custom axioms: LIST EACH ONE
-
Sorry Count
grep -c "sorry" proofs/<file>.lean- Must be 0 for "complete" proof
-
Generate Summary
✓ MACHINE VERIFIED (or ⚠️ PARTIAL - N axioms) Theorem: <statement> Proof Strategy: <brief description> Proved: - <lemma 1> - <lemma 2> Axiomatized (if any): - <axiom>: <why it's needed> File: proofs/<name>.lean
Research Tool Priority
Use whatever's available, in order:
| Tool | Best For | Command |
|---|---|---|
| Loogle | Type signature search (PRIMARY) | loogle-search "pattern" |
| Nia MCP | Library documentation | mcp__nia__search |
| Perplexity MCP | Proof strategies, papers | mcp__perplexity__search |
| WebSearch | General references | WebSearch tool |
| WebFetch | Specific paper/page content | WebFetch tool |
Loogle setup: Requires ~/tools/loogle with Mathlib index. Run loogle-server & for fast queries.
If no search tools available, proceed with caution and note "research phase skipped".
Checkpoints (automatic)
The workflow pauses for user input when:
- ⚠️ Research finds obstacles
- ❌ Testing finds counterexamples
- 🔄 Implementation hits unfillable sorry after N attempts
Output Format
┌─────────────────────────────────────────────────────┐
│ ✓ MACHINE VERIFIED │
│ │
│ Theorem: ∀ φ : G →* H, φ(1_G) = 1_H │
│ │
│ Proof Strategy: Direct application of │
│ MonoidHom.map_one from Mathlib. │
│ │
│ Phases: │
│ 📚 Research: Found in Mathlib.Algebra.Group.Hom │
│ 🏗️ Design: Single lemma, no sorries needed │
│ 🧪 Test: N/A (trivial) │
│ ⚙️ Implement: 3 lines │
│ ✅ Verify: 0 custom axioms, 0 sorries │
│ │
│ File: proofs/group_hom_identity.lean │
└─────────────────────────────────────────────────────┘
What I Can Prove
| Domain | Examples |
|---|---|
| Category Theory | Functors, natural transformations, Yoneda |
| Abstract Algebra | Groups, rings, homomorphisms |
| Topology | Continuity, compactness, connectedness |
| Analysis | Limits, derivatives, integrals |
| Logic | Propositional, first-order |
Limitations
- Complex proofs may take multiple iterations
- Novel research-level proofs may exceed capabilities
- Some statements are unprovable over ℚ (need ℝ extension)
Behind The Scenes
- Lean 4.26.0 - Theorem prover
- Mathlib - 100K+ formalized theorems
- Godel-Prover - AI tactic suggestions (via LMStudio)
- Compiler-in-the-loop - Automatic verification on every write
- Research tools - Nia, Perplexity, WebSearch (graceful degradation)
See Also
/loogle-search- Search Mathlib by type signature (used in Phase 1 RESEARCH)/math-router- For computation (integrals, equations)/lean4- Direct Lean syntax access
When not to use it
- →Writing non-formalized documentation
- →Simple math homework
- →Non-Lean4 research projects
Prerequisites
Limitations
- →Requires significant compute for large proofs
- →Depends on Mathlib library coverage
How it compares
It provides machine-verified proof steps instead of informal derivation.
Compared to similar skills
prove side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| prove (this skill) | 2 | 7mo | Review | Advanced |
| nemo-evaluator-sdk | 1 | 6mo | Review | Advanced |
| paper-version-compat | 0 | 1mo | No flags | Advanced |
| literature-review | 559 | 2mo | Review | Advanced |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by parcadei
View all by parcadei →You might also like
nemo-evaluator-sdk
davila7
Evaluates LLMs across 100+ benchmarks from 18+ harnesses (MMLU, HumanEval, GSM8K, safety, VLM) with multi-backend execution. Use when needing scalable evaluation on local Docker, Slurm HPC, or cloud platforms. NVIDIA's enterprise-grade platform with container-first architecture for reproducible benchmarking.
paper-version-compat
PhyschicWinter9
Repeatable procedure for validating and honestly documenting a Bukkit/Paper/Folia plugin's compatibility when a new Minecraft/Paper version ships — research-first API checking, build strategy, runtime verification, and maintaining a tested-vs-assumed compatibility matrix. Use whenever a new Minecraf
literature-review
K-Dense-AI
Conduct comprehensive, systematic literature reviews using multiple academic databases (PubMed, arXiv, bioRxiv, Semantic Scholar, etc.). This skill should be used when conducting systematic literature reviews, meta-analyses, research synthesis, or comprehensive literature searches across biomedical, scientific, and technical domains. Creates professionally formatted markdown documents and PDFs with verified citations in multiple citation styles (APA, Nature, Vancouver, etc.).
openalex-database
davila7
Query and analyze scholarly literature using the OpenAlex database. This skill should be used when searching for academic papers, analyzing research trends, finding works by authors or institutions, tracking citations, discovering open access publications, or conducting bibliometric analysis across 240M+ scholarly works. Use for literature searches, research output analysis, citation analysis, and academic database queries.
linkedin-sales-navigator-alt
OneWave-AI
Build targeted prospect lists by analyzing LinkedIn profiles, extracting job titles, companies, locations, and recent activity. Identifies decision-makers, tracks job changes for warm outreach, and enriches contact data. Use when users need to find prospects, build lead lists, or track decision-maker movements.
web-search
Igosuki
This skill should be used when users need to search the web for information, find current content, look up news articles, search for images, or find videos. It uses DuckDuckGo's search API to return results in clean, formatted output (text, markdown, or JSON). Use for research, fact-checking, finding recent information, or gathering web resources.