9,150 modules, made friendly

Ismail's Glossary

A complete guide to Lean 4 and Mathlib —
from your first proof to the full mathematical library.

Four tools. One site. Everything you need to learn, navigate, and work with Mathlib4.

Lean ProverV4.30.0
Mathlib4V4.30.0
Glossary last updated15 June 2026
Orientation

Who Is This For?

New to Lean or Mathlib

Start with Getting Started to install your environment on Windows or macOS, check your system requirements, and run your first proof. Then use Lean 4 References as a progressive guide from orientation through advanced tactics.

Learning to navigate Mathlib

Open the Atlas first — see how the 32 domains relate and where they diverge from shared foundations. Once you know roughly where you are, switch to the Glossary to drill down to the exact file and read its full description.

Working with Mathlib daily

Search all 9,150 modules by name, path, or description in the Glossary and copy import or local paths in one click. Use the Lean 4 References as a quick-lookup for tactics, attributes, and automation — the decision guide tells you exactly which tactic to reach for.

Two ways into the library

The Atlas and the Glossary

The map — orientation

Atlas

A visual survey of how Mathlib's domains relate and diverge from shared foundations — measure theory sits near both analysis and probability; follow each deep enough and they part ways. Drag to pan, scroll to zoom, hover a territory to read what it contains.

Use when you want to see the shape of the library before you go looking for anything specific.
The index — precision

Glossary

Every file and directory in Mathlib4, as a searchable, drillable index. Click a domain to expand its sub-modules inline, all the way down to individual files. Each entry shows a full description and instant copy buttons for its import path and local path.

Use when you already know roughly what you're looking for and need the exact module.
The reference

Lean 4 References

A 16-section progressive reference built for the learning journey: orientation and the Lean Infoview first, then Unicode symbols, then querying tools, then your first proof — all before a single tactic. Core tactics are grouped by what they do to the proof state, not alphabetically. Automation, attributes, type class hierarchy, Mathlib idioms, and a full error-message guide follow.

The setup guide

Getting Started

A complete setup guide, OS-first. Choose Windows or macOS at the top; system requirements appear immediately so you know whether your device can run Lean before touching the installer. Step-by-step installation of Git, VS Code, elan, the Lean 4 extension, and Mathlib follows, tailored to your chosen platform.

Why this exists

The map before the territory

Mathlib4 is the world's largest library of formally verified mathematics — over 9,150 modules spanning nearly every area of modern mathematics: algebra, analysis, topology, number theory, category theory, and far beyond. For anyone meeting it for the first time, that's a lot to take in. Module names are precise but opaque. Dependencies run deep. The only documentation has traditionally been the source code itself.

This project exists to make that first meeting a good one. Every module gets a plain-language description — no assumed background required. The Glossary makes the library navigable. The Atlas makes its shape visible. The References make Lean learnable. Getting Started makes the toolchain approachable. Together, they're the friendly way in that should have existed from the beginning.

"Understanding a module description means simultaneously learning something about mathematics and discovering where to find that mathematics formally verified. The two goals are inseparable."
Now Public

Inside the Repository

Descriptions are community-maintained, and the data and tooling behind this site now live in the open. Here's what each piece is for.

JSON

The canonical dataset: one JSON array covering all 9,150 modules, each entry carrying Path, Name, Type, Parent Path, Depth, and Description. Every other file here — the RAG export, the Skill, the spreadsheet — is generated from it.

RAG

A flattened, embedding-ready export for retrieval-augmented-generation pipelines. Each entry merges path, type, and description into one text field, plus a metadata block recording the exact Lean, Mathlib, and glossary versions it was built against.

CLAUDE SKILL

A Claude Skill bundle: a SKILL.md, the full glossary embedded so it needs no network access, and a Python search script that retrieves entries by path, keyword, or depth. Install it once and Claude answers Mathlib navigation questions on its own.

SPREADSHEET

A static, offline snapshot of the contributor workbook — the same document the community proposes new descriptions and corrections through. This file freezes it at the reference release, for anyone who needs a stable copy to cite.

9,150 entries · full depth

Glossary

The gazetteer. Browse every module by layer, or search instantly. Click any directory card to expand its sub-modules inline. Files open a detail panel.

Orientation, not lookup

✪ The Atlas

32 domains, surveyed to three layers of depth. For individual files, switch to the Glossary.

578 territories charted 100% scale
Mathlib — the origin
Domain territory
District (subdirectory)
Contains a landmark theorem

Drag to pan · scroll to zoom
Click a territory to open its districts
Files live in the Glossary — this map surveys structure, not individual modules.
The Atlas
Hover a territory to read what it contains.

Domains radiate from Mathlib at the centre; districts orbit within each domain. Distance from the centre is depth in the library, not importance.

✪ Orientation

What is Lean 4?

