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.InnerProductSpace.Projection.Basic |
| 2 | import Mathlib.Tactic.Linarith |
| 3 | import Mathlib.Tactic.FieldSimp |
| 4 | import Mathlib.Tactic.Module |
| 5 | /-! |
| 6 | # Oblique projections and tangential expansion |
| 7 | |
| 8 | An initial normal component can be removed before a linear map when its |
| 9 | image lies in the direction annihilated by a final oblique projection. |
| 10 | This turns a tangential bound into a bound on the full projected map. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open scoped InnerProductSpace |
| 16 | |
| 17 | namespace Poincare.InnerProductSpace |
| 18 | variable {E F : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] |
| 19 | [NormedAddCommGroup F] [InnerProductSpace ℝ F] |
| 20 | /-- Removing the component along a vector gives an orthogonal vector, including at zero. -/ |
| 21 | theorem inner_sub_normal_component (x v : E) : |
| 22 | ⟪x, v - (⟪x, v⟫_ℝ / ‖x‖ ^ 2) • x⟫_ℝ = 0 := by |
| 23 | by_cases hx : x = 0 |
| 24 | · simp [hx] |
| 25 | have hn : ‖x‖ ^ 2 ≠ 0 := pow_ne_zero _ (norm_ne_zero_iff.mpr hx) |
| 26 | rw [inner_sub_right, real_inner_smul_right, real_inner_self_eq_norm_sq] |
| 27 | field_simp |
| 28 | ring |
| 29 | /-- Removing the orthogonal normal component is contractive. -/ |
| 30 | theorem norm_sub_normal_component_le (x v : E) : |
| 31 | ‖v - (⟪x, v⟫_ℝ / ‖x‖ ^ 2) • x‖ ≤ ‖v‖ := by |
| 32 | by_cases hx : x = 0 |
| 33 | · simp [hx] |
| 34 | have hn : 0 < ‖x‖ ^ 2 := sq_pos_of_pos (norm_pos_iff.mpr hx) |
| 35 | have heq : ‖v - (⟪x, v⟫_ℝ / ‖x‖ ^ 2) • x‖ ^ 2 = |
| 36 | ‖v‖ ^ 2 - ⟪x, v⟫_ℝ ^ 2 / ‖x‖ ^ 2 := by |
| 37 | rw [norm_sub_sq_real, real_inner_smul_right, real_inner_comm v x, norm_smul] |
| 38 | simp only [Real.norm_eq_abs, mul_pow, sq_abs] |
| 39 | field_simp |
| 40 | ring |
| 41 | have hnonneg : 0 ≤ ⟪x, v⟫_ℝ ^ 2 / ‖x‖ ^ 2 := div_nonneg (sq_nonneg _) hn.le |
| 42 | nlinarith [norm_nonneg (v - (⟪x, v⟫_ℝ / ‖x‖ ^ 2) • x), norm_nonneg v] |
| 43 | |
| 44 | /-- An oblique projection has the elementary triangle-inequality norm bound. -/ |
| 45 | theorem norm_sub_functional_component_le (ell : F →L[ℝ] ℝ) (u v : F) : |
| 46 | ‖v - (ell v / ell u) • u‖ ≤ |
| 47 | (1 + ‖ell‖ * ‖u‖ / |ell u|) * ‖v‖ := by |
| 48 | have hv : |ell v| ≤ ‖ell‖ * ‖v‖ := by simpa only [Real.norm_eq_abs] using ell.le_opNorm v |
| 49 | calc |
| 50 | ‖v - (ell v / ell u) • u‖ ≤ ‖v‖ + ‖(ell v / ell u) • u‖ := norm_sub_le _ _ |
| 51 | _ = ‖v‖ + |ell v| / |ell u| * ‖u‖ := by rw [norm_smul, Real.norm_eq_abs, abs_div] |
| 52 | _ ≤ ‖v‖ + (‖ell‖ * ‖v‖) / |ell u| * ‖u‖ := by |
| 53 | gcongr |
| 54 | _ = (1 + ‖ell‖ * ‖u‖ / |ell u|) * ‖v‖ := by ring |
| 55 | |
| 56 | /-- Tangential expansion controls a projected linear map that transports the normal direction. -/ |
| 57 | theorem norm_project_after_linearMap_le (L : E →L[ℝ] F) |
| 58 | (ell : F →L[ℝ] ℝ) (x : E) (u : F) {a A : ℝ} |
| 59 | (hLu : L x = a • u) (hell : ell u ≠ 0) (hA : 0 ≤ A) |
| 60 | (hL : ∀ w, ⟪x, w⟫_ℝ = 0 → ‖L w‖ ≤ A * ‖w‖) (v : E) : |
| 61 | ‖L v - (ell (L v) / ell u) • u‖ ≤ |
| 62 | (1 + ‖ell‖ * ‖u‖ / |ell u|) * A * ‖v‖ := by |
| 63 | let w := v - (⟪x, v⟫_ℝ / ‖x‖ ^ 2) • x |
| 64 | have hw : ⟪x, w⟫_ℝ = 0 := inner_sub_normal_component x v |
| 65 | have hn : ‖w‖ ≤ ‖v‖ := norm_sub_normal_component_le x v |
| 66 | have heq : L v - (ell (L v) / ell u) • u = L w - (ell (L w) / ell u) • u := by |
| 67 | dsimp only [w] |
| 68 | simp only [map_sub, map_smul, hLu, smul_smul, smul_eq_mul] |
| 69 | have halg : (ell (L v) - (⟪x, v⟫_ℝ / ‖x‖ ^ 2 * a) * ell u) / ell u = |
| 70 | ell (L v) / ell u - (⟪x, v⟫_ℝ / ‖x‖ ^ 2 * a) := by field_simp |
| 71 | rw [halg] |
| 72 | module |
| 73 | rw [heq] |
| 74 | have hfactor : 0 ≤ 1 + ‖ell‖ * ‖u‖ / |ell u| := by positivity |
| 75 | calc |
| 76 | ‖L w - (ell (L w) / ell u) • u‖ ≤ |
| 77 | (1 + ‖ell‖ * ‖u‖ / |ell u|) * ‖L w‖ := |
| 78 | norm_sub_functional_component_le ell u (L w) |
| 79 | _ ≤ (1 + ‖ell‖ * ‖u‖ / |ell u|) * (A * ‖v‖) := |
| 80 | mul_le_mul_of_nonneg_left ((hL w hw).trans (mul_le_mul_of_nonneg_left hn hA)) hfactor |
| 81 | _ = _ := by ring |
| 82 | |
| 83 | /-- Unit normal bounds and a negative angle bound control the projected map uniformly. -/ |
| 84 | theorem norm_project_after_linearMap_le_of_angle (L : E →L[ℝ] F) |
| 85 | (x : E) (u vnormal : F) {a A c : ℝ} |
| 86 | (hLu : L x = a • u) (hc : 0 < c) (hpair : ⟪vnormal, u⟫_ℝ ≤ -c) |
| 87 | (hu : ‖u‖ ≤ 1) (hv : ‖vnormal‖ ≤ 1) (hA : 0 ≤ A) |
| 88 | (hL : ∀ w, ⟪x, w⟫_ℝ = 0 → ‖L w‖ ≤ A * ‖w‖) (w : E) : |
| 89 | ‖L w - (⟪vnormal, L w⟫_ℝ / ⟪vnormal, u⟫_ℝ) • u‖ ≤ |
| 90 | (1 + 1 / c) * A * ‖w‖ := by |
| 91 | let ell : F →L[ℝ] ℝ := innerSL ℝ vnormal |
| 92 | have hell : ell u ≠ 0 := by change ⟪vnormal, u⟫_ℝ ≠ 0; linarith |
| 93 | have helnorm : ‖ell‖ ≤ 1 := by |
| 94 | apply ell.opNorm_le_bound zero_le_one |
| 95 | intro z |
| 96 | exact (norm_inner_le_norm vnormal z).trans |
| 97 | (mul_le_mul_of_nonneg_right hv (norm_nonneg _)) |
| 98 | have hcabs : c ≤ |ell u| := by |
| 99 | change c ≤ |⟪vnormal, u⟫_ℝ| |
| 100 | exact (by linarith : c ≤ -⟪vnormal, u⟫_ℝ).trans (neg_le_abs _) |
| 101 | have hprod : ‖ell‖ * ‖u‖ ≤ 1 := by |
| 102 | simpa only [one_mul] using mul_le_mul helnorm hu (norm_nonneg u) zero_le_one |
| 103 | have hcoef : ‖ell‖ * ‖u‖ / |ell u| ≤ 1 / c := |
| 104 | (div_le_div_of_nonneg_right hprod (abs_nonneg _)).trans |
| 105 | (div_le_div_of_nonneg_left zero_le_one hc hcabs) |
| 106 | exact (norm_project_after_linearMap_le L ell x u hLu hell hA hL w).trans |
| 107 | (mul_le_mul_of_nonneg_right |
| 108 | (mul_le_mul_of_nonneg_right (add_le_add le_rfl hcoef) hA) (norm_nonneg _)) |
| 109 | |
| 110 | /-- Two vectors of norm at least one half with small sum have uniformly negative pairing. -/ |
| 111 | theorem inner_le_neg_eighth_of_small_sum (u v : F) {δ : ℝ} |
| 112 | (hu : 1 / 2 ≤ ‖u‖) (hv : 1 / 2 ≤ ‖v‖) |
| 113 | (hsum : ‖u + v‖ ^ 2 ≤ 4 * δ) (hδ : δ ≤ 1 / 16) : |
| 114 | ⟪u, v⟫_ℝ ≤ -(1 / 8) := by |
| 115 | rw [norm_add_sq_real] at hsum |
| 116 | nlinarith [norm_nonneg u, norm_nonneg v] |
| 117 | |
| 118 | end Poincare.InnerProductSpace |
| 119 |