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.Harnack.Noncompact.CurvatureControl.Distance.Continuity |
| 2 | import PoincareLib.Geometry.Riemannian.Compactness.IntrinsicMetric |
| 3 | |
| 4 | /-! # Distance continuity along two moving endpoints -/ |
| 5 | |
| 6 | set_option autoImplicit false |
| 7 | set_option backward.isDefEq.respectTransparency false |
| 8 | |
| 9 | open Set Filter |
| 10 | open scoped Manifold ContDiff Bundle Topology |
| 11 | |
| 12 | universe u |
| 13 | |
| 14 | namespace PoincareMT.RicciFlow |
| 15 | |
| 16 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] [T3Space M] [PreconnectedSpace M] |
| 17 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 18 | {J : Set ℝ} |
| 19 | |
| 20 | theorem continuousOn_backward_moving_distance |
| 21 | (F : RicciFlow n M J) {a b : ℝ} |
| 22 | (hJ : Icc (-b) (-a) ⊆ interior J) |
| 23 | (hcomplete : MetricComplete (F.metric (-a))) |
| 24 | (hRic : ∀ t ∈ Icc (-b) (-a), ∀ x : M, ∀ v : TangentSpace (𝓡 n) x, |
| 25 | 0 ≤ (F.connection t).ricci x v v) |
| 26 | {γ η : ℝ → M} (hγ : ContinuousOn γ (Icc a b)) (hη : ContinuousOn η (Icc a b)) : |
| 27 | ContinuousOn (fun t => ((F.metric (-t)).edist (γ t) (η t)).toReal) (Icc a b) := by |
| 28 | intro t ht |
| 29 | have hfixed := F.continuousOn_toReal_edist_of_ricci_nonneg_intrinsic hJ hcomplete hRic (γ t) |
| 30 | have hbase : ContinuousOn (fun s => ((F.metric (-s)).edist (γ t) (η s)).toReal) |
| 31 | (Icc a b) := |
| 32 | hfixed.comp (continuous_neg.continuousOn.prodMk hη) |
| 33 | (fun s hs => ⟨⟨neg_le_neg hs.2, neg_le_neg hs.1⟩, mem_univ _⟩) |
| 34 | have herr : ContinuousOn (fun s => ((F.metric (-s)).edist (γ t) (γ s)).toReal) |
| 35 | (Icc a b) := |
| 36 | hfixed.comp (continuous_neg.continuousOn.prodMk hγ) |
| 37 | (fun s hs => ⟨⟨neg_le_neg hs.2, neg_le_neg hs.1⟩, mem_univ _⟩) |
| 38 | have hzero : ((F.metric (-t)).edist (γ t) (γ t)).toReal = 0 := by |
| 39 | let := (F.metric (-t)).toMetricSpace |
| 40 | exact dist_self (γ t) |
| 41 | have hlower := (hbase t ht).sub (herr t ht) |
| 42 | have hupper := (hbase t ht).add (herr t ht) |
| 43 | simp only [ContinuousWithinAt, Pi.sub_apply, hzero, sub_zero] at hlower |
| 44 | simp only [ContinuousWithinAt, Pi.add_apply, hzero, add_zero] at hupper |
| 45 | apply tendsto_of_tendsto_of_tendsto_of_le_of_le' hlower hupper |
| 46 | · exact Eventually.of_forall (fun s => by |
| 47 | let := (F.metric (-s)).toMetricSpace |
| 48 | change dist (γ t) (η s) - dist (γ t) (γ s) ≤ dist (γ s) (η s) |
| 49 | linarith [dist_triangle (γ t) (γ s) (η s)]) |
| 50 | · exact Eventually.of_forall (fun s => by |
| 51 | let := (F.metric (-s)).toMetricSpace |
| 52 | change dist (γ s) (η s) ≤ dist (γ t) (η s) + dist (γ t) (γ s) |
| 53 | have h := dist_triangle (γ s) (γ t) (η s) |
| 54 | rw [dist_comm (γ s) (γ t)] at h |
| 55 | linarith) |
| 56 | |
| 57 | end PoincareMT.RicciFlow |