Lean 4 is simultaneously a dependently-typed functional programming language and an interactive proof assistant. You write programs and proofs in the same language. The Lean kernel checks every proof mechanically — if it compiles without sorry, it is correct.

What is Mathlib?

Mathlib is the community-maintained library of formalised mathematics written in Lean 4. It contains over 9,150 modules covering algebra, analysis, topology, number theory, category theory, and more. Most users write import Mathlib to access all of it at once.

How they relate

Lean 4 is the language and proof engine. Mathlib is the mathematical content built on top. You can use Lean without Mathlib for pure logic and computation, but most mathematical work imports Mathlib for its tactics, type class instances, and theorems.

The mental model

In Lean, every mathematical statement is a type, and every proof is a term of that type. Writing theorem h : 1 + 1 = 2 declares a type; the proof body constructs a term inhabiting it. The kernel verifies the term fits the type.

⎕ The Environment

Opening the Lean Infoview

In VS Code: Ctrl+Shift+P (or Cmd+Shift+P on Mac) → type Lean 4: Open Infoview. The panel updates live as you move your cursor through a file or proof.

Reading the proof state

Hypotheses above the line, goal below. The symbol means “goal to prove”.

h : n > 0
⊢ n + 1 > 0

h is a hypothesis; the goal is to prove n + 1 > 0.

Squiggle colours
  • ■ Red — error. Lean cannot type-check this expression.
  • ■ Yellow — warning. Usually sorry or an unused variable.
  • ■ Blue / spinning — elaboration in progress. Wait.
  • ■ No squiggle — clean. Proof or definition accepted.
Key VS Code shortcuts
  • Ctrl+Shift+P — Command Palette (all Lean commands)
  • Ctrl+Space — trigger autocomplete / suggestions
  • F12 — go to definition of any identifier
  • Shift+F12 — find all references
  • Ctrl+. — quick fix / code actions
  • Hover any identifier — shows its type inline

✍ How to Type Symbols

Logic
  • \forall → ∀   \exists → ∃
  • \to → →   \iff → ↔
  • \and → ∧   \or → ∨
  • \not → ¬   \ne → ≠
  • \langle \rangle → ⟨⟩
Number sets
  • \N → ℕ   \Z → ℤ
  • \Q → ℚ   \R → ℝ
  • \C → ℂ
Sets & relations
  • \in → ∈   \notin → ∉
  • \sub → ⊆   \subs → ⊂
  • \union → ∪   \inter → ∩
  • \empty → ∅
  • \le → ≤   \ge → ≥
Operators
  • \sum → ∑   \prod → ∏
  • \int → ∫   \partial → ∂
  • \circ → ∘   \cdot → ·
  • \times → ×   \otimes → ⊗
  • \norm → ‖   \mapsto → ↦
Greek letters
  • \alpha α   \beta β   \gamma γ
  • \delta δ   \epsilon ε   \theta θ
  • \lambda λ   \mu μ   \nu ν
  • \pi π   \sigma σ   \phi φ
  • \omega ω   \Omega Ω
Brackets & misc
  • \lfloor \rfloor → ⌊⌋
  • \lceil \rceil → ⌈⌉
  • \gets → ←   \comp → ∘
  • \^2 → ²   \_1 → ₁
Comments
  • -- text — single-line comment
  • /- text -/ — block comment
  • /-- text -/ — doc comment (shown on hover)
  • /-! text -/ — module-level doc comment

⌬ Querying Lean

#check expr

Show the type of any expression. The most-used command — use it constantly. #check Nat.add_comm shows the full statement of that lemma.

#check @name

Show the fully explicit type with all implicit arguments visible. Essential for understanding exactly what arguments a function expects.

#eval expr

Evaluate any computable expression and print the result. #eval Nat.gcd 12 8 prints 4.

#print name

Print the full definition, type, and implementation of a declaration. Use it to understand how Mathlib defines things internally.

#print axioms name

List all axioms a declaration depends on. Verify that no sorry or native_decide crept into a proof you care about.

exact?

In tactic mode, search the environment for a term that closes the current goal. Comprehensive but slow — the best first thing to try when completely stuck.

apply?

Find lemmas whose conclusion matches the current goal shape. More targeted than exact? — use when you know the shape but not the lemma name.

simp?

Run simp and report exactly which lemmas it used. Lets you replace a bare simp with a precise simp only [...] for long-term stability.

▷ Your First Expressions

Types and terms

Every value in Lean has a type. 2 : Nat, true : Bool, (1 + 1 = 2) : Prop. Use #check to see any type instantly. Types themselves have types: Nat : Type.

Built-in types
  • Nat — natural numbers ℕ (non-negative)
  • Int — integers ℤ (positive and negative)
  • Booltrue / false (computable)
  • String — text
  • Prop — the type of mathematical statements
  • Type — the type of types
