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 PoincareLib.Geometry.RicciFlow.Compactness.Carrier |
| 3 | import Mathlib.Analysis.Calculus.ContDiff.Defs |
| 4 | import Mathlib.MeasureTheory.Measure.Hausdorff |
| 5 | import Mathlib.Geometry.Manifold.Riemannian.Basic |
| 6 | |
| 7 | /-! |
| 8 | # Pointed flows on varying carriers |
| 9 | |
| 10 | The interfaces keep the carriers of a sequence explicit. A `FlowCarrier` |
| 11 | packages the topological and smooth structures needed by the |
| 12 | fixed-carrier Ricci-flow definition, while `BasedFlow` adds the time-zero base |
| 13 | point. The compactness statement carries a volume measure with each based |
| 14 | flow and requires it to agree with the n-dimensional Hausdorff measure of the |
| 15 | selected time-zero metric. This makes the source volume convention explicit. |
| 16 | |
| 17 | The declarations are ported from the reviewed snapshot in |
| 18 | `contracts/definitions/ricci-flow/PointedRicciFlowCompactness.lean`, from |
| 19 | Mapher06/Poincare-MorganTian at `b2c3c64781fee22edfd683a224d4f8d280e2e9ce`. |
| 20 | The carrier declarations are in `Compactness.Carrier`; mathematical definitions |
| 21 | and declaration names are unchanged. |
| 22 | -/ |
| 23 | |
| 24 | set_option autoImplicit false |
| 25 | |
| 26 | open scoped Manifold ContDiff Bundle ENNReal Topology |
| 27 | |
| 28 | universe u |
| 29 | |
| 30 | namespace PoincareMT |
| 31 | |
| 32 | /-- The order-`r` derivative seminorm of a scalar coordinate coefficient. -/ |
| 33 | noncomputable def MetricJet {α : Type*} [NormedAddCommGroup α] [NormedSpace ℝ α] |
| 34 | (r : ℕ) (f : α → ℝ) (_s : Set α) (x : α) := |
| 35 | iteratedFDeriv ℝ r f x |
| 36 | |
| 37 | abbrev FlowCarrier.metric {n : ℕ} (C : FlowCarrier n) := |
| 38 | @RiemannianMetric n C.carrier C.topologicalSpace C.chartedSpace C.isManifold |
| 39 | |
| 40 | /-- A based Ricci flow on one carrier, with its time-zero basepoint. -/ |
| 41 | structure BasedFlow (n : ℕ) (T' T : ℝ) (C : FlowCarrier n) where |
| 42 | base : C.carrier |
| 43 | flow : @RicciFlow n C.carrier C.topologicalSpace C.chartedSpace C.isManifold |
| 44 | (Set.Ioo T' T) |
| 45 | volumeMeasure : @MeasureTheory.Measure C.carrier C.measurableSpace |
| 46 | /-- The spacetime vector field in the ordinary product-flow specialization. |
| 47 | The next field forces its spatial part to vanish, so this is the canonical |
| 48 | increasing-time vector field and the stored RicciFlow equation is exactly |
| 49 | the generalized equation in product coordinates. -/ |
| 50 | spacetimeVectorField : ∀ _t : ℝ, ∀ x : C.carrier, ℝ × C.tangent x |
| 51 | spacetimeVectorField_time : |
| 52 | ∀ t x, (spacetimeVectorField t x).1 = 1 |
| 53 | spacetimeVectorField_spatial_zero : |
| 54 | ∀ t x, (spacetimeVectorField t x).2 = 0 |
| 55 | |
| 56 | namespace FlowCarrier |
| 57 | |
| 58 | noncomputable def coordinateCoefficient {n : ℕ} (C : FlowCarrier n) (q : C.carrier) |
| 59 | (B : ∀ _t : ℝ, ∀ x : C.carrier, C.tangent x → C.tangent x → ℝ) |
| 60 | (a b : Fin n) (p : ℝ × EuclideanSpace ℝ (Fin n)) : ℝ := |
| 61 | letI : TopologicalSpace C.carrier := C.topologicalSpace |
| 62 | letI : ChartedSpace (EuclideanSpace ℝ (Fin n)) C.carrier := C.chartedSpace |
| 63 | letI : IsManifold (𝓡 n) ∞ C.carrier := C.isManifold |
| 64 | let c := extChartAt (𝓡 n) q |
| 65 | let A := mfderiv (𝓡 n) (𝓡 n) c.symm p.2 |
| 66 | B p.1 (c.symm p.2) |
| 67 | (A (EuclideanSpace.basisFun (Fin n) ℝ a)) |
| 68 | (A (EuclideanSpace.basisFun (Fin n) ℝ b)) |
| 69 | |
| 70 | /-- The metric ball used by the zero-time slice of a based flow. -/ |
| 71 | def metricBall {n : ℕ} (C : FlowCarrier n) (g : C.metric) (x : C.carrier) |
| 72 | (r : ℝ) : Set C.carrier := |
| 73 | letI : TopologicalSpace C.carrier := C.topologicalSpace |
| 74 | letI : ChartedSpace (EuclideanSpace ℝ (Fin n)) C.carrier := C.chartedSpace |
| 75 | letI : IsManifold (𝓡 n) ∞ C.carrier := C.isManifold |
| 76 | RiemannianMetric.ball g x r |
| 77 | |
| 78 | noncomputable def metricInner {n : ℕ} (C : FlowCarrier n) (g : C.metric) (x : C.carrier) |
| 79 | (v w : C.tangent x) : ℝ := |
| 80 | letI : TopologicalSpace C.carrier := C.topologicalSpace |
| 81 | letI : ChartedSpace (EuclideanSpace ℝ (Fin n)) C.carrier := C.chartedSpace |
| 82 | letI : IsManifold (𝓡 n) ∞ C.carrier := C.isManifold |
| 83 | g.inner x v w |
| 84 | |
| 85 | noncomputable def metricNorm {n : ℕ} (C : FlowCarrier n) (g : C.metric) (x : C.carrier) |
| 86 | (v : C.tangent x) : ℝ := |
| 87 | Real.sqrt (C.metricInner g x v v) |
| 88 | |
| 89 | /-- The Hausdorff n-measure of a selected Riemannian metric. -/ |
| 90 | noncomputable def metricHausdorffVolume {n : ℕ} (C : FlowCarrier n) (g : C.metric) : |
| 91 | @MeasureTheory.Measure C.carrier C.measurableSpace := |
| 92 | letI : TopologicalSpace C.carrier := C.topologicalSpace |
| 93 | letI : MeasurableSpace C.carrier := C.measurableSpace |
| 94 | letI : BorelSpace C.carrier := C.borelSpace |
| 95 | letI : ChartedSpace (EuclideanSpace ℝ (Fin n)) C.carrier := C.chartedSpace |
| 96 | letI : IsManifold (𝓡 n) ∞ C.carrier := C.isManifold |
| 97 | letI : T3Space C.carrier := C.t3Space |
| 98 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : C.carrier → Type _) := |
| 99 | ⟨g.toRiemannianMetric⟩ |
| 100 | letI : IsContinuousRiemannianBundle (EuclideanSpace ℝ (Fin n)) |
| 101 | (TangentSpace (𝓡 n) : C.carrier → Type _) := |
| 102 | ⟨⟨g.inner, g.toContinuousRiemannianMetric.continuous, fun _ _ _ ↦ rfl⟩⟩ |
| 103 | letI : EMetricSpace C.carrier := EMetricSpace.ofRiemannianMetric (𝓡 n) C.carrier |
| 104 | MeasureTheory.Measure.hausdorffMeasure (n : ℝ) |
| 105 | |
| 106 | /- The extended metric induced by a slice, exposed as a value so that |
| 107 | completeness-transfer lemmas can quantify over a family of slices. -/ |
| 108 | noncomputable def metricEMetricSpace {n : ℕ} (C : FlowCarrier n) (g : C.metric) : |
| 109 | EMetricSpace C.carrier := |
| 110 | letI : TopologicalSpace C.carrier := C.topologicalSpace |
| 111 | letI : ChartedSpace (EuclideanSpace ℝ (Fin n)) C.carrier := C.chartedSpace |
| 112 | letI : IsManifold (𝓡 n) ∞ C.carrier := C.isManifold |
| 113 | letI : T3Space C.carrier := C.t3Space |
| 114 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : C.carrier → Type _) := |
| 115 | ⟨g.toRiemannianMetric⟩ |
| 116 | letI : IsContinuousRiemannianBundle (EuclideanSpace ℝ (Fin n)) |
| 117 | (TangentSpace (𝓡 n) : C.carrier → Type _) := |
| 118 | ⟨⟨g.inner, g.toContinuousRiemannianMetric.continuous, fun _ _ _ ↦ rfl⟩⟩ |
| 119 | EMetricSpace.ofRiemannianMetric (𝓡 n) C.carrier |
| 120 | |
| 121 | theorem preconnected_metricEMetricSpace {n : ℕ} (C : FlowCarrier n) (g : C.metric) : |
| 122 | @PreconnectedSpace C.carrier |
| 123 | (C.metricEMetricSpace g).toUniformSpace.toTopologicalSpace := by |
| 124 | letI : TopologicalSpace C.carrier := C.topologicalSpace |
| 125 | letI : ChartedSpace (EuclideanSpace ℝ (Fin n)) C.carrier := C.chartedSpace |
| 126 | letI : IsManifold (𝓡 n) ∞ C.carrier := C.isManifold |
| 127 | letI : T3Space C.carrier := C.t3Space |
| 128 | letI : EMetricSpace C.carrier := C.metricEMetricSpace g |
| 129 | change @PreconnectedSpace C.carrier C.topologicalSpace |
| 130 | exact ⟨C.connected.isPreconnected⟩ |
| 131 | |
| 132 | /-- Completeness of the induced extended metric for a selected slice. -/ |
| 133 | def metricComplete {n : ℕ} (C : FlowCarrier n) (g : C.metric) : Prop := |
| 134 | letI : TopologicalSpace C.carrier := C.topologicalSpace |
| 135 | letI : ChartedSpace (EuclideanSpace ℝ (Fin n)) C.carrier := C.chartedSpace |
| 136 | letI : IsManifold (𝓡 n) ∞ C.carrier := C.isManifold |
| 137 | letI : T3Space C.carrier := C.t3Space |
| 138 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : C.carrier → Type _) := |
| 139 | ⟨g.toRiemannianMetric⟩ |
| 140 | letI : IsContinuousRiemannianBundle (EuclideanSpace ℝ (Fin n)) |
| 141 | (TangentSpace (𝓡 n) : C.carrier → Type _) := |
| 142 | ⟨⟨g.inner, g.toContinuousRiemannianMetric.continuous, fun _ _ _ ↦ rfl⟩⟩ |
| 143 | letI : EMetricSpace C.carrier := EMetricSpace.ofRiemannianMetric (𝓡 n) C.carrier |
| 144 | CompleteSpace C.carrier |
| 145 | |
| 146 | end FlowCarrier |
| 147 | |
| 148 | namespace BasedFlow |
| 149 | |
| 150 | def volumeCompatible {n : ℕ} {T' T : ℝ} {C : FlowCarrier n} |
| 151 | (F : BasedFlow n T' T C) : Prop := |
| 152 | letI : TopologicalSpace C.carrier := C.topologicalSpace |
| 153 | letI : ChartedSpace (EuclideanSpace ℝ (Fin n)) C.carrier := C.chartedSpace |
| 154 | letI : IsManifold (𝓡 n) ∞ C.carrier := C.isManifold |
| 155 | F.volumeMeasure = C.metricHausdorffVolume (F.flow.metric 0) |
| 156 | |
| 157 | def zeroBall {n : ℕ} {T' T : ℝ} {C : FlowCarrier n} |
| 158 | (F : BasedFlow n T' T C) (r : ℝ) : Set C.carrier := |
| 159 | letI : TopologicalSpace C.carrier := C.topologicalSpace |
| 160 | letI : ChartedSpace (EuclideanSpace ℝ (Fin n)) C.carrier := C.chartedSpace |
| 161 | letI : IsManifold (𝓡 n) ∞ C.carrier := C.isManifold |
| 162 | C.metricBall (F.flow.metric 0) F.base r |
| 163 | |
| 164 | def ballAt {n : ℕ} {T' T : ℝ} {C : FlowCarrier n} |
| 165 | (F : BasedFlow n T' T C) (t r : ℝ) : Set C.carrier := |
| 166 | letI : TopologicalSpace C.carrier := C.topologicalSpace |
| 167 | letI : ChartedSpace (EuclideanSpace ℝ (Fin n)) C.carrier := C.chartedSpace |
| 168 | letI : IsManifold (𝓡 n) ∞ C.carrier := C.isManifold |
| 169 | C.metricBall (F.flow.metric t) F.base r |
| 170 | |
| 171 | noncomputable def zeroBallVolume {n : ℕ} {T' T : ℝ} {C : FlowCarrier n} |
| 172 | (F : BasedFlow n T' T C) (r : ℝ) : ℝ≥0∞ := |
| 173 | F.volumeMeasure (F.zeroBall r) |
| 174 | |
| 175 | end BasedFlow |
| 176 | |
| 177 | /-- A smooth, time-preserving embedding between possibly different carriers. -/ |
| 178 | structure SmoothSpacetimeEmbedding {n : ℕ} {T' T : ℝ} |
| 179 | {C D : FlowCarrier n} (F : BasedFlow n T' T C) (G : BasedFlow n T' T D) |
| 180 | (domain : Set (ℝ × C.carrier)) where |
| 181 | toFun : ℝ × C.carrier → ℝ × D.carrier |
| 182 | time_preserving : ∀ t x, (toFun (t, x)).1 = t |
| 183 | injective_on : Set.InjOn toFun domain |
| 184 | inverse : ℝ × D.carrier → ℝ × C.carrier |
| 185 | left_inverse : ∀ p ∈ domain, inverse (toFun p) = p |
| 186 | right_inverse : ∀ q ∈ toFun '' domain, toFun (inverse q) = q |
| 187 | smooth_on : |
| 188 | letI : TopologicalSpace C.carrier := C.topologicalSpace |
| 189 | letI : ChartedSpace (EuclideanSpace ℝ (Fin n)) C.carrier := C.chartedSpace |
| 190 | letI : IsManifold (𝓡 n) ∞ C.carrier := C.isManifold |
| 191 | letI : TopologicalSpace D.carrier := D.topologicalSpace |
| 192 | letI : ChartedSpace (EuclideanSpace ℝ (Fin n)) D.carrier := D.chartedSpace |
| 193 | letI : IsManifold (𝓡 n) ∞ D.carrier := D.isManifold |
| 194 | ContMDiffOn (𝓘(ℝ, ℝ).prod (𝓡 n)) (𝓘(ℝ, ℝ).prod (𝓡 n)) ∞ |
| 195 | toFun domain |
| 196 | smooth_inverse_on : |
| 197 | letI : TopologicalSpace C.carrier := C.topologicalSpace |
| 198 | letI : ChartedSpace (EuclideanSpace ℝ (Fin n)) C.carrier := C.chartedSpace |
| 199 | letI : IsManifold (𝓡 n) ∞ C.carrier := C.isManifold |
| 200 | letI : TopologicalSpace D.carrier := D.topologicalSpace |
| 201 | letI : ChartedSpace (EuclideanSpace ℝ (Fin n)) D.carrier := D.chartedSpace |
| 202 | letI : IsManifold (𝓡 n) ∞ D.carrier := D.isManifold |
| 203 | ContMDiffOn (𝓘(ℝ, ℝ).prod (𝓡 n)) (𝓘(ℝ, ℝ).prod (𝓡 n)) ∞ |
| 204 | inverse (toFun '' domain) |
| 205 | vector_field_compatible : |
| 206 | letI : TopologicalSpace C.carrier := C.topologicalSpace |
| 207 | letI : ChartedSpace (EuclideanSpace ℝ (Fin n)) C.carrier := C.chartedSpace |
| 208 | letI : IsManifold (𝓡 n) ∞ C.carrier := C.isManifold |
| 209 | letI : TopologicalSpace D.carrier := D.topologicalSpace |
| 210 | letI : ChartedSpace (EuclideanSpace ℝ (Fin n)) D.carrier := D.chartedSpace |
| 211 | let ψ : ∀ _t : ℝ, C.carrier → D.carrier := fun t x ↦ (toFun (t, x)).2 |
| 212 | ∀ t x, |
| 213 | (mfderiv (𝓘(ℝ, ℝ)) (𝓡 n) (fun s ↦ (toFun (s, x)).2) t 1 + |
| 214 | mfderiv (𝓡 n) (𝓡 n) (ψ t) x (F.spacetimeVectorField t x).2) = |
| 215 | (G.spacetimeVectorField t (ψ t x)).2 |
| 216 | |
| 217 | /-- A smooth, time-preserving embedding of a zero-time ball through an interval. -/ |
| 218 | abbrev SpacetimeEmbedding {n : ℕ} {T' T : ℝ} |
| 219 | {C D : FlowCarrier n} (F : BasedFlow n T' T C) (G : BasedFlow n T' T D) |
| 220 | (A : ℝ) (I : Set ℝ) := |
| 221 | SmoothSpacetimeEmbedding F G (I ×ˢ F.zeroBall A) |
| 222 | |
| 223 | noncomputable def BasedFlow.metricAt {n : ℕ} {T' T : ℝ} {C : FlowCarrier n} |
| 224 | (F : BasedFlow n T' T C) (t : ℝ) : C.metric := |
| 225 | letI : TopologicalSpace C.carrier := C.topologicalSpace |
| 226 | letI : ChartedSpace (EuclideanSpace ℝ (Fin n)) C.carrier := C.chartedSpace |
| 227 | letI : IsManifold (𝓡 n) ∞ C.carrier := C.isManifold |
| 228 | F.flow.metric t |
| 229 | |
| 230 | /-- Uniform curvature control on the image domain of a spacetime embedding. -/ |
| 231 | def CurvatureBoundOn {n : ℕ} {T' T : ℝ} {C : FlowCarrier n} |
| 232 | {D : FlowCarrier n} (F : BasedFlow n T' T C) (G : BasedFlow n T' T D) |
| 233 | (A : ℝ) (I : Set ℝ) (e : SpacetimeEmbedding F G A I) (K : ℝ) : Prop := |
| 234 | letI : TopologicalSpace C.carrier := C.topologicalSpace |
| 235 | letI : ChartedSpace (EuclideanSpace ℝ (Fin n)) C.carrier := C.chartedSpace |
| 236 | letI : IsManifold (𝓡 n) ∞ C.carrier := C.isManifold |
| 237 | letI : TopologicalSpace D.carrier := D.topologicalSpace |
| 238 | letI : ChartedSpace (EuclideanSpace ℝ (Fin n)) D.carrier := D.chartedSpace |
| 239 | letI : IsManifold (𝓡 n) ∞ D.carrier := D.isManifold |
| 240 | 0 ≤ K ∧ ∀ t ∈ I, ∀ x ∈ F.zeroBall A, |
| 241 | (G.flow.connection t).curvatureTensorNorm ((e.toFun (t, x)).2) ≤ K |
| 242 | |
| 243 | end PoincareMT |