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.zip

Installs 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 phases
70 charsno explicit “when” trigger
Advanced

Key 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

You give it
Mathematical theorem
You get back
Formalized proof steps

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.

  1. 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 concepts
    

    Query syntax:

    • _ = any single type
    • ?a, ?b = type variables (same var = same type)
    • Foo, Bar = must mention both
  2. 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)?
  3. 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)
  4. 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.

  1. Create Lean file with:

    • Imports
    • Definitions needed
    • Main theorem statement
    • Helper lemmas as sorry
  2. Annotate each sorry:

    -- SORRY: needs proof (straightforward)
    -- SORRY: needs proof (complex - ~50 lines)
    -- AXIOM CANDIDATE: v₂ constraint - will test in Phase 3
    
  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:

  1. Generate test cases

    -- Create #eval or example statements
    #eval testLemma (randomInput1)  -- should return true
    #eval testLemma (randomInput2)  -- should return true
    
  2. Run tests

    lake env lean test_lemmas.lean
    
  3. 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:

  1. Pick a sorry
  2. Write proof attempt
  3. Compiler-in-the-loop checks (hook fires automatically)
  4. If error, Godel-Prover suggests fixes
  5. Iterate until sorry is filled
  6. 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.

  1. Axiom Audit

    lake build && grep "depends on axioms" output
    
    • Standard: propext, Classical.choice, Quot.sound ✓
    • Custom axioms: LIST EACH ONE
  2. Sorry Count

    grep -c "sorry" proofs/<file>.lean
    
    • Must be 0 for "complete" proof
  3. 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:

ToolBest ForCommand
LoogleType signature search (PRIMARY)loogle-search "pattern"
Nia MCPLibrary documentationmcp__nia__search
Perplexity MCPProof strategies, papersmcp__perplexity__search
WebSearchGeneral referencesWebSearch tool
WebFetchSpecific paper/page contentWebFetch 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

DomainExamples
Category TheoryFunctors, natural transformations, Yoneda
Abstract AlgebraGroups, rings, homomorphisms
TopologyContinuity, compactness, connectedness
AnalysisLimits, derivatives, integrals
LogicPropositional, 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

lean4elan

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.

SkillInstallsUpdatedSafetyDifficulty
prove (this skill)27moReviewAdvanced
nemo-evaluator-sdk16moReviewAdvanced
paper-version-compat01moNo flagsAdvanced
literature-review5592moReviewAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

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.

10

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

00

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.).

5591,298

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.

48202

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.

23226

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.

33188

Search skills

Search the agent skills registry