Your first REPL session
#eval 2 + 2          -- 4
#eval "hello".length -- 5
#check Nat.succ      -- Nat → Nat
#eval List.range 5   -- [0,1,2,3,4]
Function application

Lean uses space for application: f x y not f(x,y). Parentheses only group: f (g x). Left-associative: f x y = (f x) y.

Type ascription

Tell Lean the expected type with (expr : Type). Useful when inference picks the wrong type: (0 : Int) vs (0 : Nat) are different values.

Anonymous functions

fun x => x + 1 maps Nat to Nat. fun x y => x * y is two-argument. These are first-class values you can pass around.

★ Your First Proof (annotated)

import Mathlib
example : 1 + 1 = 2 := by
  norm_num
import Mathlib

Load the entire Mathlib library. Every tactic, theorem, and type class instance becomes available. Place at the very top of any file that uses Mathlib.

example

An anonymous theorem statement. The proof is checked but not added to the environment. Use for practice and exploration without polluting the namespace.

: 1 + 1 = 2

The proposition — the type of the proof we are building. In Lean, = is a Prop. We are claiming this equality holds and must construct a proof.

:= by

Enter tactic mode. The := means “is defined as” and by opens a tactic block where commands manipulate the proof state step by step.

norm_num

A tactic that normalises numeric expressions. It knows 1 + 1 = 2 directly — one of the most useful one-liners for any concrete numeric goal.

The result

After this runs, the Infoview shows No goals — proof complete. If goals remain, a tactic did not fully close what it was given.

▶ Declaration Forms

theorem name : P := proof

Named proof of P. Convention: major results. Identical to lemma to the kernel — distinction is purely human.

lemma name : P := proof

Named proof, convention for auxiliary helper facts. Use lemma for intermediate steps and theorem for the main result.

example : P := proof

Anonymous proof — checked but not added to the environment. Essential for exploration and tests. No namespace pollution.

def name : T := expr

Define a named value of type T. Semireducible by default. The workhorse for all non-propositional definitions.

abbrev name : T := expr

Like def but marked @[reducible] — unfolds eagerly in unification. Use for type synonyms where Lean should see through the name automatically.

noncomputable def

For definitions that depend on Classical.choice or non-constructive axioms. Cannot be #eval’d but perfectly usable in proofs.

structure Name where

A record type with named fields. Auto-generates projections, the constructor Name.mk, and extensionality infrastructure.

class Name where

A type class. Fields become the interface; use instance to provide implementations. The foundation of Lean’s algebraic hierarchy.

inductive Name where

An inductive type. Auto-generates the recursor Name.rec, casesOn, and recOn. The basis for Nat, List, Or.

instance : TC args := ...

Registers a type class instance for synthesis. Lean finds instances automatically by type. Equivalent to @[instance] def.

private / protected

private: visible only in the current file. protected: must use full qualified name even after open.

partial def

A definition without a verified termination proof. Use for IO, parsers, and cases where proving termination is genuinely hard.

◆ Scope & Namespaces

namespace Name … end Name

Opens a named scope. All declarations inside are prefixed Name.. Namespaces can be reopened anywhere — Mathlib uses this extensively.

section … end

An anonymous scope for grouping variable and open commands. Does not prefix names. Variables and opens declared inside no longer apply after end.

open Name

Brings all non-protected names from Name into scope without qualification. Scoped to the nearest enclosing section or namespace.

open Name in expr

Opens a namespace for a single expression or tactic block only. The cleanest way to use a namespace without polluting the surrounding scope.

open scoped Name

Activates only the scoped notations of Name. Classic: open scoped BigOperators to enable ∑ and ∏ notation.

variable (x : T) / {x} / [TC]

Declares a parameter auto-added to subsequent declarations that mention it. () explicit, {} implicit, [] typeclass instance.

universe u v

Declares universe-level variables for universe-polymorphic definitions. Lean’s type theory is stratified: Type 0 : Type 1 : …

termination_by expr

Provides the well-founded termination measure for a recursive definition. Lean checks this measure strictly decreases on every recursive call.

▶▶ Core Proof Tactics (inside a by block)

Introducing hypotheses

intro h / intros

Assumes the next hypothesis from a or in the goal, naming it h. intros introduces all available hypotheses at once.

rintro ⟨a, b⟩ (M)

Like intro but with immediate pattern-matching. ⟨a, b⟩ for conjunctions, h | k for disjunctions, ⟨a, rfl⟩ to substitute equalities on arrival.

Closing goals

exact e

Close the goal if e has exactly the goal’s type. The most direct closer — if you know the term, use it.

rfl

Close a = a by reflexivity. Works when both sides are definitionally equal — Lean verifies by computation.

assumption

Close the goal if it exactly matches any hypothesis in context. Lean searches all hypotheses automatically.

trivial

Tries rfl, assumption, decide, and True.intro in sequence. A lightweight closer for genuinely trivial goals.

contradiction

