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 Mathlib.Analysis.Real.Sqrt |
| 2 | import Mathlib.Topology.MetricSpace.Basic |
| 3 | import Mathlib.Tactic |
| 4 | |
| 5 | /-! |
| 6 | # Two-sided arcs from nearly opposite minimizing segments |
| 7 | |
| 8 | Two minimizing segments with diverging lengths are glued at their common |
| 9 | base point. The Toponogov interior lower bound and endpoint comparison |
| 10 | cosines tending to -1 force all distances along the glued maps to tend |
| 11 | to the corresponding real-line distances. |
| 12 | |
| 13 | This is the finite-segment step of Morgan--Tian, Theorem 5.35, printed |
| 14 | pp. 122--123, and Kleiner--Lott, corrected 2013, Appendix G, printed p. 2852. |
| 15 | The triangle comparison and the selection of nearly opposite endpoints |
| 16 | are explicit prerequisites, not conclusions of this module. |
| 17 | |
| 18 | The squared-distance squeeze is adapted from the pinned Axel source |
| 19 | `MorganTianLib/Ch09/SplittingAtInfinity/Line/Comparison.lean`. |
| 20 | See `notes/ricci-flow/ancient-volume-opposite-segments.md` for provenance. |
| 21 | -/ |
| 22 | |
| 23 | set_option autoImplicit false |
| 24 | |
| 25 | open Filter Set |
| 26 | open scoped Topology |
| 27 | |
| 28 | namespace Poincare.AncientVolume.Splitting |
| 29 | |
| 30 | private theorem tendsto_distance_add_of_squared_comparison |
| 31 | {s t : ℝ} {d c : ℕ → ℝ} (hs : 0 ≤ s) (ht : 0 ≤ t) |
| 32 | (hd : ∀ i, 0 ≤ d i) (hc : Tendsto c atTop (𝓝 (-1))) |
| 33 | (hlower : ∀ᶠ i in atTop, s ^ 2 + t ^ 2 - 2 * s * t * c i ≤ d i ^ 2) |
| 34 | (hupper : ∀ᶠ i in atTop, d i ≤ s + t) : |
| 35 | Tendsto d atTop (𝓝 (s + t)) := by |
| 36 | have hlow : Tendsto (fun i => s ^ 2 + t ^ 2 - 2 * s * t * c i) |
| 37 | atTop (𝓝 ((s + t) ^ 2)) := by |
| 38 | have h := (tendsto_const_nhds (x := s ^ 2 + t ^ 2)).sub |
| 39 | ((tendsto_const_nhds (x := 2 * s * t)).mul hc) |
| 40 | convert h using 1 |
| 41 | congr 1 |
| 42 | ring |
| 43 | have hupp : ∀ᶠ i in atTop, d i ^ 2 ≤ (s + t) ^ 2 := by |
| 44 | filter_upwards [hupper] with i hi |
| 45 | exact pow_le_pow_left₀ (hd i) hi 2 |
| 46 | have hsq : Tendsto (fun i => d i ^ 2) atTop (𝓝 ((s + t) ^ 2)) := |
| 47 | tendsto_of_tendsto_of_tendsto_of_le_of_le' hlow tendsto_const_nhds hlower hupp |
| 48 | simpa only [Real.sqrt_sq (hd _), Real.sqrt_sq (add_nonneg hs ht)] using hsq.sqrt |
| 49 | |
| 50 | /-- The cosine of the Euclidean comparison angle at the common base point |
| 51 | of two finite unit-speed minimizing segments, expressed by their endpoint |
| 52 | distance and lengths. -/ |
| 53 | noncomputable def segmentComparisonCosine {X : Type*} [MetricSpace X] |
| 54 | (minus plus : ℝ → X) (a b : ℝ) : ℝ := |
| 55 | (a ^ 2 + b ^ 2 - dist (minus a) (plus b) ^ 2) / (2 * a * b) |
| 56 | |
| 57 | /-- Actual finite minimizing segments and the Toponogov interior inequality |
| 58 | produce two-sided maps with asymptotically real-line distances. The metric |
| 59 | spaces may vary with the index; no limit space or line is an input. -/ |
| 60 | theorem exists_two_sided_arcs_of_minimizing_segments |
| 61 | {X : ℕ → Type*} [∀ i, MetricSpace (X i)] |
| 62 | (p : ∀ i, X i) (minus plus : ∀ i, ℝ → X i) {a b : ℕ → ℝ} |
| 63 | (hminus0 : ∀ i, minus i 0 = p i) (hplus0 : ∀ i, plus i 0 = p i) |
| 64 | (hminus : ∀ i, ∀ s ∈ Icc (0 : ℝ) (a i), ∀ t ∈ Icc (0 : ℝ) (a i), |
| 65 | dist (minus i s) (minus i t) = |s - t|) |
| 66 | (hplus : ∀ i, ∀ s ∈ Icc (0 : ℝ) (b i), ∀ t ∈ Icc (0 : ℝ) (b i), |
| 67 | dist (plus i s) (plus i t) = |s - t|) |
| 68 | (ha : Tendsto a atTop atTop) (hb : Tendsto b atTop atTop) |
| 69 | (hangle : Tendsto (fun i => segmentComparisonCosine (minus i) (plus i) (a i) (b i)) |
| 70 | atTop (𝓝 (-1))) |
| 71 | (hcomparison : ∀ i, ∀ s ∈ Icc (0 : ℝ) (a i), ∀ t ∈ Icc (0 : ℝ) (b i), |
| 72 | s ^ 2 + t ^ 2 - 2 * s * t * |
| 73 | segmentComparisonCosine (minus i) (plus i) (a i) (b i) ≤ |
| 74 | dist (minus i s) (plus i t) ^ 2) : |
| 75 | ∃ arc : ∀ i, ℝ → X i, |
| 76 | (∀ i, arc i 0 = p i) ∧ |
| 77 | (∀ i t, 0 ≤ t → arc i t = plus i t) ∧ |
| 78 | (∀ i t, 0 ≤ t → arc i (-t) = minus i t) ∧ |
| 79 | ∀ s t : ℝ, Tendsto (fun i => dist (arc i s) (arc i t)) atTop (𝓝 |s - t|) := by |
| 80 | have hcross : ∀ s t : ℝ, 0 ≤ s → 0 ≤ t → |
| 81 | Tendsto (fun i => dist (minus i s) (plus i t)) atTop (𝓝 (s + t)) := by |
| 82 | intro s t hs ht |
| 83 | apply tendsto_distance_add_of_squared_comparison hs ht (fun _ => dist_nonneg) hangle |
| 84 | · filter_upwards [ha.eventually_ge_atTop s, hb.eventually_ge_atTop t] with i hsi hti |
| 85 | exact hcomparison i s ⟨hs, hsi⟩ t ⟨ht, hti⟩ |
| 86 | · filter_upwards [ha.eventually_ge_atTop s, hb.eventually_ge_atTop t] with i hsi hti |
| 87 | have hleft : dist (minus i s) (p i) = s := by |
| 88 | rw [← hminus0 i, hminus i s ⟨hs, hsi⟩ 0 ⟨le_rfl, hs.trans hsi⟩, |
| 89 | sub_zero, abs_of_nonneg hs] |
| 90 | have hright : dist (p i) (plus i t) = t := by |
| 91 | rw [← hplus0 i, hplus i 0 ⟨le_rfl, ht.trans hti⟩ t ⟨ht, hti⟩, |
| 92 | zero_sub, abs_neg, abs_of_nonneg ht] |
| 93 | simpa only [hleft, hright] using dist_triangle (minus i s) (p i) (plus i t) |
| 94 | let arc : ∀ i, ℝ → X i := fun i t => if 0 ≤ t then plus i t else minus i (-t) |
| 95 | have hpos (i : ℕ) (t : ℝ) (ht : 0 ≤ t) : arc i t = plus i t := by simp [arc, ht] |
| 96 | have hneg (i : ℕ) (t : ℝ) (ht : 0 ≤ t) : arc i (-t) = minus i t := by |
| 97 | rcases eq_or_lt_of_le ht with rfl | ht |
| 98 | · simp [arc, hplus0, hminus0] |
| 99 | · simp [arc, show ¬0 ≤ -t by linarith] |
| 100 | refine ⟨arc, (fun i => by simp [arc, hplus0]), hpos, hneg, ?_⟩ |
| 101 | intro s t |
| 102 | rcases le_or_gt 0 s with hs | hs |
| 103 | · rcases le_or_gt 0 t with ht | ht |
| 104 | · apply tendsto_const_nhds.congr' |
| 105 | filter_upwards [hb.eventually_ge_atTop s, hb.eventually_ge_atTop t] with i hsi hti |
| 106 | rw [hpos i s hs, hpos i t ht, hplus i s ⟨hs, hsi⟩ t ⟨ht, hti⟩] |
| 107 | · have ht' : 0 ≤ -t := by linarith |
| 108 | have h := hcross (-t) s ht' hs |
| 109 | convert h using 1 |
| 110 | · funext i |
| 111 | rw [hpos i s hs, show arc i t = minus i (-t) from by simpa using hneg i (-t) ht', |
| 112 | dist_comm] |
| 113 | · rw [abs_of_nonneg (by linarith : 0 ≤ s - t)] |
| 114 | congr 1 |
| 115 | ring |
| 116 | · have hs' : 0 ≤ -s := by linarith |
| 117 | rcases le_or_gt 0 t with ht | ht |
| 118 | · have h := hcross (-s) t hs' ht |
| 119 | convert h using 1 |
| 120 | · funext i |
| 121 | rw [hpos i t ht, show arc i s = minus i (-s) from by simpa using hneg i (-s) hs'] |
| 122 | · rw [abs_of_nonpos (by linarith : s - t ≤ 0)] |
| 123 | congr 1 |
| 124 | ring |
| 125 | · have ht' : 0 ≤ -t := by linarith |
| 126 | apply tendsto_const_nhds.congr' |
| 127 | filter_upwards [ha.eventually_ge_atTop (-s), ha.eventually_ge_atTop (-t)] with i hsi hti |
| 128 | rw [show arc i s = minus i (-s) from by simpa using hneg i (-s) hs', |
| 129 | show arc i t = minus i (-t) from by simpa using hneg i (-t) ht', |
| 130 | hminus i (-s) ⟨hs', hsi⟩ (-t) ⟨ht', hti⟩, |
| 131 | show -s - -t = -(s - t) by ring, abs_neg] |
| 132 | |
| 133 | end Poincare.AncientVolume.Splitting |