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.Surgery.StandardCap.Existence.Construction.Coordinates.TerminalClosedCoefficients |
| 2 | import PoincareLib.Geometry.RicciFlow.Surgery.StandardCap.Existence.Geometry.Flow.FlowLocality |
| 3 | import PoincareLib.Geometry.RicciFlow.Surgery.StandardCap.Existence.Geometry.Curvature.RicciOperatorEvaluation |
| 4 | import PoincareLib.Geometry.RicciFlow.MetricFamily.Coordinates |
| 5 | |
| 6 | /-! |
| 7 | # The actual Ricci flow including its terminal slice |
| 8 | |
| 9 | The closed family keeps the old metric and connection records at every |
| 10 | earlier time, and uses the complete terminal metric at the endpoint. |
| 11 | The coefficient regularity and equation give a genuine Ricci flow on |
| 12 | the whole closed slab. This is the bounded-curvature terminal extension |
| 13 | in Morgan-Tian Theorem 12.5, pp. 296-297, not yet a forward restart. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | set_option backward.isDefEq.respectTransparency false |
| 18 | -- Actual coefficient derivatives have nested continuous-linear-map targets. |
| 19 | set_option maxSynthPendingDepth 8 |
| 20 | |
| 21 | open Set Filter |
| 22 | open scoped Manifold ContDiff Topology |
| 23 | |
| 24 | namespace PoincareMT.M34.PartialFlowTerminalJets |
| 25 | |
| 26 | open SpacetimeBounds SpacetimeBounds.Bootstrap |
| 27 | |
| 28 | variable {g0 : StandardInitialMetric} {F : PartialStandardCapFlow g0} {S : ℝ} |
| 29 | (L : PartialFlowTerminalJets F S) (P : RicciFlowCurvatureTheory.{0}) |
| 30 | (E0 : StandardCapEstimate g0) {B : ℝ} (hS : 0 < S) (hSF : S ≤ F.lifetime) (hB : 0 < B) |
| 31 | (hfull : ∀ t ∈ Ico 0 S, ∀ x : StandardCapSpace, |
| 32 | (F.flow.connection t).curvatureTensorNorm x ≤ B) |
| 33 | |
| 34 | /-- The closed metric/connection pair keeps the exact old dependent |
| 35 | records before the terminal slice (Theorem 12.5, pp. 296-297). -/ |
| 36 | noncomputable def closedMetricConnection (t : ℝ) : |
| 37 | Σ g : RiemannianMetric 3 StandardCapSpace, LeviCivitaData g := |
| 38 | if t < S then ⟨F.flow.metric t, F.flow.connection t⟩ else |
| 39 | let g := L.metric P E0 hS hSF hB hfull |
| 40 | ⟨g, g.euclideanLeviCivitaData⟩ |
| 41 | |
| 42 | /-- The actual terminally closed metric family (Theorem 12.5, pp. 296-297). -/ |
| 43 | noncomputable def closedMetric (t : ℝ) : RiemannianMetric 3 StandardCapSpace := |
| 44 | (L.closedMetricConnection P E0 hS hSF hB hfull t).1 |
| 45 | |
| 46 | /-- Its retained compatible connection family (Theorem 12.5, pp. 296-297). -/ |
| 47 | noncomputable def closedConnection (t : ℝ) : |
| 48 | LeviCivitaData (L.closedMetric P E0 hS hSF hB hfull t) := |
| 49 | (L.closedMetricConnection P E0 hS hSF hB hfull t).2 |
| 50 | |
| 51 | /-- Before the terminal time the whole metric/connection sigma pair is |
| 52 | literally the old pair (Theorem 12.5, pp. 296-297). -/ |
| 53 | theorem closedMetricConnection_of_lt {t : ℝ} (ht : t < S) : |
| 54 | L.closedMetricConnection P E0 hS hSF hB hfull t = |
| 55 | ⟨F.flow.metric t, F.flow.connection t⟩ := by |
| 56 | simp only [closedMetricConnection, ht, if_true] |
| 57 | |
| 58 | /-- Earlier metric records are retained exactly (Theorem 12.5, pp. 296-297). -/ |
| 59 | theorem closedMetric_of_lt {t : ℝ} (ht : t < S) : |
| 60 | L.closedMetric P E0 hS hSF hB hfull t = F.flow.metric t := by |
| 61 | simp only [closedMetric, L.closedMetricConnection_of_lt P E0 hS hSF hB hfull ht] |
| 62 | |
| 63 | /-- At the endpoint the family uses the actual constructed terminal |
| 64 | metric (Theorem 12.5, pp. 296-297). -/ |
| 65 | theorem closedMetric_terminal : |
| 66 | L.closedMetric P E0 hS hSF hB hfull S = L.metric P E0 hS hSF hB hfull := by |
| 67 | simp only [closedMetric, closedMetricConnection, lt_self_iff_false, if_false] |
| 68 | |
| 69 | /-- Every total time slice has exactly the closed coefficient field |
| 70 | (Theorem 12.5, pp. 296-297). -/ |
| 71 | theorem closedMetric_coefficients (t : ℝ) : |
| 72 | (L.closedMetric P E0 hS hSF hB hfull t).euclideanCoefficients = |
| 73 | fun x => L.closedCoefficients (t, x) := by |
| 74 | by_cases ht : t < S |
| 75 | · rw [L.closedMetric_of_lt P E0 hS hSF hB hfull ht] |
| 76 | funext x |
| 77 | exact (L.closedCoefficients_of_lt ht x).symm |
| 78 | · simp only [closedMetric, closedMetricConnection, ht, if_false] |
| 79 | rw [L.metric_coefficients] |
| 80 | funext x |
| 81 | exact (L.closedCoefficients_of_le (not_lt.mp ht) x).symm |
| 82 | |
| 83 | /-- The actual metric section is jointly smooth on the entire closed |
| 84 | time slab (Theorem 12.5, pp. 296-297). -/ |
| 85 | theorem closedMetric_smooth : |
| 86 | RiemannianMetric.IsSmoothFamilyOn (L.closedMetric P E0 hS hSF hB hfull) (Icc 0 S) := by |
| 87 | apply RiemannianMetric.isSmoothFamilyOn_of_constant_chart (fun _ _ => rfl) |
| 88 | (L.closedMetric P E0 hS hSF hB hfull) L.closedCoefficients |
| 89 | · have hmap : ContMDiff (𝓘(ℝ, ℝ).prod (𝓡 3)) 𝓘(ℝ, ℝ × StandardCapSpace) ∞ |
| 90 | (fun p : ℝ × StandardCapSpace => (p.1, p.2)) := |
| 91 | contMDiff_fst.prodMk_space contMDiff_snd |
| 92 | exact (L.contDiffOn_closedCoefficients P E0 hS hSF hB hfull).contMDiffOn.comp |
| 93 | hmap.contMDiffOn (fun _ hp => hp) |
| 94 | · intro t _ht x u v |
| 95 | exact congrArg (fun A => A x u v) (L.closedMetric_coefficients P E0 hS hSF hB hfull t) |
| 96 | |
| 97 | set_option synthInstance.maxHeartbeats 100000 in |
| 98 | -- The coefficient operator is evaluated on the actual retained connection. |
| 99 | /-- The geometric Ricci equation holds on the positive slab including |
| 100 | its terminal endpoint (Theorem 12.5, pp. 296-297). -/ |
| 101 | theorem closedMetric_equation_Ioc {t : ℝ} (ht : t ∈ Ioc 0 S) (x u v : StandardCapSpace) : |
| 102 | HasDerivWithinAt (fun s => (L.closedMetric P E0 hS hSF hB hfull s).inner x u v) |
| 103 | (-2 * (L.closedConnection P E0 hS hSF hB hfull t).ricci x u v) (Ioc 0 S) t := by |
| 104 | have h := ((L.hasDerivWithinAt_closedCoefficients_Ioc P E0 hS hSF hB hfull ht x).clm_apply |
| 105 | (hasDerivWithinAt_const t (Ioc 0 S) u)).clm_apply |
| 106 | (hasDerivWithinAt_const t (Ioc 0 S) v) |
| 107 | have hop : jetRicciFlowOperator 3 (spatialJet 2 L.closedCoefficients (t, x)) u v = |
| 108 | -2 * (L.closedConnection P E0 hS hSF hB hfull t).ricci x u v := by |
| 109 | rw [jetRicciFlowOperator, Function.comp_apply, twoJetProjection_spatialJet, |
| 110 | ← L.closedMetric_coefficients P E0 hS hSF hB hfull t] |
| 111 | exact ricciFlowOperator_metricTwoJet_apply |
| 112 | (L.closedConnection P E0 hS hSF hB hfull t) x u v |
| 113 | have hfunction : (fun s => (L.closedMetric P E0 hS hSF hB hfull s).inner x u v) = |
| 114 | (fun s => L.closedCoefficients (s, x) u v) := |
| 115 | funext (fun s => congrArg (fun A => A x u v) |
| 116 | (L.closedMetric_coefficients P E0 hS hSF hB hfull s)) |
| 117 | rw [hfunction] |
| 118 | simpa only [map_zero, add_zero, zero_add, hop] using h |
| 119 | |
| 120 | /-- Locality retains the original initial equation and the new terminal |
| 121 | equation on one closed slab (Theorem 12.5, pp. 296-297). -/ |
| 122 | theorem closedMetric_equation {t : ℝ} (ht : t ∈ Icc 0 S) (x u v : StandardCapSpace) : |
| 123 | HasDerivWithinAt (fun s => (L.closedMetric P E0 hS hSF hB hfull s).inner x u v) |
| 124 | (-2 * (L.closedConnection P E0 hS hSF hB hfull t).ricci x u v) (Icc 0 S) t := by |
| 125 | by_cases hlt : t < S |
| 126 | · have hnear : Iio S ∈ 𝓝[Icc 0 S] t := mem_nhdsWithin_of_mem_nhds (Iio_mem_nhds hlt) |
| 127 | have hdom : Ico 0 F.lifetime ∈ 𝓝[Icc 0 S] t := by |
| 128 | filter_upwards [self_mem_nhdsWithin, hnear] with s hs hsS |
| 129 | exact ⟨hs.1, hsS.trans_le hSF⟩ |
| 130 | rw [ricci_eq_of_metric_eq (L.closedMetric_of_lt P E0 hS hSF hB hfull hlt) |
| 131 | (L.closedConnection P E0 hS hSF hB hfull t) (F.flow.connection t)] |
| 132 | have hd := (F.flow.equation t ⟨ht.1, hlt.trans_le hSF⟩ x u v).mono_of_mem_nhdsWithin hdom |
| 133 | apply hd.congr_of_eventuallyEq_of_mem _ ht |
| 134 | filter_upwards [hnear] with s hs |
| 135 | rw [L.closedMetric_of_lt P E0 hS hSF hB hfull hs] |
| 136 | · have hpos : 0 < t := hS.trans_le (not_lt.mp hlt) |
| 137 | have hnear : Ioi 0 ∈ 𝓝[Icc 0 S] t := mem_nhdsWithin_of_mem_nhds (Ioi_mem_nhds hpos) |
| 138 | have hdom : Ioc 0 S ∈ 𝓝[Icc 0 S] t := by |
| 139 | filter_upwards [self_mem_nhdsWithin, hnear] with s hs hspos |
| 140 | exact ⟨hspos, hs.2⟩ |
| 141 | have hd := L.closedMetric_equation_Ioc P E0 hS hSF hB hfull ⟨hpos, ht.2⟩ x u v |
| 142 | exact hd.mono_of_mem_nhdsWithin hdom |
| 143 | |
| 144 | /-- A bounded-curvature partial flow extends to an actual Ricci flow on |
| 145 | the closed terminal slab (Theorem 12.5, pp. 296-297). -/ |
| 146 | noncomputable def closedFlow : RicciFlow 3 StandardCapSpace (Icc 0 S) where |
| 147 | metric := L.closedMetric P E0 hS hSF hB hfull |
| 148 | connection := L.closedConnection P E0 hS hSF hB hfull |
| 149 | interval := ordConnected_Icc |
| 150 | nontrivial := ⟨0, ⟨le_rfl, hS.le⟩, S, ⟨hS.le, le_rfl⟩, hS.ne⟩ |
| 151 | smooth := L.closedMetric_smooth P E0 hS hSF hB hfull |
| 152 | equation t ht x u v := L.closedMetric_equation P E0 hS hSF hB hfull (t := t) ht x u v |
| 153 | |
| 154 | /-- Every included slice of the terminally closed flow is complete for |
| 155 | its actual Riemannian path distance (Theorem 12.5, pp. 296-297). -/ |
| 156 | theorem closedFlow_complete {t : ℝ} (ht : t ∈ Icc 0 S) : |
| 157 | MetricComplete ((L.closedFlow P E0 hS hSF hB hfull).metric t) := by |
| 158 | change MetricComplete (L.closedMetric P E0 hS hSF hB hfull t) |
| 159 | rcases ht.2.eq_or_lt with heq | hlt |
| 160 | · subst t |
| 161 | rw [L.closedMetric_terminal] |
| 162 | exact L.metric_complete P E0 hS hSF hB hfull |
| 163 | · rw [L.closedMetric_of_lt P E0 hS hSF hB hfull hlt] |
| 164 | exact partialFlow_complete F P ⟨ht.1, hlt.trans_le hSF⟩ |
| 165 | |
| 166 | end PoincareMT.M34.PartialFlowTerminalJets |