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.Curvature.Calculus |
| 2 | import PoincareLib.Geometry.RicciFlow.Splitting.PartialTraceEvolution |
| 3 | import PoincareLib.Geometry.RicciFlow.Splitting.TimeTransport.Smooth |
| 4 | |
| 5 | /-! |
| 6 | # Continuity of Ricci partial traces |
| 7 | |
| 8 | Smooth terminal frames and metric-compatible time transport give local |
| 9 | orthonormal frames throughout a closed Ricci-flow slab. In these frames the |
| 10 | Ricci partial traces are the continuous variational partial traces of matrices. |
| 11 | -/ |
| 12 | |
| 13 | noncomputable section |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | set_option backward.isDefEq.respectTransparency false |
| 17 | set_option maxHeartbeats 800000 |
| 18 | |
| 19 | open Set Filter Bundle |
| 20 | open scoped Manifold ContDiff Topology BigOperators |
| 21 | |
| 22 | namespace Poincare.RicciFlow.Splitting |
| 23 | |
| 24 | variable {E H : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] |
| 25 | [NormedAddCommGroup H] [InnerProductSpace ℝ H] |
| 26 | |
| 27 | /-- The frame definition of a partial trace is invariant under isometries. -/ |
| 28 | theorem partialTrace_eq_of_isometry (k : ℕ) (A : E →L[ℝ] E) (B : H →L[ℝ] H) |
| 29 | (P : E ≃ₗᵢ[ℝ] H) |
| 30 | (h : ∀ v, inner ℝ (A v) v = inner ℝ (B (P v)) (P v)) : |
| 31 | partialTrace k A = partialTrace k B := by |
| 32 | unfold partialTrace |
| 33 | congr 1 |
| 34 | ext r |
| 35 | constructor |
| 36 | · rintro ⟨v, hv, rfl⟩ |
| 37 | refine ⟨P ∘ v, P.toLinearIsometry.orthonormal_comp_iff.mpr hv, ?_⟩ |
| 38 | simp only [frameTrace, Function.comp_apply, h] |
| 39 | · rintro ⟨v, hv, rfl⟩ |
| 40 | refine ⟨P.symm ∘ v, P.symm.toLinearIsometry.orthonormal_comp_iff.mpr hv, ?_⟩ |
| 41 | simp only [frameTrace, Function.comp_apply, h, P.apply_symm_apply] |
| 42 | |
| 43 | private def matrixOperator {ι : Type*} [Fintype ι] |
| 44 | (e : OrthonormalBasis ι ℝ E) (c : ι → ι → ℝ) : E →L[ℝ] E := |
| 45 | ∑ i, ∑ j, c i j • (innerSL ℝ (e i)).smulRight (e j) |
| 46 | |
| 47 | private theorem matrixOperator_basis {ι : Type*} [Fintype ι] |
| 48 | (e : OrthonormalBasis ι ℝ E) (c : ι → ι → ℝ) (i : ι) : |
| 49 | matrixOperator e c (e i) = ∑ j, c i j • e j := by |
| 50 | classical |
| 51 | simp [matrixOperator, OrthonormalBasis.inner_eq_ite] |
| 52 | |
| 53 | private theorem matrixOperator_inner_basis {ι : Type*} [Fintype ι] |
| 54 | (e : OrthonormalBasis ι ℝ E) (c : ι → ι → ℝ) (i j : ι) : |
| 55 | inner ℝ (matrixOperator e c (e i)) (e j) = c i j := by |
| 56 | classical |
| 57 | rw [matrixOperator_basis] |
| 58 | simp [sum_inner, real_inner_smul_left, e.inner_eq_ite] |
| 59 | |
| 60 | private theorem matrixOperator_pairing {ι : Type*} [Fintype ι] |
| 61 | (e : OrthonormalBasis ι ℝ E) (c : ι → ι → ℝ) |
| 62 | (B : H →L[ℝ] H) (P : E ≃ₗᵢ[ℝ] H) |
| 63 | (hc : ∀ i j, c i j = inner ℝ (B (P (e i))) (P (e j))) (v : E) : |
| 64 | inner ℝ (matrixOperator e c v) v = inner ℝ (B (P v)) (P v) := by |
| 65 | have hbas (i : ι) : matrixOperator e c (e i) = P.symm (B (P (e i))) := by |
| 66 | apply e.repr.injective |
| 67 | ext j |
| 68 | simp only [OrthonormalBasis.repr_apply_apply] |
| 69 | rw [real_inner_comm, matrixOperator_inner_basis, hc] |
| 70 | rw [← P.inner_map_map, P.apply_symm_apply] |
| 71 | exact real_inner_comm _ _ |
| 72 | have heq (x : E) : matrixOperator e c x = P.symm (B (P x)) := by |
| 73 | rw [← e.sum_repr x] |
| 74 | simp only [map_sum, map_smul, hbas] |
| 75 | rw [heq] |
| 76 | rw [← P.inner_map_map, P.apply_symm_apply] |
| 77 | |
| 78 | private theorem continuousOn_matrixOperator {ι X : Type*} [Fintype ι] |
| 79 | [TopologicalSpace X] (e : OrthonormalBasis ι ℝ E) (c : X → ι → ι → ℝ) |
| 80 | {S : Set X} (hc : ∀ i j, ContinuousOn (fun q => c q i j) S) : |
| 81 | ContinuousOn (fun q => matrixOperator e (c q)) S := by |
| 82 | apply continuousOn_finsetSum |
| 83 | intro i _ |
| 84 | apply continuousOn_finsetSum |
| 85 | intro j _ |
| 86 | exact (hc i j).smul continuousOn_const |
| 87 | |
| 88 | end Poincare.RicciFlow.Splitting |
| 89 | |
| 90 | universe u |
| 91 | |
| 92 | namespace PoincareMT.RicciFlow.Splitting |
| 93 | |
| 94 | private theorem exists_linearIsometryEquiv_of_basis_pairings |
| 95 | {E H : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] |
| 96 | [NormedAddCommGroup H] [InnerProductSpace ℝ H] |
| 97 | [FiniteDimensional ℝ E] [FiniteDimensional ℝ H] |
| 98 | {ι : Type*} [Fintype ι] (b : OrthonormalBasis ι ℝ E) (w : ι → H) |
| 99 | (hw : ∀ i j, inner ℝ (w i) (w j) = inner ℝ (b i) (b j)) |
| 100 | (hdim : Module.finrank ℝ E = Module.finrank ℝ H) : |
| 101 | ∃ P : E ≃ₗᵢ[ℝ] H, ∀ i, P (b i) = w i := by |
| 102 | classical |
| 103 | let L : E →ₗ[ℝ] H := b.toBasis.constr ℝ w |
| 104 | have hL : Orthonormal ℝ (L ∘ b.toBasis) := by |
| 105 | rw [orthonormal_iff_ite] |
| 106 | intro i j |
| 107 | simp only [Function.comp_apply, L, Module.Basis.constr_basis] |
| 108 | exact (hw i j).trans ((orthonormal_iff_ite.mp b.orthonormal) i j) |
| 109 | let f := L.isometryOfOrthonormal b.orthonormal hL |
| 110 | have hsurj : Function.Surjective f := |
| 111 | (LinearMap.injective_iff_surjective_of_finrank_eq_finrank hdim).mp f.injective |
| 112 | refine ⟨LinearIsometryEquiv.ofSurjective f hsurj, ?_⟩ |
| 113 | intro i |
| 114 | exact b.toBasis.constr_basis ℝ w i |
| 115 | |
| 116 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 117 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 118 | {a b : ℝ} |
| 119 | |
| 120 | /-- A single smooth terminal frame can be transported through the entire |
| 121 | closed slab while retaining all its pairings. -/ |
| 122 | theorem exists_smooth_local_ricci_transport_frame [T2Space M] |
| 123 | (hC : RicciFlowCurvatureCalculus.{u}) (hab : a < b) |
| 124 | (F : RicciFlow n M (Icc a b)) (p : M) : |
| 125 | ∃ (U : Set M) (Y : Fin n → ℝ → (x : M) → TangentSpace (𝓡 n) x), |
| 126 | IsOpen U ∧ p ∈ U ∧ |
| 127 | (∀ i, ContMDiffOn (𝓘(ℝ, ℝ).prod (𝓡 n)) |
| 128 | ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ |
| 129 | (fun q : ℝ × M => TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) q.2 |
| 130 | (Y i q.1 q.2)) (Icc a b ×ˢ univ)) ∧ |
| 131 | (∀ t ∈ Icc a b, ∀ x ∈ U, ∀ i j, |
| 132 | (F.metric t).inner x (Y i t x) (Y j t x) = if i = j then 1 else 0) := by |
| 133 | classical |
| 134 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 135 | ⟨(F.metric b).toRiemannianMetric⟩ |
| 136 | obtain ⟨r, W, hr, _, hW, hinit, _, P, hP⟩ := |
| 137 | (F.connection b).exists_radialParallelIsometries p |
| 138 | let V := LeviCivitaData.radialNeighborhood (n := n) p r |
| 139 | have hV : IsOpen V := LeviCivitaData.isOpen_radialNeighborhood p r |
| 140 | have hpV : p ∈ V := LeviCivitaData.mem_radialNeighborhood p hr |
| 141 | obtain ⟨χ, -, hχV⟩ := |
| 142 | (SmoothBumpFunction.nhds_basis_tsupport (I := 𝓡 n) p).mem_iff.mp (hV.mem_nhds hpV) |
| 143 | obtain ⟨U, hUsub, hU, hpU⟩ := mem_nhds_iff.mp |
| 144 | (Filter.Eventually.and (hV.mem_nhds hpV) χ.eventuallyEq_one) |
| 145 | have hdim : Module.finrank ℝ (TangentSpace (𝓡 n) p) = n := |
| 146 | finrank_euclideanSpace_fin |
| 147 | let ι : Fin n → Fin (Module.finrank ℝ (TangentSpace (𝓡 n) p)) := |
| 148 | Fin.cast hdim.symm |
| 149 | let Z : Fin n → (x : M) → TangentSpace (𝓡 n) x := fun i => |
| 150 | χ.toFun • LeviCivitaData.fieldFromCenteredCoordinates p (W (ι i)) |
| 151 | have hZ (i : Fin n) : ContMDiff (𝓡 n) |
| 152 | ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ (T% (Z i)) := by |
| 153 | apply ContMDiffOn.smul_section_of_tsupport χ.contMDiff.contMDiffOn hV hχV |
| 154 | intro x hx |
| 155 | exact (LeviCivitaData.contMDiffAt_fieldFromCenteredCoordinates p |
| 156 | (hW (ι i)).contDiffAt hx.1).contMDiffWithinAt |
| 157 | choose T hTb hTode hTpair hTinv using exists_terminal_ricci_transport hC hab F |
| 158 | let Y : Fin n → ℝ → (x : M) → TangentSpace (𝓡 n) x := |
| 159 | fun i t x => T x t (Z i x) |
| 160 | have hYb (i : Fin n) : Y i b = Z i := by |
| 161 | funext x |
| 162 | simp only [Y, hTb, ContinuousLinearMap.id_apply] |
| 163 | refine ⟨U, Y, hU, hpU, ?_, ?_⟩ |
| 164 | · intro i |
| 165 | apply ricci_transport_contMDiffOn hab F (Y i) |
| 166 | · simpa only [hYb] using hZ i |
| 167 | · intro x t ht |
| 168 | exact hTode x t ht (Z i x) |
| 169 | · intro t ht x hx i j |
| 170 | rw [hTpair x t ht] |
| 171 | have hxV : x ∈ V := (hUsub hx).1 |
| 172 | have hχx : χ x = 1 := (hUsub hx).2 |
| 173 | have hPi (l : Fin n) : |
| 174 | P ⟨x, hxV⟩ ((F.metric b).orthonormalBasis p (ι l)) = Z l x := by |
| 175 | rw [hP] |
| 176 | simp [Z, hχx] |
| 177 | rw [← hPi i, ← hPi j] |
| 178 | change inner ℝ (P ⟨x, hxV⟩ _) (P ⟨x, hxV⟩ _) = _ |
| 179 | rw [(P ⟨x, hxV⟩).inner_map_map] |
| 180 | simp only [OrthonormalBasis.inner_eq_ite, ι, Fin.cast_inj] |
| 181 | |
| 182 | /-- Ricci pairings of jointly smooth fields are continuous on the closed slab. -/ |
| 183 | theorem continuousOn_ricci_pairing (hab : a < b) (F : RicciFlow n M (Icc a b)) |
| 184 | (X Y : ℝ → (x : M) → TangentSpace (𝓡 n) x) |
| 185 | (hX : ContMDiffOn (𝓘(ℝ, ℝ).prod (𝓡 n)) |
| 186 | ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ |
| 187 | (fun q : ℝ × M => TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) q.2 (X q.1 q.2)) |
| 188 | (Icc a b ×ˢ univ)) |
| 189 | (hY : ContMDiffOn (𝓘(ℝ, ℝ).prod (𝓡 n)) |
| 190 | ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ |
| 191 | (fun q : ℝ × M => TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) q.2 (Y q.1 q.2)) |
| 192 | (Icc a b ×ˢ univ)) : |
| 193 | ContinuousOn (fun q : ℝ × M => |
| 194 | (F.connection q.1).ricci q.2 (X q.1 q.2) (Y q.1 q.2)) (Icc a b ×ˢ univ) := by |
| 195 | have h : ContinuousOn (fun q : ℝ × M => (F.metric q.1).inner q.2 |
| 196 | (ricciEndomorphism F q.2 q.1 (X q.1 q.2)) (Y q.1 q.2)) (Icc a b ×ˢ univ) := by |
| 197 | intro q hq |
| 198 | have hRX := (contMDiffOn_ricciEndomorphism hab F q hq).clm_bundle_apply (hX q hq) |
| 199 | have hpair := (F.smooth q hq).clm_bundle_apply₂ |
| 200 | (F₃ := ℝ) (E₃ := fun _ : M => ℝ) hRX (hY q hq) |
| 201 | exact (contMDiffWithinAt_totalSpace.mp hpair).2.continuousWithinAt |
| 202 | apply h.congr |
| 203 | intro q hq |
| 204 | exact (inner_ricciEndomorphism hab F q.2 hq.1 _ _).symm |
| 205 | |
| 206 | /-- Every Ricci partial trace is jointly continuous, including both endpoints. |
| 207 | No curvature sign or kernel-dimension hypothesis is needed for continuity. -/ |
| 208 | theorem ricciPartialTrace_continuousOn [T2Space M] |
| 209 | (hC : RicciFlowCurvatureCalculus.{u}) (hab : a < b) |
| 210 | (F : RicciFlow n M (Icc a b)) {k : ℕ} (hk : k ≤ n) : |
| 211 | ContinuousOn (fun q : ℝ × M => ricciPartialTrace (F.connection q.1) k q.2) |
| 212 | (Icc a b ×ˢ univ) := by |
| 213 | classical |
| 214 | rintro ⟨t, p⟩ ⟨ht, _⟩ |
| 215 | obtain ⟨U, Y, hU, hpU, hY, hpair⟩ := |
| 216 | exists_smooth_local_ricci_transport_frame hC hab F p |
| 217 | let e := EuclideanSpace.basisFun (Fin n) ℝ |
| 218 | let c : (ℝ × M) → Fin n → Fin n → ℝ := fun q i j => |
| 219 | (F.connection q.1).ricci q.2 (Y i q.1 q.2) (Y j q.1 q.2) |
| 220 | have hc (i j : Fin n) : ContinuousOn (fun q => c q i j) (Icc a b ×ˢ univ) := |
| 221 | continuousOn_ricci_pairing hab F (Y i) (Y j) (hY i) (hY j) |
| 222 | let A := fun q => Poincare.RicciFlow.Splitting.matrixOperator e (c q) |
| 223 | have hA : ContinuousOn A (Icc a b ×ˢ univ) := |
| 224 | Poincare.RicciFlow.Splitting.continuousOn_matrixOperator e c hc |
| 225 | have hkE : k ≤ Module.finrank ℝ (EuclideanSpace ℝ (Fin n)) := by |
| 226 | simpa only [finrank_euclideanSpace_fin] using hk |
| 227 | have hcont := (Poincare.RicciFlow.Splitting.continuous_partialTrace hkE).comp_continuousOn hA |
| 228 | have heq (q : ℝ × M) (htq : q.1 ∈ Icc a b) (hxq : q.2 ∈ U) : |
| 229 | ricciPartialTrace (F.connection q.1) k q.2 = |
| 230 | Poincare.RicciFlow.Splitting.partialTrace k (A q) := by |
| 231 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 232 | ⟨(F.metric q.1).toRiemannianMetric⟩ |
| 233 | let : FiniteDimensional ℝ (TangentSpace (𝓡 n) q.2) := |
| 234 | VectorBundle.finiteDimensional ℝ (EuclideanSpace ℝ (Fin n)) |
| 235 | (TangentSpace (𝓡 n) : M → Type _) q.2 |
| 236 | obtain ⟨P, hP⟩ := exists_linearIsometryEquiv_of_basis_pairings e |
| 237 | (fun i => Y i q.1 q.2) |
| 238 | (by intro i j; exact (hpair q.1 htq q.2 hxq i j).trans (e.inner_eq_ite i j).symm) |
| 239 | (by rfl) |
| 240 | symm |
| 241 | apply Poincare.RicciFlow.Splitting.partialTrace_eq_of_isometry k (A q) |
| 242 | (metricRicciOperator (F.connection q.1) q.2) P |
| 243 | apply Poincare.RicciFlow.Splitting.matrixOperator_pairing |
| 244 | intro i j |
| 245 | rw [hP, hP] |
| 246 | exact (metricRicciOperator_inner (F.connection q.1) q.2 _ _).symm |
| 247 | apply (hcont (t, p) ⟨ht, mem_univ p⟩).congr_of_eventuallyEq_of_mem _ ⟨ht, mem_univ p⟩ |
| 248 | have hUnhds : ∀ᶠ q : ℝ × M in 𝓝 (t, p), q.2 ∈ U := |
| 249 | continuousAt_snd.preimage_mem_nhds (hU.mem_nhds hpU) |
| 250 | filter_upwards [self_mem_nhdsWithin, nhdsWithin_le_nhds hUnhds] with q hq hqU |
| 251 | exact heq q hq.1 hqU |
| 252 | |
| 253 | /-- The space-first form consumed by the scalar strong maximum principle. -/ |
| 254 | theorem ricciPartialTrace_continuousOn_prod [T2Space M] |
| 255 | (hC : RicciFlowCurvatureCalculus.{u}) (hab : a < b) |
| 256 | (F : RicciFlow n M (Icc a b)) {k : ℕ} (hk : k ≤ n) : |
| 257 | ContinuousOn (fun q : M × ℝ => ricciPartialTrace (F.connection q.2) k q.1) |
| 258 | (univ ×ˢ Icc a b) := by |
| 259 | have hs : ContinuousOn (Prod.swap : M × ℝ → ℝ × M) (univ ×ˢ Icc a b) := |
| 260 | continuous_swap.continuousOn |
| 261 | have hm : MapsTo (Prod.swap : M × ℝ → ℝ × M) |
| 262 | (univ ×ˢ Icc a b) (Icc a b ×ˢ univ) := fun q hq => ⟨hq.2, hq.1⟩ |
| 263 | have h := (ricciPartialTrace_continuousOn hC hab F hk).comp hs hm |
| 264 | simpa only [Function.comp_def, Prod.swap] using h |
| 265 | |
| 266 | end PoincareMT.RicciFlow.Splitting |