Close when context contains contradictory hypotheses (e.g. h : P and h’ : ¬P). Searches automatically.

done

Succeeds only if no goals remain. A sentinel to confirm a proof is complete — a failing done means you missed a goal.

Working backwards

apply h

If h : A → B and the goal is B, the new goal becomes A. Backward reasoning — reduce the goal to something you know.

refine ?_

Build a proof term with holes ?_. Each hole becomes a new sub-goal. More controlled than apply when you want to specify partial structure explicitly.

Splitting goals

constructor

Split P ∧ Q or P ↔ Q into two sub-goals. Also works on any inductive type with a single constructor.

left / right

Choose a branch of P ∨ Q. After left the goal becomes P; after right it becomes Q.

use e (M)

Provide the witness for ∃ x, P x. After use e the goal becomes P e. Accepts multiple arguments for nested existentials.

Case analysis & induction

cases h

Case-split on an inductive hypothesis or value h. Produces one goal per constructor.

rcases e with pat (M)

Recursive deconstruction: ⟨a, b⟩ for products, h | k for sums, ⟨a, rfl⟩ to substitute. The richest destructuring tactic.

obtain pat := e (M)

obtain ⟨a, ha⟩ := h destructs h : ∃ x, P x into witness a and proof ha.

induction x

Prove by induction on x. One goal per constructor with the induction hypothesis (IH) available.

induction x using r

Use a custom recursor r instead of the default. Useful for strong induction and domain-specific induction principles.

Intermediate claims & proof structure

have h : P := proof

Prove an intermediate claim P and name it h. The primary way to break long proofs into readable labelled steps.

suffices h : P by ...

Declare it suffices to prove P. The by ... closes the original goal using h. Then you prove P.

calc

Chained equalities or inequalities with justifications at each step:
calc a = b := h1
     _ ≤ c := h2

Context manipulation

revert h

Move h back into the goal as or . The inverse of intro. Useful to generalise before induction.

generalize e = x

Replace all occurrences of expression e with a fresh variable x. Makes a goal induction-ready.

subst h

When h : x = e, substitute x everywhere in the goal and context, then remove both.

specialize h a b

Apply hypothesis h to arguments a b in place. Replaces h with the specialised version.

clear h

Remove hypothesis h from context when it is no longer needed.

sorry

Admit any goal as true. Emits a yellow warning. Invaluable for top-down proof development — sketch structure first, fill sorrys second.

⚙ Rewriting & Simplification

rw [h]

Rewrite left-to-right using h : a = b. Use rw [←h] for right-to-left. Use at hyp to rewrite in a hypothesis instead of the goal.

rw [h₁, h₂, h₃]

Chain multiple rewrites in sequence. Order matters — each rewrite happens after the previous transformation.

simp

Simplify using all @[simp]-tagged lemmas. Closes many goals but is non-deterministic — avoid bare simp in finished proofs; use simp only.

simp only [h₁, h₂]

Run simp restricted to listed lemmas only. More predictable, faster, and stable across Mathlib updates. The standard for polished proofs.

simp_rw [h] (M)

Like rw but works under binders (, fun, ). The correct tool when rw fails because the pattern appears inside a lambda.

simp_all

Apply simp to the goal and all hypotheses simultaneously until fixpoint. Powerful but slow — use for hard goals or as a last resort.

nth_rw n [h]

Rewrite only the nth occurrence of the pattern. Essential when the same expression appears multiple times.

unfold f / delta f

unfold: unfold definition of f once. delta: force-unfold even @[irreducible] definitions. Use sparingly — prefer lemmas about f.

conv

Focused rewriting inside a specific sub-term. Enter with conv =>, navigate with lhs / rhs / ext x, then rw or simp at that exact position.

⚡ Automation & Decision Procedures

TacticWhat it solvesNotes
ringPolynomial equalities in commutative ringsWorks over any CommRing. Does not handle inequalities.
ring_nfRing normalisation without closingSimplifies toward normal form; combine with other tactics.
linarithLinear arithmetic over ordered fieldsAdd hints: linarith [h1, sq_nonneg x].
nlinarith (M)Nonlinear arithmetic (products of hypotheses)Slower than linarith; tries products of pairs.
norm_numConcrete numeric computationsEvaluates 2^10 = 1024, primality, floor, ceiling.
omegaLinear arithmetic over ℤ and ℕDecision procedure. Handles Nat.mod, Nat.div, bounded quantifiers.
decideAny decidable propositionKernel-evaluated. Correct but slow for large computations.
native_decideDecidable propositions (fast)Compiles natively. Much faster; adds an extra axiom.
positivity (M)Non-negativity and positivity goalsProves 0 ≤ f x or 0 < f x by structural analysis.
gcongr (M)Goal congruence for monotone functionsProves f a ≤ f b from a ≤ b when f is monotone.
field_simp (M)Clear denominators in field goalsCombine with ring to finish field equalities.
push_neg (M)Push negation through quantifiers¬ ∀ x, P x∃ x, ¬ P x. Also pull_neg.
contrapose! (M)Switch to contrapositive + push_negcontrapose without ! does not push negation.
by_contra hProof by contradictionAdds h : ¬ P to context; goal changes to False.
by_cases h : PCase split on any decidable PTwo goals: h : P and h : ¬ P.
tautoPropositional tautologiesDecides pure propositional logic (∧, ∨, ¬, →, ↔).
aesop (M)Automated search using registered rulesApplies @[aesop]-tagged lemmas. Configurable depth.
fun_prop (M)Continuity, measurability, differentiabilityProves structural function properties via registered lemmas.

