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.FiniteDimensional |
| 2 | import Mathlib.Analysis.InnerProductSpace.Symmetric |
| 3 | import Mathlib.Analysis.Calculus.ContDiff.Operations |
| 4 | import Mathlib.Analysis.Calculus.MeanValue |
| 5 | import Mathlib.Analysis.Normed.Operator.Banach |
| 6 | import Mathlib.Topology.LocallyConstant.Basic |
| 7 | |
| 8 | /-! |
| 9 | # Temporal invariance of symmetric kernels |
| 10 | |
| 11 | Adding the orthogonal projection onto a reference kernel regularizes a |
| 12 | symmetric operator. Constant kernel dimension then constructs local null |
| 13 | sections by inversion. If the operator derivative annihilates its kernel, |
| 14 | these sections are constant. No restriction on the kernel dimension is used. |
| 15 | |
| 16 | This is the temporal linear algebra in the tensor maximum-principle route |
| 17 | to Ricci-flow splitting; spatial constant rank and the null derivative |
| 18 | identity remain separate geometric obligations. |
| 19 | -/ |
| 20 | |
| 21 | set_option autoImplicit false |
| 22 | |
| 23 | noncomputable section |
| 24 | |
| 25 | open Set Filter |
| 26 | open scoped Topology RealInnerProductSpace ContDiff |
| 27 | |
| 28 | namespace Poincare.RicciFlow.Splitting |
| 29 | |
| 30 | variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] |
| 31 | [FiniteDimensional ℝ E] |
| 32 | |
| 33 | omit [FiniteDimensional ℝ E] in |
| 34 | private lemma isInvertible_of_isUnit {A : E →L[ℝ] E} (hA : IsUnit A) : |
| 35 | A.IsInvertible := by |
| 36 | rcases hA with ⟨e, rfl⟩ |
| 37 | exact ⟨ContinuousLinearEquiv.ofUnit e, rfl⟩ |
| 38 | |
| 39 | lemma isInvertible_add_kernel_projection (A : E →L[ℝ] E) |
| 40 | (hA : A.toLinearMap.IsSymmetric) : |
| 41 | (A + A.ker.starProjection).IsInvertible := by |
| 42 | let K := A.ker |
| 43 | let P := K.starProjection |
| 44 | have hinj : Function.Injective (A + P) := by |
| 45 | apply (LinearMap.ker_eq_bot).mp |
| 46 | apply LinearMap.ker_eq_bot'.mpr |
| 47 | intro x hx |
| 48 | change A x + P x = 0 at hx |
| 49 | have hAP : A (P x) = 0 := (K.orthogonalProjectionOnto x).property |
| 50 | have horth : inner ℝ (A x) (P x) = 0 := by |
| 51 | calc |
| 52 | inner ℝ (A x) (P x) = inner ℝ x (A (P x)) := hA x (P x) |
| 53 | _ = 0 := by rw [hAP, inner_zero_right] |
| 54 | have hP : P x = 0 := inner_self_eq_zero.mp (by |
| 55 | calc |
| 56 | inner ℝ (P x) (P x) = inner ℝ (A x + P x) (P x) := by |
| 57 | rw [inner_add_left, horth, zero_add] |
| 58 | _ = 0 := by rw [hx, inner_zero_left]) |
| 59 | have hAx : A x = 0 := by simpa [hP] using hx |
| 60 | have hfix : P x = x := K.starProjection_mem_subspace_eq_self ⟨x, hAx⟩ |
| 61 | exact hfix.symm.trans hP |
| 62 | apply isInvertible_of_isUnit |
| 63 | apply ContinuousLinearMap.isUnit_iff_bijective.mpr |
| 64 | exact ⟨hinj, LinearMap.injective_iff_surjective.mp hinj⟩ |
| 65 | |
| 66 | private lemma inverse_regularized_mem_kernel (A : E →L[ℝ] E) |
| 67 | (K : Submodule ℝ E) (hB : (A + K.starProjection).IsInvertible) |
| 68 | (hdim : Module.finrank ℝ A.ker = Module.finrank ℝ K) (c : K) : |
| 69 | A ((A + K.starProjection).inverse c) = 0 := by |
| 70 | let L : A.ker →ₗ[ℝ] K := |
| 71 | K.orthogonalProjectionOnto.toLinearMap.comp A.ker.subtype |
| 72 | have hL : Function.Injective L := by |
| 73 | intro x y hxy |
| 74 | apply Subtype.ext |
| 75 | apply hB.injective |
| 76 | change A x + K.starProjection x = A y + K.starProjection y |
| 77 | rw [show A x = 0 from x.property, show A y = 0 from y.property, zero_add, zero_add] |
| 78 | exact congrArg Subtype.val hxy |
| 79 | obtain ⟨z, hz⟩ := |
| 80 | (LinearMap.injective_iff_surjective_of_finrank_eq_finrank hdim).mp hL c |
| 81 | have hsolve : (A + K.starProjection) z = c := by |
| 82 | change A z + K.starProjection z = c |
| 83 | rw [show A z = 0 from z.property, zero_add] |
| 84 | exact congrArg Subtype.val hz |
| 85 | rw [hB.inverse_apply_eq.mpr hsolve.symm] |
| 86 | exact z.property |
| 87 | |
| 88 | /-- A smooth operator family of constant kernel dimension has a smooth local |
| 89 | null section through each prescribed null vector. Symmetry is needed only at |
| 90 | the reference point to construct the invertible regularization. -/ |
| 91 | theorem exists_local_smooth_kernel_section |
| 92 | {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] |
| 93 | {A : F → E →L[ℝ] E} {U : Set F} (hU : IsOpen U) |
| 94 | (hA : ContDiffOn ℝ ∞ A U) {p : F} (hp : p ∈ U) |
| 95 | (hsym : (A p).toLinearMap.IsSymmetric) |
| 96 | (hdim : ∀ q ∈ U, Module.finrank ℝ (A q).ker = Module.finrank ℝ (A p).ker) |
| 97 | (v : E) (hv : A p v = 0) : |
| 98 | ∃ (V : Set F) (s : F → E), IsOpen V ∧ p ∈ V ∧ V ⊆ U ∧ |
| 99 | ContDiffOn ℝ ∞ s V ∧ s p = v ∧ ∀ q ∈ V, A q (s q) = 0 := by |
| 100 | let K := (A p).ker |
| 101 | let B := fun q => A q + K.starProjection |
| 102 | have hBp : (B p).IsInvertible := isInvertible_add_kernel_projection (A p) hsym |
| 103 | have hnear : ∀ᶠ q in 𝓝 p, IsUnit (B q) := |
| 104 | ((hA.continuousOn.continuousAt (hU.mem_nhds hp)).add_const K.starProjection).eventually |
| 105 | (Units.isOpen.mem_nhds (ContinuousLinearMap.isUnit_iff_bijective.mpr hBp.bijective)) |
| 106 | obtain ⟨V, hVB, hVo, hpV⟩ := mem_nhds_iff.mp hnear |
| 107 | let W := V ∩ U |
| 108 | have hB (q : F) (hq : q ∈ W) : (B q).IsInvertible := |
| 109 | isInvertible_of_isUnit (hVB hq.1) |
| 110 | refine ⟨W, fun q => (B q).inverse v, hVo.inter hU, ⟨hpV, hp⟩, |
| 111 | inter_subset_right, ?_, ?_, ?_⟩ |
| 112 | · intro q hq |
| 113 | have hBq : ContDiffWithinAt ℝ ∞ B W q := |
| 114 | ((hA q hq.2).mono inter_subset_right).add contDiffWithinAt_const |
| 115 | exact ((hB q hq).contDiffAt_map_inverse.comp_contDiffWithinAt q hBq).clm_apply |
| 116 | contDiffWithinAt_const |
| 117 | · apply hBp.inverse_apply_eq.mpr |
| 118 | change v = A p v + K.starProjection v |
| 119 | rw [hv, zero_add, K.starProjection_mem_subspace_eq_self ⟨v, hv⟩] |
| 120 | · intro q hq |
| 121 | exact inverse_regularized_mem_kernel (A q) K (hB q hq) (hdim q hq.2) ⟨v, hv⟩ |
| 122 | |
| 123 | private lemma regularized_section_hasDerivWithinAt_zero |
| 124 | {A D : ℝ → E →L[ℝ] E} {J : Set ℝ} {t : ℝ} |
| 125 | (ht : t ∈ J) (hJu : UniqueDiffWithinAt ℝ J t) |
| 126 | (hA : HasDerivWithinAt A (D t) J t) |
| 127 | (K : Submodule ℝ E) |
| 128 | (hB : ∀ s ∈ J, (A s + K.starProjection).IsInvertible) |
| 129 | (hdim : Module.finrank ℝ (A t).ker = Module.finrank ℝ K) |
| 130 | (hann : ∀ v, A t v = 0 → D t v = 0) (c : K) : |
| 131 | HasDerivWithinAt (fun s => (A s + K.starProjection).inverse c) 0 J t := by |
| 132 | let B := fun s => A s + K.starProjection |
| 133 | let y := fun s => (B s).inverse c |
| 134 | have hBd : HasDerivWithinAt B (D t) J t := hA.add_const _ |
| 135 | have hyd : DifferentiableWithinAt ℝ y J t := |
| 136 | (((hB t ht).contDiffAt_map_inverse (n := 1)).differentiableAt (by simp)).comp_differentiableWithinAt |
| 137 | t hBd.differentiableWithinAt |>.clm_apply (differentiableWithinAt_const (c : E)) |
| 138 | let dy := derivWithin y J t |
| 139 | have hyD : HasDerivWithinAt y dy J t := hyd.hasDerivWithinAt |
| 140 | have hprod := hBd.clm_apply hyD |
| 141 | have hconst : HasDerivWithinAt (fun s => B s (y s)) 0 J t := |
| 142 | (hasDerivWithinAt_const t J (c : E)).congr_of_mem |
| 143 | (fun s hs => (hB s hs).self_apply_inverse c) ht |
| 144 | have hnull : A t (y t) = 0 := |
| 145 | inverse_regularized_mem_kernel (A t) K (hB t ht) hdim c |
| 146 | have hzero : dy = 0 := by |
| 147 | apply (hB t ht).injective |
| 148 | have heq := (hprod.derivWithin hJu).symm.trans (hconst.derivWithin hJu) |
| 149 | simpa only [hann (y t) hnull, zero_add, map_zero] using heq |
| 150 | simpa only [hzero] using hyD |
| 151 | |
| 152 | /-- A differentiable symmetric operator family of constant kernel dimension |
| 153 | has a fixed kernel if its derivative annihilates each current kernel. -/ |
| 154 | theorem kernel_eq_of_derivative_annihilates |
| 155 | {A D : ℝ → E →L[ℝ] E} {J : Set ℝ} {k : ℕ} |
| 156 | (hJ : Convex ℝ J) (hJu : UniqueDiffOn ℝ J) |
| 157 | (hA : ∀ t ∈ J, HasDerivWithinAt A (D t) J t) |
| 158 | (hsym : ∀ t ∈ J, (A t).toLinearMap.IsSymmetric) |
| 159 | (hdim : ∀ t ∈ J, Module.finrank ℝ (A t).ker = k) |
| 160 | (hann : ∀ t ∈ J, ∀ v, A t v = 0 → D t v = 0) |
| 161 | {s t : ℝ} (hs : s ∈ J) (ht : t ∈ J) : |
| 162 | (A s).ker = (A t).ker := by |
| 163 | have hlocal (t : ℝ) (ht : t ∈ J) : |
| 164 | ∃ r > 0, ∀ s ∈ Metric.ball t r ∩ J, (A s).ker = (A t).ker := by |
| 165 | let K := (A t).ker |
| 166 | let B := fun s => A s + K.starProjection |
| 167 | have hBt : (B t).IsInvertible := isInvertible_add_kernel_projection (A t) (hsym t ht) |
| 168 | have hnear : ∀ᶠ s in 𝓝[J] t, IsUnit (B s) := |
| 169 | ((hA t ht).continuousWithinAt.add_const K.starProjection).eventually |
| 170 | (Units.isOpen.mem_nhds (ContinuousLinearMap.isUnit_iff_bijective.mpr hBt.bijective)) |
| 171 | obtain ⟨r, hr, hrad⟩ := Metric.mem_nhdsWithin_iff.mp hnear |
| 172 | let V := J ∩ Metric.ball t r |
| 173 | have hV : Convex ℝ V := hJ.inter (convex_ball t r) |
| 174 | have hVu : UniqueDiffOn ℝ V := hJu.inter Metric.isOpen_ball |
| 175 | have htV : t ∈ V := ⟨ht, Metric.mem_ball_self hr⟩ |
| 176 | have hB (q : ℝ) (hq : q ∈ V) : (B q).IsInvertible := |
| 177 | isInvertible_of_isUnit (hrad ⟨hq.2, hq.1⟩) |
| 178 | have hsection (c : K) (q : ℝ) (hq : q ∈ V) : |
| 179 | (B q).inverse c = (B t).inverse c := by |
| 180 | have hd (z : ℝ) (hz : z ∈ V) : |
| 181 | HasDerivWithinAt (fun w => (B w).inverse c) 0 V z := |
| 182 | regularized_section_hasDerivWithinAt_zero hz (hVu z hz) |
| 183 | ((hA z hz.1).mono inter_subset_left) K hB |
| 184 | ((hdim z hz.1).trans (hdim t ht).symm) (hann z hz.1) c |
| 185 | have hbound := Convex.norm_image_sub_le_of_norm_hasDerivWithin_le |
| 186 | hd (fun z hz => le_refl ‖(0 : E)‖) hV htV hq |
| 187 | simpa only [norm_zero, zero_mul, norm_le_zero_iff, sub_eq_zero] using hbound |
| 188 | refine ⟨r, hr, ?_⟩ |
| 189 | intro q hq |
| 190 | have hqV : q ∈ V := ⟨hq.2, hq.1⟩ |
| 191 | have hle : K ≤ (A q).ker := by |
| 192 | intro c hc |
| 193 | have hfix : (B t).inverse c = c := hBt.inverse_apply_eq.mpr (by |
| 194 | change c = A t c + K.starProjection c |
| 195 | rw [show A t c = 0 from hc, zero_add, |
| 196 | K.starProjection_mem_subspace_eq_self ⟨c, hc⟩]) |
| 197 | have heq : (B q).inverse c = c := (hsection ⟨c, hc⟩ q hqV).trans hfix |
| 198 | have hnull := inverse_regularized_mem_kernel (A q) K (hB q hqV) |
| 199 | ((hdim q hq.2).trans (hdim t ht).symm) ⟨c, hc⟩ |
| 200 | rwa [heq] at hnull |
| 201 | exact (Submodule.eq_of_le_of_finrank_eq hle |
| 202 | ((hdim t ht).trans (hdim q hq.2).symm)).symm |
| 203 | let K : J → Submodule ℝ E := fun q => (A q).ker |
| 204 | have hK : IsLocallyConstant K := by |
| 205 | apply (IsLocallyConstant.iff_eventually_eq K).mpr |
| 206 | intro p |
| 207 | obtain ⟨r, hr, hloc⟩ := hlocal p p.property |
| 208 | have hnear : ∀ᶠ q : J in 𝓝 p, (q : ℝ) ∈ Metric.ball p.val r := |
| 209 | (continuous_subtype_val.tendsto p).eventually (Metric.ball_mem_nhds p.val hr) |
| 210 | filter_upwards [hnear] with q hq |
| 211 | exact hloc q ⟨hq, q.property⟩ |
| 212 | let : PreconnectedSpace J := isPreconnected_iff_preconnectedSpace.mp hJ.isPreconnected |
| 213 | exact hK.apply_eq_of_preconnectedSpace ⟨s, hs⟩ ⟨t, ht⟩ |
| 214 | |
| 215 | end Poincare.RicciFlow.Splitting |