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.Basic |
| 2 | import Mathlib.Order.Filter.AtTopBot.Tendsto |
| 3 | |
| 4 | /-! |
| 5 | # Gluing compatible Ricci flows over an ancient time interval |
| 6 | |
| 7 | Flows already realized on one smooth carrier and agreeing on overlapping time |
| 8 | windows glue to one Ricci flow. Smoothness and the Ricci equation are local in |
| 9 | time. The construction selects existing connection data, so it requires no |
| 10 | new existence theorem for the Levi-Civita connection. |
| 11 | |
| 12 | This is the time-gluing step in the ancient-limit construction underlying |
| 13 | Kleiner--Lott, Corollary 44.1, pp. 2682--2683 and Appendix E, pp. 2848--2849. |
| 14 | The construction of compatible finite-window limits is a separate step. |
| 15 | -/ |
| 16 | |
| 17 | set_option autoImplicit false |
| 18 | |
| 19 | open Set Filter |
| 20 | open scoped Manifold ContDiff Bundle Topology |
| 21 | |
| 22 | universe u |
| 23 | |
| 24 | namespace PoincareMT.RicciFlow |
| 25 | |
| 26 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 27 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 28 | {a : ℕ → ℝ} {T : ℝ} |
| 29 | |
| 30 | namespace TimeGluing |
| 31 | |
| 32 | variable (F : ∀ j, RicciFlow n M (Ioo (a j) T)) |
| 33 | (hcover : ∀ t < T, ∃ j, a j < t) |
| 34 | (hcompat : ∀ i j t, t ∈ Ioo (a i) T → t ∈ Ioo (a j) T → |
| 35 | (F i).metric t = (F j).metric t) |
| 36 | |
| 37 | private noncomputable def index (t : ℝ) : ℕ := |
| 38 | if ht : t < T then Classical.choose (hcover t ht) else 0 |
| 39 | |
| 40 | private theorem index_mem {t : ℝ} (ht : t < T) : |
| 41 | t ∈ Ioo (a (index hcover t)) T := by |
| 42 | simpa only [index, dif_pos ht, mem_Ioo] using |
| 43 | And.intro (Classical.choose_spec (hcover t ht)) ht |
| 44 | |
| 45 | /-- Total metric representative obtained by choosing a window containing each |
| 46 | ancient time; values outside the time domain use the zeroth representative. -/ |
| 47 | noncomputable def metric (t : ℝ) : RiemannianMetric n M := |
| 48 | (F (index hcover t)).metric t |
| 49 | |
| 50 | include hcompat in |
| 51 | /-- On every window, the selected metric is exactly its original metric. -/ |
| 52 | theorem metric_eq (j : ℕ) {t : ℝ} (ht : t ∈ Ioo (a j) T) : |
| 53 | metric F hcover t = (F j).metric t := |
| 54 | hcompat _ j t (index_mem hcover ht.2) ht |
| 55 | |
| 56 | include hcompat in |
| 57 | private theorem metric_eventuallyEq (j : ℕ) {t : ℝ} |
| 58 | (ht : t ∈ Ioo (a j) T) : |
| 59 | metric F hcover =ᶠ[𝓝 t] (F j).metric := by |
| 60 | filter_upwards [Ioo_mem_nhds ht.1 ht.2] with s hs |
| 61 | exact metric_eq F hcover hcompat j hs |
| 62 | |
| 63 | /-- The selected existing connection is compatible with the selected metric. -/ |
| 64 | noncomputable def connection (t : ℝ) : LeviCivitaData (metric F hcover t) := |
| 65 | (F (index hcover t)).connection t |
| 66 | |
| 67 | include hcompat in |
| 68 | theorem smooth : RiemannianMetric.IsSmoothFamilyOn (metric F hcover) (Iio T) := by |
| 69 | intro p hp |
| 70 | obtain ⟨j, hj⟩ := hcover p.1 hp.1 |
| 71 | have hmem : p ∈ Ioo (a j) T ×ˢ (univ : Set M) := ⟨⟨hj, hp.1⟩, mem_univ _⟩ |
| 72 | have hnhds : Ioo (a j) T ×ˢ (univ : Set M) ∈ 𝓝 p := |
| 73 | (isOpen_Ioo.prod isOpen_univ).mem_nhds hmem |
| 74 | apply ContMDiffAt.contMDiffWithinAt |
| 75 | apply ((F j).smooth.contMDiffAt hnhds).congr_of_eventuallyEq |
| 76 | filter_upwards [hnhds] with q hq |
| 77 | simp only [metric_eq F hcover hcompat j hq.1] |
| 78 | |
| 79 | include hcompat in |
| 80 | theorem equation (t : ℝ) (ht : t ∈ Iio T) (x : M) |
| 81 | (v w : TangentSpace (𝓡 n) x) : |
| 82 | HasDerivWithinAt (fun s ↦ (metric F hcover s).inner x v w) |
| 83 | (-2 * (connection F hcover t).ricci x v w) (Iio T) t := by |
| 84 | let j := index hcover t |
| 85 | have hj : t ∈ Ioo (a j) T := index_mem hcover ht |
| 86 | have hderiv := ((F j).equation t hj x v w).hasDerivAt |
| 87 | (Ioo_mem_nhds hj.1 hj.2) |
| 88 | apply HasDerivAt.hasDerivWithinAt |
| 89 | apply hderiv.congr_of_eventuallyEq |
| 90 | filter_upwards [metric_eventuallyEq F hcover hcompat j hj] with s hs |
| 91 | rw [hs] |
| 92 | |
| 93 | end TimeGluing |
| 94 | |
| 95 | /-- Compatible finite-window flows on one carrier define one ancient flow. |
| 96 | The hypotheses express an open time cover and exact agreement on overlaps; |
| 97 | they do not assume an ancient flow or a compactness conclusion. -/ |
| 98 | noncomputable def glueAncient |
| 99 | (F : ∀ j, RicciFlow n M (Ioo (a j) T)) |
| 100 | (hcover : ∀ t < T, ∃ j, a j < t) |
| 101 | (hcompat : ∀ i j t, t ∈ Ioo (a i) T → t ∈ Ioo (a j) T → |
| 102 | (F i).metric t = (F j).metric t) : RicciFlow n M (Iio T) where |
| 103 | metric := TimeGluing.metric F hcover |
| 104 | connection := TimeGluing.connection F hcover |
| 105 | interval := ordConnected_Iio |
| 106 | nontrivial := ⟨T - 2, by simp, T - 1, by simp, by linarith⟩ |
| 107 | smooth := TimeGluing.smooth F hcover hcompat |
| 108 | equation := TimeGluing.equation F hcover hcompat |
| 109 | |
| 110 | theorem glueAncient_metric_eq |
| 111 | (F : ∀ j, RicciFlow n M (Ioo (a j) T)) |
| 112 | (hcover : ∀ t < T, ∃ j, a j < t) |
| 113 | (hcompat : ∀ i j t, t ∈ Ioo (a i) T → t ∈ Ioo (a j) T → |
| 114 | (F i).metric t = (F j).metric t) |
| 115 | (j : ℕ) {t : ℝ} (ht : t ∈ Ioo (a j) T) : |
| 116 | (glueAncient F hcover hcompat).metric t = (F j).metric t := |
| 117 | TimeGluing.metric_eq F hcover hcompat j ht |
| 118 | |
| 119 | /-- At a specified time, a property of the metric and connection passes from |
| 120 | every window containing that time to the constructed flow. In particular this |
| 121 | can transfer nonflatness at a single base time. -/ |
| 122 | theorem glueAncient_slice_property_at |
| 123 | (F : ∀ j, RicciFlow n M (Ioo (a j) T)) |
| 124 | (hcover : ∀ t < T, ∃ j, a j < t) |
| 125 | (hcompat : ∀ i j t, t ∈ Ioo (a i) T → t ∈ Ioo (a j) T → |
| 126 | (F i).metric t = (F j).metric t) |
| 127 | (t : ℝ) (ht : t < T) |
| 128 | (P : (g : RiemannianMetric n M) → LeviCivitaData g → Prop) |
| 129 | (hP : ∀ j, t ∈ Ioo (a j) T → P ((F j).metric t) ((F j).connection t)) : |
| 130 | P ((glueAncient F hcover hcompat).metric t) |
| 131 | ((glueAncient F hcover hcompat).connection t) := |
| 132 | hP (TimeGluing.index hcover t) (TimeGluing.index_mem hcover ht) |
| 133 | |
| 134 | /-- Any property of time slices and their retained connections passes from all |
| 135 | windows to the constructed ancient flow. This applies simultaneously to |
| 136 | completeness, curvature bounds, and curvature-operator nonnegativity. -/ |
| 137 | theorem glueAncient_slice_property |
| 138 | (F : ∀ j, RicciFlow n M (Ioo (a j) T)) |
| 139 | (hcover : ∀ t < T, ∃ j, a j < t) |
| 140 | (hcompat : ∀ i j t, t ∈ Ioo (a i) T → t ∈ Ioo (a j) T → |
| 141 | (F i).metric t = (F j).metric t) |
| 142 | (P : (g : RiemannianMetric n M) → LeviCivitaData g → Prop) |
| 143 | (hP : ∀ j t, t ∈ Ioo (a j) T → P ((F j).metric t) ((F j).connection t)) |
| 144 | (t : ℝ) (ht : t < T) : |
| 145 | P ((glueAncient F hcover hcompat).metric t) |
| 146 | ((glueAncient F hcover hcompat).connection t) := |
| 147 | glueAncient_slice_property_at F hcover hcompat t ht P (fun j ↦ hP j t) |
| 148 | |
| 149 | /-- Lower endpoints tending to minus infinity cover every time below `T`. |
| 150 | Monotonicity of the endpoint sequence is not needed for this cover. -/ |
| 151 | theorem ancientTimeCover_of_tendsto (ha : Tendsto a atTop atBot) : |
| 152 | ∀ t < T, ∃ j, a j < t := by |
| 153 | intro t _ |
| 154 | exact (ha.eventually (eventually_lt_atBot t)).exists |
| 155 | |
| 156 | /-- If a fixed metric family is locally an actual Ricci flow near every |
| 157 | ancient time, the local flows assemble with exactly that total metric family. |
| 158 | Their time intervals and connection representatives may differ. -/ |
| 159 | theorem exists_ancient_of_local_metric_realizations |
| 160 | (g : ℝ → RiemannianMetric n M) |
| 161 | (hg : RiemannianMetric.IsSmoothFamilyOn g (Iio T)) |
| 162 | (hlocal : ∀ t < T, ∃ V : Set ℝ, IsOpen V ∧ t ∈ V ∧ |
| 163 | ∃ F : RicciFlow n M V, F.metric = g) : |
| 164 | ∃ F : RicciFlow n M (Iio T), F.metric = g := by |
| 165 | classical |
| 166 | let time : ℝ → ℝ := fun t ↦ if t < T then t else T - 1 |
| 167 | have htime (t : ℝ) : time t < T := by |
| 168 | dsimp [time] |
| 169 | split_ifs with ht |
| 170 | · exact ht |
| 171 | · linarith |
| 172 | choose V hV htV G hG using fun t ↦ hlocal (time t) (htime t) |
| 173 | let g' : ℝ → RiemannianMetric n M := fun t ↦ (G t).metric t |
| 174 | have hgg : g' = g := by |
| 175 | funext t |
| 176 | exact congrFun (hG t) t |
| 177 | refine ⟨{ |
| 178 | metric := g' |
| 179 | connection := fun t ↦ (G t).connection t |
| 180 | interval := ordConnected_Iio |
| 181 | nontrivial := ⟨T - 2, by simp, T - 1, by simp, by linarith⟩ |
| 182 | smooth := by simpa only [hgg] using hg |
| 183 | equation := ?_ }, hgg⟩ |
| 184 | intro t ht x v w |
| 185 | change t < T at ht |
| 186 | have hmem : t ∈ V t := by |
| 187 | simpa only [time, if_pos ht] using htV t |
| 188 | have hd := ((G t).equation t hmem x v w).hasDerivAt ((hV t).mem_nhds hmem) |
| 189 | apply HasDerivAt.hasDerivWithinAt |
| 190 | apply hd.congr_of_eventuallyEq |
| 191 | exact Eventually.of_forall fun s ↦ by |
| 192 | change ((G s).metric s).inner x v w = ((G t).metric s).inner x v w |
| 193 | rw [hG s, hG t] |
| 194 | |
| 195 | end PoincareMT.RicciFlow |