Loading…
Mathlib
The library of mathematics written in Lean by its community, from the natural numbers to algebraic geometry, which the other projects here build on.
Maintained by the Mathlib community · Mathlib on GitHub · Its documentation
This is a library, not a claim, reviewed by its community and checked by Lean on every change. This site lays it out to read; it does not check it.
Lean on the left; on the right, each declaration in plain language. Hover a phrase to see its Lean.
Loading the theorems…
What it is
Mathlib is the library of mathematics its community has written in Lean, from the natural numbers to algebraic geometry: some 8,700 files and more than two million lines, on which the other projects here build. It claims no one result; every change is reviewed, and Lean checks all of it.
How it is laid out
Mathlib.lean imports every file, so it stands in for the main theorems. Files sit in directories
by subject, such as Mathlib/Algebra or Mathlib/NumberTheory; Mathlib/Tactic holds the tactics
proofs are written with.
Where to start
Nat.exists_infinite_primes: there are infinitely many primes, by Euclid.irrational_sqrt_two: √2 is irrational.Real.pi_gt_three: π > 3.Complex.exists_root: every nonconstant complex polynomial has a root.Nat.forall_exists_prime_gt_and_modEq: infinitely many primes in each arithmetic progression a, a + q, … with a and q coprime, by Dirichlet.fermatLastTheoremFour: Fermat’s Last Theorem for exponent 4.
Background
Begun in 2017 for Lean 3 and ported to Lean 4 by 2023, written by hundreds of people and reviewed by its maintainers.
How to check it yourself
Unpack the Lean the announcement links to, then build it (it is large: give it hours):
lake exe cache get lake build
Then ask Lean what the main theorems rest on. A complete proof rests only on propext, Classical.choice, and Quot.sound:
import Mathlib #print axioms Nat.exists_infinite_primes #print axioms irrational_sqrt_two #print axioms Real.pi_gt_three #print axioms Complex.exists_root #print axioms Nat.forall_exists_prime_gt_and_modEq #print axioms fermatLastTheoremFour