Skip to content

A month with Mathlib

23 August 2026

Core Lean is deliberately small. The mathematics lives in Mathlib, the community library, and Lake's math template starts a project with it:

lake new playground math
cd playground
lake exe cache get

lake exe cache get downloads Mathlib already compiled, for the exact revision the project pins. Building it from source takes a long while.

What changes most is the tactics. Algebra that would be a page of rewriting takes a line:

import Mathlib

example (a b : ℝ) : (a + b) ^ 2 = a ^ 2 + 2 * a * b + b ^ 2 := by
  ring

example (x y : ℝ) (h₁ : x < y) (h₂ : 0 < x) : 0 < y := by
  linarith

example : (2 : ℝ) ^ 10 = 1024 := by
  norm_num

And exact? searches the library for a lemma that closes the goal, which is how I find most names. The Mathlib documentation and the Zulip chat answer the rest.