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 PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.GeometryImports |
| 2 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.SourceNames |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Predecessors.Necks.Geometry.EuclideanMetric |
| 4 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Predecessors.Necks.Curvature.RicciControl |
| 5 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Predecessors.Necks.Geometry.Overlap_A11 |
| 6 | |
| 7 | /-! |
| 8 | # Pointwise agreement of normalized neck axes |
| 9 | |
| 10 | At a common point the normalized coordinate frames compare through their |
| 11 | metric and Ricci forms. The approximately null Ricci direction is close |
| 12 | to one of the two axial directions. This is Morgan--Tian Proposition |
| 13 | A.11(3), p. 503, following the pointwise-axis-control derivation. No |
| 14 | orientation consistency or transition estimate along a curve is asserted. |
| 15 | -/ |
| 16 | |
| 17 | set_option autoImplicit false |
| 18 | set_option backward.isDefEq.respectTransparency false |
| 19 | set_option maxSynthPendingDepth 12 |
| 20 | |
| 21 | open Set |
| 22 | open scoped Manifold ContDiff |
| 23 | |
| 24 | universe u |
| 25 | |
| 26 | namespace PoincareMT.EpsilonNeck |
| 27 | |
| 28 | private theorem exists_sign_axis_error {H t τ : ℝ} |
| 29 | (hτ : 0 < τ) (hcap : τ ≤ 1 / 200) (hH : 0 ≤ H) (hHτ : H ≤ 6 * τ) |
| 30 | (hmetric : |2 * H + t ^ 2 - 1| ≤ 3 * τ) : |
| 31 | ∃ σ : ℝ, (σ = 1 ∨ σ = -1) ∧ 2 * (2 * H + (t - σ) ^ 2) ≤ 27 * τ := by |
| 32 | have ht : |t ^ 2 - 1| ≤ 15 * τ := by |
| 33 | apply abs_le.mpr |
| 34 | constructor <;> linarith [(abs_le.mp hmetric).1, (abs_le.mp hmetric).2] |
| 35 | have hroot (z : ℝ) (hz : 0 ≤ z) : |z - 1| ≤ |z ^ 2 - 1| := by |
| 36 | have heq : |z ^ 2 - 1| = |z - 1| * (z + 1) := by |
| 37 | rw [show z ^ 2 - 1 = (z - 1) * (z + 1) by ring, |
| 38 | abs_mul, abs_of_nonneg (by linarith : 0 ≤ z + 1)] |
| 39 | rw [heq] |
| 40 | nlinarith [abs_nonneg (z - 1)] |
| 41 | have hsign : ∃ σ : ℝ, (σ = 1 ∨ σ = -1) ∧ |t - σ| ≤ 15 * τ := by |
| 42 | by_cases hpos : 0 ≤ t |
| 43 | · exact ⟨1, Or.inl rfl, (hroot t hpos).trans ht⟩ |
| 44 | · refine ⟨-1, Or.inr rfl, ?_⟩ |
| 45 | have h := (hroot (-t) (by linarith)).trans (by simpa only [neg_sq] using ht) |
| 46 | simpa only [show -t - 1 = -(t - -1) by ring, abs_neg] using h |
| 47 | obtain ⟨σ, hσ, herror⟩ := hsign |
| 48 | have hsq : (t - σ) ^ 2 ≤ (15 * τ) ^ 2 := by |
| 49 | simpa only [← pow_two, sq_abs] using mul_self_le_mul_self (abs_nonneg (t - σ)) herror |
| 50 | refine ⟨σ, hσ, ?_⟩ |
| 51 | nlinarith [mul_nonneg hτ.le (sub_nonneg.mpr hcap)] |
| 52 | |
| 53 | /-- Proposition A.11(3), p. 503, in retained coordinates: at any common |
| 54 | point of two sufficiently small necks, the normalized axes differ by less |
| 55 | than alpha after one of the two signs is chosen. -/ |
| 56 | theorem exists_normalized_axis_control {α : ℝ} (hα : 0 < α) : |
| 57 | ∃ epsilon0 : ℝ, 0 < epsilon0 ∧ epsilon0 ≤ 1 / 200 ∧ |
| 58 | ∀ {M : Type u} [TopologicalSpace M] |
| 59 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] |
| 60 | [IsManifold (𝓡 3) ∞ M] [MeasurableSpace M] [BorelSpace M] [T3Space M] |
| 61 | {g : RiemannianMetric 3 M}, ∀ (N N' : EpsilonNeck g), |
| 62 | N.epsilon ≤ epsilon0 → N'.epsilon ≤ epsilon0 → |
| 63 | ∀ (q q' : UnitTwoSphere) {s s' : ℝ}, |
| 64 | s ∈ Ioo (-N.epsilon⁻¹) N.epsilon⁻¹ → |
| 65 | s' ∈ Ioo (-N'.epsilon⁻¹) N'.epsilon⁻¹ → |
| 66 | N.coordinate_map (q, s) = N'.coordinate_map (q', s') → |
| 67 | ∃ σ : ℝ, (σ = 1 ∨ σ = -1) ∧ |
| 68 | g.tangentNorm (N.coordinate_map (q, s)) |
| 69 | ((show TangentSpace (𝓡 3) (N.coordinate_map (q, s)) from |
| 70 | N'.normalizedEuclideanFrame q' s' (m25_roundCylinderEuclideanBasis 2)) - |
| 71 | σ • N.normalizedEuclideanFrame q s (m25_roundCylinderEuclideanBasis 2)) < α := by |
| 72 | let τ : ℝ := min (1 / 200) (α ^ 2 / 100) |
| 73 | have hτ : 0 < τ := lt_min (by norm_num) (by positivity) |
| 74 | have hτcap : τ ≤ 1 / 200 := min_le_left _ _ |
| 75 | have hτα : τ ≤ α ^ 2 / 100 := min_le_right _ _ |
| 76 | obtain ⟨εR, hεR, _, hRicci⟩ := exists_normalized_ricci_quadratic_control.{u} hτ |
| 77 | obtain ⟨εS, hεS, _, hscale⟩ := exists_intersecting_scale_control.{u} (by norm_num : (0 : ℝ) < 1) |
| 78 | refine ⟨min τ (min εR εS), lt_min hτ (lt_min hεR hεS), |
| 79 | (min_le_left _ _).trans hτcap, ?_⟩ |
| 80 | intro M _ _ _ _ _ _ g N N' hN hN' q q' s s' hs hs' hx |
| 81 | have hNτ := hN.trans (min_le_left _ _) |
| 82 | have hN'τ := hN'.trans (min_le_left _ _) |
| 83 | have hNR := hN.trans ((min_le_right _ _).trans (min_le_left _ _)) |
| 84 | have hN'R := hN'.trans ((min_le_right _ _).trans (min_le_left _ _)) |
| 85 | have hNS := hN.trans ((min_le_right _ _).trans (min_le_right _ _)) |
| 86 | have hN'S := hN'.trans ((min_le_right _ _).trans (min_le_right _ _)) |
| 87 | let x := N.coordinate_map (q, s) |
| 88 | let e := m25_roundCylinderEuclideanBasis 2 |
| 89 | let T := (RiemannianMetric.lineModelEquiv 2).symm |
| 90 | let G := fun v : EuclideanSpace ℝ (Fin 3) => roundCylinderEuclideanModelCoefficients 0 v v |
| 91 | let A : EuclideanSpace ℝ (Fin 3) →L[ℝ] EuclideanSpace ℝ (Fin 3) := |
| 92 | N.normalizedEuclideanFrame q s |
| 93 | let A' : EuclideanSpace ℝ (Fin 3) →L[ℝ] EuclideanSpace ℝ (Fin 3) := |
| 94 | N'.normalizedEuclideanFrame q' s' |
| 95 | let F : EuclideanSpace ℝ (Fin 3) →L[ℝ] EuclideanSpace ℝ (Fin 3) := |
| 96 | mfderiv (𝓡 3) (𝓡 3) (N.euclideanParametrization q s) 0 |
| 97 | let F' : EuclideanSpace ℝ (Fin 3) →L[ℝ] EuclideanSpace ℝ (Fin 3) := |
| 98 | mfderiv (𝓡 3) (𝓡 3) (N'.euclideanParametrization q' s') 0 |
| 99 | let R : EuclideanSpace ℝ (Fin 3) →ₗ[ℝ] EuclideanSpace ℝ (Fin 3) →ₗ[ℝ] ℝ := |
| 100 | RicciFlow.Splitting.ricciBilinear N.connection x |
| 101 | have hTe : T e = (0, 1) := m25_lineModelEquiv_symm_roundCylinderEuclideanBasis 2 |
| 102 | have hRapply (v w : EuclideanSpace ℝ (Fin 3)) : R v w = N.connection.ricci x v w := |
| 103 | RicciFlow.Splitting.ricciBilinear_apply _ _ v w |
| 104 | have hGe : G e = 1 := by |
| 105 | dsimp only [G] |
| 106 | rw [roundCylinderEuclideanModelCoefficients_zero] |
| 107 | change 2 * ‖(T e).1‖ ^ 2 + (T e).2 ^ 2 = 1 |
| 108 | rw [hTe] |
| 109 | norm_num |
| 110 | have hne : ‖e‖ ^ 2 = 1 := by |
| 111 | rw [RiemannianMetric.lineModelEquiv_norm_sq] |
| 112 | change ‖(T e).1‖ ^ 2 + (T e).2 ^ 2 = 1 |
| 113 | rw [hTe] |
| 114 | norm_num |
| 115 | have hmetric (v : EuclideanSpace ℝ (Fin 3)) : |
| 116 | |g.inner x (A v) (A v) - G v| ≤ N.epsilon * G v := by |
| 117 | change |g.inner (N.coordinate_map (q, s)) |
| 118 | (N.normalizedEuclideanFrame q s v) (N.normalizedEuclideanFrame q s v) - G v| ≤ _ |
| 119 | rw [N.normalizedEuclideanFrame_inner q hs] |
| 120 | exact N.normalizedEuclideanCoefficients_quadratic_error q hs v |
| 121 | have hmetric' (v : EuclideanSpace ℝ (Fin 3)) : |
| 122 | |g.inner x (A' v) (A' v) - G v| ≤ N'.epsilon * G v := by |
| 123 | change |g.inner (N.coordinate_map (q, s)) (A' v) (A' v) - G v| ≤ _ |
| 124 | rw [hx] |
| 125 | change |g.inner (N'.coordinate_map (q', s')) |
| 126 | (N'.normalizedEuclideanFrame q' s' v) (N'.normalizedEuclideanFrame q' s' v) - G v| ≤ _ |
| 127 | rw [N'.normalizedEuclideanFrame_inner q' hs'] |
| 128 | exact N'.normalizedEuclideanCoefficients_quadratic_error q' hs' v |
| 129 | obtain ⟨v, hv⟩ := (N.normalizedEuclideanFrame_bijective q hs).2 (A' e) |
| 130 | change A v = A' e at hv |
| 131 | have hGnonneg : 0 ≤ G v := |
| 132 | (sq_nonneg ‖v‖).trans (norm_sq_le_roundCylinderEuclideanModelCoefficients v) |
| 133 | have hm := hmetric v |
| 134 | rw [hv] at hm |
| 135 | have hm' := hmetric' e |
| 136 | rw [hGe, mul_one] at hm' |
| 137 | have hG : G v ≤ 2 := by |
| 138 | have hmul := mul_le_mul_of_nonneg_right hNτ hGnonneg |
| 139 | have hmulcap := mul_le_mul_of_nonneg_right hτcap hGnonneg |
| 140 | nlinarith [(abs_le.mp hm).1, (abs_le.mp hm').2] |
| 141 | have hnv : ‖v‖ ^ 2 ≤ 2 := (norm_sq_le_roundCylinderEuclideanModelCoefficients v).trans hG |
| 142 | have hGerror : |G v - 1| ≤ 3 * τ := by |
| 143 | have hmul := mul_le_mul hNτ hG hGnonneg hτ.le |
| 144 | have htriangle := abs_sub_le (G v) (g.inner x (A' e) (A' e)) 1 |
| 145 | rw [abs_sub_comm (G v) (g.inner x (A' e) (A' e))] at htriangle |
| 146 | linarith |
| 147 | let r := N.scale / N'.scale |
| 148 | have hrpos : 0 < r := div_pos N.scale_pos N'.scale_pos |
| 149 | have hr : r < 2 := by |
| 150 | have hi : (N'.carrier ∩ N.carrier).Nonempty := by |
| 151 | refine ⟨x, ?_, ?_⟩ |
| 152 | · change N.coordinate_map (q, s) ∈ N'.carrier |
| 153 | rw [hx] |
| 154 | exact N'.coordinate_map_mem ⟨mem_univ _, hs'⟩ |
| 155 | · exact N.coordinate_map_mem ⟨mem_univ _, hs⟩ |
| 156 | have h := (hscale N' N hN'S hNS hi).2 |
| 157 | change |r - 1| < 1 at h |
| 158 | linarith [(abs_lt.mp h).2] |
| 159 | have hFv : F v = r • F' e := by |
| 160 | have h := congrArg (fun w : EuclideanSpace ℝ (Fin 3) => N.scale • w) hv |
| 161 | change N.scale • (N.scale⁻¹ • F v) = N.scale • (N'.scale⁻¹ • F' e) at h |
| 162 | simpa only [smul_smul, mul_inv_cancel₀ N.scale_pos.ne', one_smul, r, |
| 163 | div_eq_mul_inv] using h |
| 164 | have hRu : |R (F v) (F v) - ‖(T v).1‖ ^ 2| ≤ τ * ‖v‖ ^ 2 := by |
| 165 | rw [hRapply] |
| 166 | exact hRicci N hNR q hs v |
| 167 | have hR'e : |R (F' e) (F' e)| ≤ τ := by |
| 168 | have h := hRicci N' hN'R q' hs' e |
| 169 | change |N'.connection.ricci (N'.coordinate_map (q', s')) (F' e) (F' e) - |
| 170 | ‖(T e).1‖ ^ 2| ≤ τ * ‖e‖ ^ 2 at h |
| 171 | rw [hTe, hne] at h |
| 172 | simp only [norm_zero, zero_pow (by decide : 2 ≠ 0), sub_zero, mul_one] at h |
| 173 | rw [← hx] at h |
| 174 | have hR : N'.connection.ricci x (F' e) (F' e) = N.connection.ricci x (F' e) (F' e) := by |
| 175 | unfold LeviCivitaData.ricci |
| 176 | simp_rw [N'.connection.horizon_curvatureTensor_eq N.connection x] |
| 177 | exact (congrArg abs ((hRapply _ _).trans hR.symm)).trans_le h |
| 178 | have hRv : |R (F v) (F v)| ≤ 4 * τ := by |
| 179 | have heq : R (F v) (F v) = r ^ 2 * R (F' e) (F' e) := by |
| 180 | rw [hFv] |
| 181 | simp only [map_smul, LinearMap.smul_apply, smul_eq_mul] |
| 182 | ring |
| 183 | rw [heq, abs_mul, abs_of_nonneg (sq_nonneg r)] |
| 184 | exact (mul_le_mul_of_nonneg_left hR'e (sq_nonneg r)).trans |
| 185 | (mul_le_mul_of_nonneg_right (by nlinarith : r ^ 2 ≤ 4) hτ.le) |
| 186 | have hH : ‖(T v).1‖ ^ 2 ≤ 6 * τ := by |
| 187 | have hmul := mul_le_mul_of_nonneg_left hnv hτ.le |
| 188 | linarith [(abs_le.mp hRu).1, (abs_le.mp hRv).2] |
| 189 | have hGform : G v = 2 * ‖(T v).1‖ ^ 2 + (T v).2 ^ 2 := |
| 190 | roundCylinderEuclideanModelCoefficients_zero v |
| 191 | rw [hGform] at hGerror |
| 192 | obtain ⟨σ, hσ, herror⟩ := exists_sign_axis_error hτ hτcap |
| 193 | (sq_nonneg ‖(T v).1‖) hH hGerror |
| 194 | refine ⟨σ, hσ, ?_⟩ |
| 195 | have hGsub : G (v - σ • e) = 2 * ‖(T v).1‖ ^ 2 + ((T v).2 - σ) ^ 2 := by |
| 196 | dsimp only [G] |
| 197 | rw [roundCylinderEuclideanModelCoefficients_zero] |
| 198 | change 2 * ‖(T (v - σ • e)).1‖ ^ 2 + (T (v - σ • e)).2 ^ 2 = _ |
| 199 | simp [map_sub, map_smul, hTe] |
| 200 | have hAsub : A (v - σ • e) = A' e - σ • A e := by rw [map_sub, map_smul, hv] |
| 201 | have hbound : g.inner x (A' e - σ • A e) (A' e - σ • A e) ≤ 27 * τ := by |
| 202 | have hm := (abs_le.mp (hmetric (v - σ • e))).2 |
| 203 | rw [hAsub] at hm |
| 204 | have hnonneg : 0 ≤ G (v - σ • e) := by rw [hGsub]; positivity |
| 205 | have hmul := mul_le_mul_of_nonneg_right (show N.epsilon ≤ 1 by linarith) hnonneg |
| 206 | rw [← hGsub] at herror |
| 207 | linarith |
| 208 | change Real.sqrt (g.inner x (A' e - σ • A e) (A' e - σ • A e)) < α |
| 209 | exact (Real.sqrt_lt' hα).mpr (hbound.trans_lt (by nlinarith [sq_pos_of_pos hα])) |
| 210 | |
| 211 | end PoincareMT.EpsilonNeck |