◆ When to Use Which Tactic

rw [h]

You have an equality h : a = b and want to replace a specific occurrence. Fails under binders — use simp_rw if the pattern appears inside a fun or .

simp only [...]

In finished proofs, always use simp only with an explicit list. Use bare simp only during exploration. Run simp? to discover the right list.

apply h

The goal matches the conclusion of a known lemma. Use apply? to find h. Use exact when no new premises arise. Use refine to fill sub-goals manually.

omega

Goal involves ℕ or ℤ with addition, subtraction, mul by literals, mod, or div. Faster than linarith for discrete arithmetic.

linarith

Goal is a linear inequality over an ordered field (ℝ, ℚ). Add hints when needed: linarith [sq_nonneg x, h1].

norm_num

Goal involves concrete numbers: 2^8 = 256, Nat.Prime 97. Much faster and more reliable than decide for numeric goals.

ring

Goal is a polynomial identity in a ring. For fractions: first field_simp to clear denominators, then ring.

exact?

You have no idea where to start. Let Lean search everything. Slow but comprehensive. Try apply? as a faster targeted alternative.

◆ Key Attributes (@[name])

AttributePurposeWhen to use
@[simp]Add to the simp lemma setEqualities simplifying toward a normal form. Avoid on lemmas that could loop.
@[ext]Register extensionality lemmaOn structures; enables the ext tactic to apply it automatically.
@[norm_cast]Register cast lemmaFor lemmas about coercions between numeric types (ℕ→ℤ→ℚ→ℝ).
@[gcongr]Register congruence ruleFor monotone operations; extends the gcongr tactic.
@[positivity]Register positivity lemmaExtends the positivity tactic to handle a new operation.
@[measurability]Register for measurability tacticFor measurable function constructors in measure theory.
@[fun_prop]Register for fun_prop tacticFor continuity, differentiability, and measurability lemmas.
@[aesop]Register rule for aesopSpecify safe / unsafe and rule type.
@[reducible]Mark as fully transparentFor type synonyms. Makes unification see through the name automatically.
@[irreducible]Prevent unfolding except with deltaFor implementation details hidden from the elaborator.
@[instance priority n]Set instance synthesis priorityResolve diamond ambiguities. Higher number = higher priority.
@[deprecated]Emit deprecation warning on useWhen renaming; include the replacement name.

∀ Type Classes & Instances

How type classes work

A type class is an interface (like Add, Ring, MetricSpace). An instance provides the implementation for a specific type. Lean finds instances automatically through instance synthesis — you write [Ring R] and Lean finds the right implementation silently.

Algebraic hierarchy
  • Semigroup → Monoid → Group → CommGroup
  • Semiring → Ring → CommRing
  • CommRing + IsDomain → integral domain
  • DivisionRing → Field → LinearOrderedField
  • Module R M → Algebra R A
Order hierarchy
  • Preorder → PartialOrder → LinearOrder
  • SemilatticeSup / SemilatticeInf → Lattice
  • Lattice → CompleteLattice
  • OrderedAddCommMonoid → OrderedField
  • LinearOrderedField (ℝ, ℚ, etc.)
Topology & analysis hierarchy
  • TopologicalSpace → T0, T1, T2Space
  • MetricSpace → NormedAddCommGroup
  • NormedSpace → InnerProductSpace
  • CompleteSpace (Banach / Hilbert)
  • MeasurableSpace → MeasureSpace
Testing & finding instances
#check (inferInstance : Ring ℤ)
#check (inferInstance : Field ℝ)
example : CommRing ℤ := inferInstance
Writing your own instance
instance : Add MyType where
  add x y := ...

instance : Ring MyType :=
  { add := ..., mul := ..., ... }

✈ Useful Mathlib Patterns

Big operators (∑ ∏)

Enable with open scoped BigOperators. Then write ∑ i ∈ s, f i and ∏ i ∈ s, f i. Key file: Mathlib.Algebra.BigOperators.Group.Finset.

Absolute value & norm

|x| for ordered groups. ‖x‖ (type \norm) for normed spaces. Key lemmas: abs_add, abs_mul, norm_add_le, norm_sub_le.

