Poincaré conjecture: the Lean proof, cleaned up together
The 2026 Lean proof of the Poincaré conjecture after Morgan and Tian, 3 million lines, cleaned up together: smaller, faster to build, more readable, the theorems unchanged

| 1 | import Mathlib.Analysis.Calculus.Deriv.MeanValue |
| 2 | import Mathlib.Tactic.Linarith |
| 3 | |
| 4 | /-! |
| 5 | # Selecting a point where a nonnegative function decreases slowly |
| 6 | |
| 7 | The endpoint mean-value estimate selects the upper boundary in Petrunin's |
| 8 | Section 4.5, author manuscript p. 12, last paragraph before Section 4.6. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | |
| 13 | open Set |
| 14 | |
| 15 | namespace Poincare.Analysis |
| 16 | |
| 17 | /-- A bound at the left endpoint and nonnegativity at the right endpoint |
| 18 | give an interior point with a controlled negative derivative. -/ |
| 19 | lemma exists_neg_deriv_le_div {f : ℝ → ℝ} {a b C : ℝ} |
| 20 | (hab : a < b) (hc : ContinuousOn f (Icc a b)) |
| 21 | (hd : DifferentiableOn ℝ f (Ioo a b)) |
| 22 | (ha : f a ≤ C) (hb : 0 ≤ f b) : |
| 23 | ∃ t ∈ Ioo a b, -(deriv f t) ≤ C / (b - a) := by |
| 24 | obtain ⟨t, ht, heq⟩ := exists_deriv_eq_slope f hab hc hd |
| 25 | refine ⟨t, ht, ?_⟩ |
| 26 | rw [heq, ← neg_div] |
| 27 | apply div_le_div_of_nonneg_right _ (sub_pos.mpr hab).le |
| 28 | linarith |
| 29 | |
| 30 | /-- The scale used to choose a level-set boundary when its area is at most |
| 31 | `α * b ^ m`. No bound for the derivative is assumed. -/ |
| 32 | lemma exists_neg_deriv_le_of_power_bound {A : ℝ → ℝ} {b α : ℝ} {m : ℕ} |
| 33 | (hb : 0 < b) (hm : 1 ≤ m) |
| 34 | (hc : ContinuousOn A (Icc b (3 * b / 2))) |
| 35 | (hd : DifferentiableOn ℝ A (Ioo b (3 * b / 2))) |
| 36 | (hleft : A b ≤ α * b ^ m) (hright : 0 ≤ A (3 * b / 2)) : |
| 37 | ∃ t ∈ Ioo b (3 * b / 2), -(deriv A t) ≤ 2 * α * b ^ (m - 1) := by |
| 38 | obtain ⟨t, ht, hbound⟩ := exists_neg_deriv_le_div (by linarith : b < 3 * b / 2) |
| 39 | hc hd hleft hright |
| 40 | refine ⟨t, ht, hbound.trans_eq ?_⟩ |
| 41 | have hm' : m = (m - 1) + 1 := (Nat.sub_add_cancel hm).symm |
| 42 | conv_lhs => rw [hm', pow_succ] |
| 43 | field_simp |
| 44 | ring |
| 45 | |
| 46 | end Poincare.Analysis |