
Lean4 Prover
- 16 installs
- 869 repo stars
- Updated June 8, 2026
- beita6969/scienceclaw
Lean4-prover is a Claude skill for formal theorem proving and program verification in the Lean 4 theorem prover, covering tactics, Mathlib, and project setup.
About
Lean4-prover guides formal theorem proving, mathematical verification, and proof search in the Lean 4 theorem prover. It covers core tactics, Mathlib usage, lakefile project setup, and REPL interaction. A developer uses it for formalized mathematics or program verification rather than numerical or symbolic computation.
- Formal theorem proving and program verification in Lean 4
- Covers core tactics (intro, apply, simp, ring, omega, linarith) and Mathlib
- Includes lakefile project setup and REPL interaction patterns
Lean4 Prover by the numbers
- 16 all-time installs (skills.sh)
- Ranked #409 of 597 Debugging skills by installs in the Skillselion catalog
- Data as of Aug 2, 2026 (Skillselion catalog sync)
lean4-prover capabilities & compatibility
Free; requires the open-source Lean 4 toolchain
- Capabilities
- linear solvers
- Platforms
- macOS · Linux
- Pricing
- Free
What lean4-prover says it does
Lean 4 theorem prover for formal verification.
Formal theorem proving, mathematical verification, proof search, and type theory exploration.
npx skills add https://github.com/beita6969/scienceclaw --skill lean4-proverAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 16 |
|---|---|
| repo stars | ★ 869 |
| Last updated | June 8, 2026 |
| Repository | beita6969/scienceclaw ↗ |
What it does
Write and check formal proofs in Lean 4 for theorem proving or program verification.
Who is it for?
Formal theorem proving, formalized mathematics with Mathlib, and program verification in Lean 4.
Skip if: Numerical computation, symbolic algebra, or statistical analysis.
When should I use this skill?
You need to prove a theorem or verify a program formally in Lean 4.
What you get
A checked Lean 4 proof or verified statement using appropriate tactics and Mathlib.
- Checked Lean 4 proofs
- Lakefile-based Lean project
By the numbers
- Documents ~13 core Lean tactics
Files
Lean 4 Theorem Prover
Formal theorem proving, mathematical verification, proof search, and type theory exploration.
When to Use / When NOT to Use
Use when: formal theorem proving, mathematical verification, proof search, type-theoretic reasoning, formalized mathematics with Mathlib, program verification.
NOT for: numerical computation (use scipy/numpy), symbolic algebra or calculus (use sympy), statistical analysis (use statsmodels), quick calculations.
Installation
If lean is not available, install via elan (the Lean version manager):
curl https://elan.lean-lang.org/install.sh -sSf | sh
# or on macOS:
brew install elan-init
elan default leanprover/lean4:stableBasic Theorem Structure
-- Simple proposition proof
theorem my_first_theorem : 1 + 1 = 2 := by
rfl
-- Implication
theorem modus_ponens (P Q : Prop) (hp : P) (hpq : P → Q) : Q := by
apply hpq
exact hp
-- Universal quantifier
theorem add_comm_example : ∀ (a b : Nat), a + b = b + a := by
intro a b
omegaCore Tactics
-- intro: introduce hypotheses / universally quantified variables
-- apply: apply a function or lemma to the goal
-- exact: provide the exact proof term
-- rfl: reflexivity (proves a = a or definitional equalities)
-- simp: simplification using simp lemmas
-- ring: prove equalities in commutative rings
-- omega: decide linear arithmetic over Nat and Int
-- linarith: linear arithmetic reasoning with hypotheses
-- cases / rcases: case split on inductive types
-- induction: structural induction
-- constructor: prove a conjunction or existential
-- contradiction: close goal from contradictory hypotheses
-- Example combining tactics
theorem example_proof (n : Nat) (h : n > 0) : n + n > n := by
linarith
theorem ring_example (a b : Int) : (a + b) ^ 2 = a ^ 2 + 2 * a * b + b ^ 2 := by
ringProject Setup with Lakefile
# Create a new Lean 4 project
lake new my_project
cd my_project
# Project structure:
# my_project/
# lakefile.lean -- build config
# lean-toolchain -- Lean version
# MyProject/
# Basic.lean -- source files-- lakefile.lean (with Mathlib dependency)
import Lake
open Lake DSL
package my_project where
leanOptions := #[⟨`autoImplicit, false⟩]
require mathlib from git
"https://github.com/leanprover-community/mathlib4" @ "master"
@[default_target]
lean_lib MyProject where
srcDir := "MyProject"lake update # fetch dependencies
lake build # build the projectUsing Mathlib
import Mathlib.Tactic
import Mathlib.Data.Nat.Basic
import Mathlib.Data.List.Basic
-- Mathlib provides thousands of lemmas and tactics
theorem list_length_append (l1 l2 : List α) :
(l1 ++ l2).length = l1.length + l2.length := by
simp [List.length_append]
-- norm_num: evaluate numerical expressions
example : (7 : ℤ) ∣ 42 := by norm_num
-- positivity: prove positivity/nonnegativity
example (x : ℝ) : 0 ≤ x ^ 2 + 1 := by positivity
-- polyrith: polynomial arithmetic (requires Mathlib)
-- gcongr: generalized congruence
-- field_simp: clear denominators in field expressionsREPL Interaction
# Run a single Lean file
lean MyFile.lean
# Check a file and print messages
lean --run MyFile.lean
# Interactive: use VS Code with lean4 extension for goal state
# Or use lean4 language server directly-- Use #check, #eval, #print for exploration
#check Nat.add_comm -- view type signature
#eval 2 ^ 10 -- evaluate expressions
#print Nat.rec -- print definitionBest Practices
1. Set autoImplicit to false in lakefile to catch typos in variable names. 2. Use sorry as a placeholder while developing proofs, then eliminate all before finalizing. 3. Start proofs with by block and use ? suffix tactics (e.g., simp?, exact?) to discover lemmas. 4. Use #check liberally to inspect types and available lemmas. 5. Keep proofs modular: extract helper lemmas rather than writing monolithic proofs. 6. For Mathlib projects, run lake exe cache get to download prebuilt oleans and speed up builds. 7. Use omega for natural/integer arithmetic goals; ring for polynomial identities; linarith when hypotheses are needed.
Related skills
FAQ
What is lean4-prover for?
Formal theorem proving, mathematical verification, proof search, and type-theoretic reasoning, including formalized mathematics with Mathlib and program verification.
When should I not use it?
Not for numerical computation (use scipy), symbolic algebra (use sympy), or statistical analysis (use statsmodels).