Finset operations

Finset.sum, Finset.prod, Finset.card. Filter: Finset.filter. Image: Finset.image. Key: Mathlib.Data.Finset.Basic.

Limits & filters

Filter.Tendsto f (nhds a) (nhds b) means f(x) → b as x → a. ContinuousAt f a is syntactic sugar. Key: Mathlib.Topology.Basic.

Derivatives

HasDerivAt f f’ x: f has derivative f’ at x. deriv f x returns it (0 if not differentiable). fderiv for Fréchet derivatives.

Measure theory

open MeasureTheory. Write ∫ x, f x ∂μ for integrals. Key: Mathlib.MeasureTheory.Measure.MeasureSpace.

Linear algebra

Module R M, Submodule R M, LinearMap R M N, LinearEquiv R M N. Basis: Basis ι R M. Key: Mathlib.LinearAlgebra.Basic.

Cast coercions

Lean inserts coercions automatically: ℕ→ℤ→ℚ→ℝ. Use push_cast to move casts inward, norm_cast to normalise, @[norm_cast] on your own cast lemmas.

⚠ Common Error Messages

ErrorWhat it meansTypical fix
type mismatchProvided a term of the wrong typeUse #check to compare types. Look for coercion mismatches between ℕ, ℤ, ℚ, ℝ.
unsolved goalsProof block did not close all goalsCheck remaining goals in Infoview. Use sorry to isolate, then fill each goal.
failed to synthesize instanceLean can’t find a type class instanceCheck imports and open statements. Use #check (inferInstance : ...) to test.
unknown identifierName does not exist in scopeCheck spelling, imports, namespace. Use #check Namespace.Name to confirm.
application type mismatchFunction applied to wrong argument typeUse @f to see all explicit arguments. Add type annotations (arg : T).
function expected at XUsed X as a function but it’s a valueCheck for missing parentheses. Check if X is a type constructor needing arguments.
linarith failedlinarith could not prove the goalCheck hypotheses are in context. Try linarith [h1, h2, sq_nonneg x] with hints.
simp made no progressNone of the simp lemmas appliedCheck lemma direction (try ←h). Run simp? to find what would fire. Try rw.
omega could not find a contradictionThe ℕ/ℤ arithmetic claim is not provableVerify the claim is true. Check for hidden casts. Use norm_cast first.
maximum recursion depth reachedType class synthesis or unification loopedAdd explicit type annotations to break the loop. Look for circular instances.
tactic failed, there are unsolved goalsA tactic left goals open unexpectedlyCommon with rw. Check Infoview after each tactic step to see what’s remaining.
declaration uses 'sorry'A sorry is present in the proof chainSearch the file for all sorrys. Replace each with a valid proof step.

■ System Requirements

Before installing anything, verify your Windows device meets these requirements. Lean is a compiled proof assistant — RAM and storage matter more than on most software.

Windows Requirements
OS Windows 10 64-bit (version 1903+) or Windows 11
CPU x86-64 processor — 4+ cores strongly recommended for parallel compilation
RAM 8 GB minimum — 16 GB strongly recommended. VS Code with the Lean extension uses 1–2 GB actively while checking a file.
Storage 10 GB free space for toolchain, prebuilt .olean cache, and Mathlib source. SSD strongly preferred over HDD.
Internet Required for first setup — roughly 4–6 GB downloaded for the prebuilt cache alone.
Software Git for Windows, VS Code, winget (pre-installed on Windows 11; available for Windows 10 via the App Installer)
⚠ Windows ARM

Surface Pro X, Snapdragon-based laptops, and other Windows ARM devices are not officially supported. WSL2 (Ubuntu 22.04+) running inside Windows is the recommended workaround on these devices.

💡 Performance Tips
  • Always run lake exe cache get before lake build — it downloads prebuilt objects instead of compiling from scratch.
  • More CPU cores = significantly faster builds. Close other heavy apps when building on 8 GB RAM.
  • Lean reads and writes thousands of small .olean files — an SSD makes a noticeable difference.

▶ Installation (Windows)

1. Install Git

Download from git-scm.com. During setup, choose Git Bash as the default terminal.

2. Install VS Code

Download from code.visualstudio.com. Accept all defaults.

3. Install elan (Lean version manager)

Open PowerShell and run:

winget install elan

Accept all prompts. elan installs and manages the Lean toolchain automatically.

4. Install the Lean 4 VS Code Extension

In VS Code, open Extensions (Ctrl+Shift+X), search lean4, and install the extension by the Lean FRO.

5. Clone Mathlib4

In PowerShell or Git Bash:

git clone --depth 1 https://github.com/leanprover-community/mathlib4.git

6. Download prebuilt cache & build

cd mathlib4
lake exe cache get
lake build

First run takes 30–60 min depending on your connection and machine.

7. Verify the setup

