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.AncientKappa.Compactness.Boundedness.Distance |
| 2 | import PoincareLib.Geometry.RicciFlow.Harnack.Noncompact.AncientVolume.Splitting.BufferedSegments |
| 3 | |
| 4 | /-! |
| 5 | # Buffered opposite segments for closed ancient source flows |
| 6 | |
| 7 | The closed-endpoint additive distortion estimate preserves diverging |
| 8 | endpoint lengths and asymptotically opposite comparison angles. Earlier |
| 9 | minimizing segments are constructed by completeness on that same source. |
| 10 | |
| 11 | Reference: Kleiner--Lott, Theorem 46.1, pp. 2687-2688, and Appendix G, |
| 12 | p. 2852. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | set_option backward.isDefEq.respectTransparency false |
| 17 | set_option maxHeartbeats 800000 |
| 18 | |
| 19 | open Set Filter |
| 20 | open scoped Manifold ContDiff Bundle ENNReal Topology |
| 21 | |
| 22 | namespace PoincareMT.RicciFlow |
| 23 | |
| 24 | /-- Opposite terminal segments yield opposite earlier minimizing segments |
| 25 | on the same raw ancient flows, including their closed terminal endpoint. -/ |
| 26 | theorem exists_buffered_opposite_segments_on_closed_ancient_flows |
| 27 | {m : ℕ} {M : Type} [TopologicalSpace M] [T3Space M] [ConnectedSpace M] |
| 28 | [ChartedSpace (EuclideanSpace ℝ (Fin (m + 1))) M] [IsManifold (𝓡 (m + 1)) ∞ M] |
| 29 | (hm : 0 < m) (F : ℕ → RicciFlow (m + 1) M (Iic 0)) |
| 30 | {δ Λ scale : ℝ} (hδ : 0 < δ) (hΛ : 0 ≤ Λ) (hscale : 0 < scale) |
| 31 | (hc : ∀ i t, t ≤ 0 → MetricComplete ((F i).metric t)) |
| 32 | (hRic : ∀ i t, t ≤ 0 → ∀ x : M, ∀ v : TangentSpace (𝓡 (m + 1)) x, |
| 33 | 0 ≤ ((F i).connection t).ricci x v v) |
| 34 | (q : ℕ → M) (r L : ℕ → ℝ) (hr : ∀ i, 0 < r i) |
| 35 | (hmargin : ∀ i, 4 * Real.exp (Λ * δ) * r i ≤ L i) |
| 36 | (hupper : ∀ i t, t ∈ Icc (-δ) 0 → ∀ z ∈ ((F i).metric 0).ball (q i) (L i), |
| 37 | ∀ v : TangentSpace (𝓡 (m + 1)) z, |
| 38 | ((F i).connection t).ricci z v v ≤ Λ * ((F i).metric t).inner z v v) |
| 39 | (minus plus : ℕ → ℝ → M) (a b : ℕ → ℝ) |
| 40 | (ha : ∀ i, 0 < a i) (hb : ∀ i, 0 < b i) |
| 41 | (hminus0 : ∀ i, minus i 0 = q i) (hplus0 : ∀ i, plus i 0 = q i) |
| 42 | (hminus : ∀ i, ∀ s ∈ Icc (0 : ℝ) (a i), ∀ t ∈ Icc (0 : ℝ) (a i), |
| 43 | (((F i).metric 0).edist (minus i s) (minus i t)).toReal = |s - t|) |
| 44 | (hplus : ∀ i, ∀ s ∈ Icc (0 : ℝ) (b i), ∀ t ∈ Icc (0 : ℝ) (b i), |
| 45 | (((F i).metric 0).edist (plus i s) (plus i t)).toReal = |s - t|) |
| 46 | (hx : ∀ i, minus i (a i) ∈ ((F i).metric 0).ball (q i) (r i)) |
| 47 | (hy : ∀ i, plus i (b i) ∈ ((F i).metric 0).ball (q i) (r i)) |
| 48 | (haTop : Tendsto a atTop atTop) (hbTop : Tendsto b atTop atTop) |
| 49 | (hcos : Tendsto (fun i => |
| 50 | (a i ^ 2 + b i ^ 2 - |
| 51 | (((F i).metric 0).edist (minus i (a i)) (plus i (b i))).toReal ^ 2) / |
| 52 | (2 * a i * b i)) atTop (𝓝 (-1))) : |
| 53 | let A := fun i => (((F i).metric (-δ)).edist (q i) (minus i (a i))).toReal |
| 54 | let B := fun i => (((F i).metric (-δ)).edist (q i) (plus i (b i))).toReal |
| 55 | (∀ i, 0 < A i ∧ 0 < B i) ∧ |
| 56 | Tendsto A atTop atTop ∧ Tendsto B atTop atTop ∧ |
| 57 | Tendsto (fun i => |
| 58 | (A i ^ 2 + B i ^ 2 - |
| 59 | (((F i).metric (-δ)).edist (minus i (a i)) (plus i (b i))).toReal ^ 2) / |
| 60 | (2 * A i * B i)) atTop (𝓝 (-1)) ∧ |
| 61 | ∃ earlierMinus earlierPlus : ℕ → ℝ → M, |
| 62 | (∀ i, earlierMinus i 0 = q i ∧ earlierMinus i (A i) = minus i (a i) ∧ |
| 63 | earlierPlus i 0 = q i ∧ earlierPlus i (B i) = plus i (b i)) ∧ |
| 64 | (∀ i, ∀ s ∈ Icc (0 : ℝ) (A i), ∀ t ∈ Icc (0 : ℝ) (A i), |
| 65 | (((F i).metric (-δ)).edist (earlierMinus i s) (earlierMinus i t)).toReal = |s - t|) ∧ |
| 66 | (∀ i, ∀ s ∈ Icc (0 : ℝ) (B i), ∀ t ∈ Icc (0 : ℝ) (B i), |
| 67 | (((F i).metric (-δ)).edist (earlierPlus i s) (earlierPlus i t)).toReal = |s - t|) := by |
| 68 | let A := fun i => (((F i).metric (-δ)).edist (q i) (minus i (a i))).toReal |
| 69 | let B := fun i => (((F i).metric (-δ)).edist (q i) (plus i (b i))).toReal |
| 70 | let error := (4 * (((m + 1 : ℕ) : ℝ)) * scale + 8 * Λ / scale) * δ |
| 71 | have herror : 0 ≤ error := by dsimp [error]; positivity |
| 72 | have haminus (i : ℕ) : (((F i).metric 0).edist (q i) (minus i (a i))).toReal = a i := by |
| 73 | rw [← hminus0 i, hminus i 0 ⟨le_rfl, (ha i).le⟩ (a i) ⟨(ha i).le, le_rfl⟩, |
| 74 | zero_sub, abs_neg, abs_of_pos (ha i)] |
| 75 | have hbplus (i : ℕ) : (((F i).metric 0).edist (q i) (plus i (b i))).toReal = b i := by |
| 76 | rw [← hplus0 i, hplus i 0 ⟨le_rfl, (hb i).le⟩ (b i) ⟨(hb i).le, le_rfl⟩, |
| 77 | zero_sub, abs_neg, abs_of_pos (hb i)] |
| 78 | have hmonotone (i : ℕ) (x y : M) : |
| 79 | (((F i).metric 0).edist x y).toReal ≤ (((F i).metric (-δ)).edist x y).toReal := |
| 80 | (F i).terminal_distance_le_of_ancient_ricci_nonneg (hRic i) (by linarith) x y |
| 81 | have hadd (i : ℕ) (x y : M) |
| 82 | (hx' : x ∈ ((F i).metric 0).ball (q i) (r i)) |
| 83 | (hy' : y ∈ ((F i).metric 0).ball (q i) (r i)) : |
| 84 | (((F i).metric (-δ)).edist x y).toReal ≤ |
| 85 | (((F i).metric 0).edist x y).toReal + error := by |
| 86 | simpa only [sub_neg_eq_add, zero_add] using |
| 87 | (F i).toReal_edist_le_add_on_closed_terminal_ball hm (by linarith : -δ < 0) |
| 88 | (hc i) (hRic i) hΛ hscale (hr i) |
| 89 | (by simpa only [sub_neg_eq_add, zero_add] using hmargin i) |
| 90 | (q i) (hupper i) x y hx' hy' |
| 91 | have hqball (i : ℕ) : q i ∈ ((F i).metric 0).ball (q i) (r i) := by |
| 92 | simpa only [RiemannianMetric.ball, mem_ofPred_eq, RiemannianMetric.edist, |
| 93 | Manifold.riemannianEDist_self] using ENNReal.ofReal_pos.mpr (hr i) |
| 94 | have hA (i : ℕ) : a i ≤ A i ∧ A i ≤ a i + error := by |
| 95 | constructor |
| 96 | · simpa only [haminus] using hmonotone i (q i) (minus i (a i)) |
| 97 | · simpa only [haminus] using hadd i (q i) (minus i (a i)) (hqball i) (hx i) |
| 98 | have hB (i : ℕ) : b i ≤ B i ∧ B i ≤ b i + error := by |
| 99 | constructor |
| 100 | · simpa only [hbplus] using hmonotone i (q i) (plus i (b i)) |
| 101 | · simpa only [hbplus] using hadd i (q i) (plus i (b i)) (hqball i) (hy i) |
| 102 | have hAp (i : ℕ) : 0 < A i := (ha i).trans_le (hA i).1 |
| 103 | have hBp (i : ℕ) : 0 < B i := (hb i).trans_le (hB i).1 |
| 104 | have htriangle (g : RiemannianMetric (m + 1) M) (q x y : M) : |
| 105 | (g.edist x y).toReal ≤ (g.edist q x).toReal + (g.edist q y).toReal := by |
| 106 | let := g.toMetricSpace |
| 107 | change dist x y ≤ dist q x + dist q y |
| 108 | simpa only [dist_comm x q] using dist_triangle x q y |
| 109 | have hterminalTriangle (i : ℕ) : |
| 110 | (((F i).metric 0).edist (minus i (a i)) (plus i (b i))).toReal ≤ a i + b i := by |
| 111 | simpa only [haminus, hbplus] using |
| 112 | htriangle ((F i).metric 0) (q i) (minus i (a i)) (plus i (b i)) |
| 113 | have hnewcos := Poincare.AncientVolume.Splitting.tendsto_comparison_cosine_of_additive_bounds |
| 114 | herror ha hb (fun _ => ENNReal.toReal_nonneg) hterminalTriangle |
| 115 | haTop hbTop hcos hA hB (fun i => hmonotone i (minus i (a i)) (plus i (b i))) |
| 116 | (fun i => htriangle ((F i).metric (-δ)) (q i) (minus i (a i)) (plus i (b i))) |
| 117 | choose earlierMinus hm0 hmend hmmin using fun i => |
| 118 | ((F i).metric (-δ)).exists_unit_speed_minimizing_segment_of_metricComplete |
| 119 | (hc i (-δ) (by linarith)) (q i) (minus i (a i)) (hAp i) |
| 120 | choose earlierPlus hp0 hpend hpmin using fun i => |
| 121 | ((F i).metric (-δ)).exists_unit_speed_minimizing_segment_of_metricComplete |
| 122 | (hc i (-δ) (by linarith)) (q i) (plus i (b i)) (hBp i) |
| 123 | exact ⟨(fun i => ⟨hAp i, hBp i⟩), |
| 124 | tendsto_atTop_mono (fun i => (hA i).1) haTop, |
| 125 | tendsto_atTop_mono (fun i => (hB i).1) hbTop, hnewcos, |
| 126 | earlierMinus, earlierPlus, (fun i => ⟨hm0 i, hmend i, hp0 i, hpend i⟩), hmmin, hpmin⟩ |
| 127 | |
| 128 | end PoincareMT.RicciFlow |