Open the mathlib4 folder in VS Code. Create Test.lean containing:

import Mathlib
#eval 2 + 2

The Lean Infoview panel should show 4. If it does, you’re set.

◆ Daily Commands (Windows PowerShell)

ActionCommand
▶ Navigation
Go to Mathlibcd $env:USERPROFILE\mathlib4
Go to your projectcd $env:USERPROFILE\YourProject
Go up one levelcd ..
List filesGet-ChildItem  (aliases: dir, ls)
▶ Searching
Find pattern in a filegit grep "HasSum.add" -- Mathlib/Probability/
Case-insensitive searchgit grep -i "hasSum"
Show matching filenames onlygit grep -l "pattern"
Show line numbersgit grep -n "pattern"
▶ File Checks
Check if a file existsTest-Path "Mathlib\Algebra\Order\Floor\Defs.lean"
▶ Building & Updating
Update dependency manifestlake update
Download prebuilt cachelake exe cache get
Build projectlake build
Clean build artifactslake clean
▶ Version Checking
Current Lean versionlean --version
Pinned toolchain versionGet-Content lean-toolchain
Latest Mathlib commitgit -C $env:USERPROFILE\mathlib4 log -1 --oneline
Dependency versionsGet-Content lake-manifest.json
▶ Git Basics
Show statusgit status
Pull latest Mathlibgit pull  (then lake build)
Discard all local changesgit checkout .
Restore a single filegit checkout HEAD -- path/to/file
See recent commitsgit log --oneline -5
▶ Launch VS Code
Open a project foldercode $env:USERPROFILE\YourProject
Open current directorycode .

■ System Requirements

Before installing anything, verify your Mac meets these requirements. Apple Silicon Macs are among the best machines for Lean development.

macOS Requirements
OS macOS 12 Monterey or later (Intel or Apple Silicon)
CPU Intel x86-64 or Apple Silicon (M1 / M2 / M3 / M4) — both are fully supported natively
RAM 8 GB minimum — 16 GB recommended. M-series chips handle Lean very efficiently due to unified memory; 8 GB M-series often outperforms 16 GB Intel.
Storage 10 GB free space for toolchain, prebuilt .olean cache, and Mathlib source. SSD (standard on all Macs since 2013).
Internet Required for first setup — roughly 4–6 GB downloaded for the prebuilt cache alone.
Software Xcode Command Line Tools (free via Terminal), Homebrew (optional, helpful), VS Code
✅ Apple Silicon

M-series Macs (M1 through M4) run Lean natively and are among the best machines available for Lean development — fast compilation, excellent memory efficiency, and silent operation under sustained load.

💡 Performance Tips
  • Always run lake exe cache get before lake build — downloads prebuilt objects instead of compiling from scratch.
  • More CPU cores = faster builds. Close other heavy apps when building on 8 GB RAM.
  • Linux (Ubuntu 22.04+, Debian 12+, Fedora 38+) is fully supported and often the fastest option for server or CI use.

▶ Installation (macOS / Linux)

1. Install Xcode Command Line Tools

Open Terminal and run:

xcode-select --install

A dialog will appear. Click Install and wait for it to complete.

2. Install Git

Already included with Xcode Command Line Tools. Verify with git --version. Optionally update via git-scm.com or brew install git.

3. Install VS Code

Download from code.visualstudio.com. After opening, run Shell Command: Install ‘code’ in PATH from the Command Palette (Cmd+Shift+P).

4. Install elan (Lean version manager)

In Terminal:

curl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf | sh

Restart Terminal after install so the lean and lake commands are available.

5. Install the Lean 4 VS Code Extension

In VS Code, open Extensions (Cmd+Shift+X), search lean4, and install the extension by the Lean FRO.

6. Clone Mathlib4

git clone --depth 1 https://github.com/leanprover-community/mathlib4.git

7. Download prebuilt cache & build

cd mathlib4
lake exe cache get
lake build

First run takes ~20–40 min on Apple Silicon, longer on Intel. Use the prebuilt cache — it saves hours.

8. Verify the setup

Open the mathlib4 folder in VS Code. Create Test.lean containing:

import Mathlib
#eval 2 + 2

The Lean Infoview panel should show 4. If it does, you’re set.

◆ Daily Commands (macOS / Linux Terminal)

ActionCommand
▶ Navigation
Go to Mathlibcd ~/mathlib4
Go to your projectcd ~/YourProject
Go up one levelcd ..
List filesls  (or ls -la for full detail)
▶ Searching
Find pattern in directorygit grep "HasSum.add" -- Mathlib/Probability/
Case-insensitive searchgit grep -i "hasSum"
Show matching filenames onlygit grep -l "pattern"
Show line numbersgit grep -n "pattern"
▶ File Checks
Check if a file exists[ -f "Mathlib/Algebra/Order/Floor/Defs.lean" ] && echo "exists"
▶ Building & Updating
Update dependency manifestlake update
Download prebuilt cachelake exe cache get
Build projectlake build
Clean build artifactslake clean
▶ Version Checking
Current Lean versionlean --version
Pinned toolchain versioncat lean-toolchain
Latest Mathlib commitgit -C ~/mathlib4 log -1 --oneline
Dependency versionscat lake-manifest.json
▶ Git Basics
Show statusgit status
Pull latest Mathlibgit pull  (then lake build)
Discard all local changesgit checkout .
Restore a single filegit checkout HEAD -- path/to/file
See recent commitsgit log --oneline -5
▶ Launch VS Code
Open a project foldercode ~/YourProject
Open current directorycode .

Ask the community for help

The Lean community is welcoming and active on Zulip — a chat platform where beginners and experts discuss proofs, share projects, and help each other. Whether you’re stuck on an error message or just saying hello, the #new members stream is the right place to start.

Join the Lean Zulip
No institution. No co-authors. One kernel.

Muhammed Ismail

Self-taught in mathematics, economics, the mechanics of business — and enough psychology to notice a pattern worth proving.

This Glossary exists because of a proof that wasn’t the plan when any of this started. Here’s how one produced the other.

How This Started

From a Personal Habit to a Kernel-Checked Proof

In September 2025, while trying to understand his own decision-making rather than anyone else’s, Ismail noticed his reasoning kept passing through the same six-step pattern — no matter what the decision was about. For a while that stayed a personal heuristic. What changed was realizing the pattern wasn’t just useful. It looked like it could be proven. He had no formal training in mathematics before that point, and taught himself what a proof at this level required, in roughly the order he needed it.

Proving it, though, made something else clear: this wasn’t shaping up to be a simple theorem. The same structure kept holding as Ismail tested it against a wide range of industries and disciplines — not as a loose analogy, but as what the finished paper’s own title now calls it: a Unified Functional Theory. Unified, because the same handful of structural failures recur across investing, operations, public policy, and reinforcement learning alike, with one proof serving all of them at once. Functional, because what’s being characterized is what a decision process has to do under uncertainty — never which field it happens to sit in. The claim is a deliberately narrow one, though: it holds for a specific, defined class of environments — what the papers call Class C — sequential decisions made under real uncertainty, where information is incomplete, conditions shift, and mistakes aren’t always reversible. No more, no less.

September 2025

Notices the pattern

The same six steps, recurring across every decision, unrelated to its subject.

Sept 2025 – Jan 2026

Teaches himself the math

No formal background going in — learns proof-writing in the order the work demands it.

28 January 2026

First companion paper

Tests the six primitives against Erikson, Maslow, and Bowlby’s stage theories.

8 April 2026

A second companion paper follows

This one on emotional adaptation in therapy. The prose corpus is now largely complete — already reaching well past mathematics.

April 2026

Realizes it’s a Unified Functional Theory

The pattern holds up independently in psychology and therapy — this isn’t one theorem anymore. A claim that size, from an unaffiliated researcher, isn’t going to be taken on faith.

May – June 2026

The pivot to Lean

No institution, no realistic path through peer review — so the proof gets rebuilt in Lean 4, where a kernel checks it directly.

July 2026

Everything ships

Ismail’s Primitives (12,700 lines, zero admitted axioms) and Ismail’s Glossary publish together, alongside the Economic Adaptation paper and updated companion work.

Why This Site Exists

Peer Review Doesn’t Work for This — So a Kernel Does

An independent researcher with no institutional affiliation, presenting a result that needs specialists in formal logic and decision theory just to evaluate it — and separate specialists again for each field it reaches — has no realistic route through traditional peer review on any usable timeline. So the mathematics was rebuilt instead as a Lean 4 formalization: something a kernel checks deterministically, without needing to check the author first.

Learning Mathlib well enough to do that produced two things at once. The proof itself — and, as a byproduct of the learning, the beginnings of the glossary you’re using right now.

None of this needs to be taken on faith. The proof doesn’t rest on who wrote it. It rests on whether Lean’s kernel accepted it. It did.
The Larger Body of Work

More From Muhammed Ismail

This Glossary is the byproduct. The main project is a proof — that six primitives are necessary, mutually irreplaceable, and sufficient for any sequential decision under uncertainty. Two companion threads extend it further.

Ismail’s Primitives

Six primitives, proven necessary — and mutually irreplaceable — for any sequential decision under uncertainty. Machine-checked in Lean 4, zero admitted axioms.

Human Development

Erikson, Maslow, and Bowlby’s stage theories, read as three independent confirmations of the same six-stage structure.

Emotional Adaptation

The same six primitives, applied to psychotherapy and emotional adaptation in the clinical setting.

Economic Adaptation

Extending the primitives to economic coordination under uncertainty, Lean-verified.

Get In Touch

Find Ismail Elsewhere