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.Generalized.BoundedDistance.GeometryImports |
| 2 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.IntrinsicGeometry.IntrinsicEndRayUniqueness |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.Limits.SelectedCylinderMetricRays |
| 4 | |
| 5 | /-! |
| 6 | # Actual selected-cylinder segments limit to a shortened end ray |
| 7 | |
| 8 | The original-A slab compactness and radius decay identify every fixed |
| 9 | proper-prefix limit along one common hyperfilter. The limit is the |
| 10 | retained shortened ray by the proved interior uniqueness theorem. |
| 11 | Source: Morgan--Tian Corollary 10.15 and Lemma 10.21, pp. 258-259; |
| 12 | M28 derivation 151. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | set_option backward.isDefEq.respectTransparency false |
| 17 | |
| 18 | open Set Filter |
| 19 | open scoped Manifold ContDiff Bundle Topology ENNReal |
| 20 | |
| 21 | universe u |
| 22 | |
| 23 | namespace PoincareMT.M28 |
| 24 | |
| 25 | variable {M : Type u} [TopologicalSpace M] [T2Space M] |
| 26 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] |
| 27 | [IsManifold (𝓡 3) ∞ M] |
| 28 | {g : RiemannianMetric 3 M} {X : Set M} |
| 29 | |
| 30 | /-- The actual confined metric segments to vanishing-radius endpoints |
| 31 | converge on every proper prefix to the same retained shortened ray. |
| 32 | Only original-A compact slabs are used. Source: Lemma 10.21, p. 259; |
| 33 | M28 derivation 151. -/ |
| 34 | theorem selected_segment_tendsto_shortened_ray |
| 35 | (T : EpsilonTubeCertificate g X) (C : OpenCylinderModel T.carrier) |
| 36 | (U : TopologicalSpace.Opens M) (hU : (U : Set M) = C.tail true (1 / 2)) |
| 37 | (hfinite : ∀ p q : U, intrinsicEDist g (U : Set M) (p : M) (q : M) ≠ ⊤) : |
| 38 | letI := intrinsicOpenMetricSpace g U hfinite |
| 39 | ∀ E : UniformSpace.Completion U, |
| 40 | (∀ eta : ℝ, 0 < eta → ∃ c : ℝ, 1 / 2 < c ∧ c < 1 ∧ |
| 41 | ∀ x : U, c < (C.inverse x).2 → |
| 42 | dist (x : UniformSpace.Completion U) E < eta) → |
| 43 | ∀ {b B : ℝ} {mu : ℝ → U}, 0 < B → B < b → |
| 44 | (∀ s ∈ Ico (0 : ℝ) b, ∀ t ∈ Ico (0 : ℝ) b, |
| 45 | dist (mu s) (mu t) = |s - t|) → |
| 46 | (∀ s ∈ Ico (0 : ℝ) b, |
| 47 | dist (mu s : UniformSpace.Completion U) E = b - s) → |
| 48 | ∀ {arc : ℕ → ℝ → U} {length : ℕ → ℝ} {q : ℕ → U}, |
| 49 | (∀ n, 0 < length n) → |
| 50 | Tendsto length atTop (𝓝 B) → |
| 51 | Tendsto (fun n => dist (q n : UniformSpace.Completion U) E) atTop (𝓝 0) → |
| 52 | (∀ n, arc n 0 = mu (b - B)) → |
| 53 | (∀ n, arc n (length n) = q n) → |
| 54 | (∀ n, ∀ s ∈ Icc (0 : ℝ) (length n), |
| 55 | ∀ t ∈ Icc (0 : ℝ) (length n), dist (arc n s) (arc n t) = |s - t|) → |
| 56 | (∀ n, ∀ t ∈ Icc (0 : ℝ) (length n), |
| 57 | (3 / 4 : ℝ) ≤ (C.inverse (arc n t)).2) → |
| 58 | ∀ t ∈ Ico (0 : ℝ) B, |
| 59 | Tendsto (fun n => arc n t) (hyperfilter ℕ : Filter ℕ) |
| 60 | (𝓝 (mu (b - B + t))) := by |
| 61 | let := intrinsicOpenMetricSpace g U hfinite |
| 62 | intro E htail b B mu hB hBb hmu hmuRadius |
| 63 | arc length q hlengthPos hlength hdefect hanchor hendpoint harcMetric harcLower |
| 64 | let r : U → ℝ := fun x => dist (x : UniformSpace.Completion U) E |
| 65 | have hcontinuous : Continuous r := |
| 66 | (UniformSpace.Completion.continuous_coe U).dist continuous_const |
| 67 | have hUV : (U : Set M) ⊆ T.carrier := by |
| 68 | rw [hU] |
| 69 | exact C.tail_subset_m28 true (by norm_num) (by norm_num) |
| 70 | have hanchorRadius : r (mu (b - B)) = B := by |
| 71 | dsimp [r] |
| 72 | rw [hmuRadius (b - B) ⟨by linarith, by linarith⟩] |
| 73 | ring |
| 74 | have htriangle (x y : U) : |r x - r y| ≤ dist x y := by |
| 75 | simpa only [UniformSpace.Completion.dist_eq] using |
| 76 | abs_dist_sub_le (x : UniformSpace.Completion U) (y : UniformSpace.Completion U) E |
| 77 | have hradiusBounds (n : ℕ) (t : ℝ) (ht : t ∈ Icc (0 : ℝ) (length n)) : |
| 78 | B - t ≤ r (arc n t) ∧ r (arc n t) ≤ length n - t + r (q n) := by |
| 79 | have hstart := harcMetric n 0 ⟨le_rfl, (hlengthPos n).le⟩ t ht |
| 80 | rw [hanchor n] at hstart |
| 81 | have hstart' : dist (mu (b - B)) (arc n t) = t := by |
| 82 | simpa only [zero_sub, abs_neg, abs_of_nonneg ht.1] using hstart |
| 83 | have hend := harcMetric n t ht (length n) ⟨(hlengthPos n).le, le_rfl⟩ |
| 84 | rw [hendpoint n] at hend |
| 85 | have hend' : dist (arc n t) (q n) = length n - t := by |
| 86 | simpa only [abs_of_nonpos (sub_nonpos.mpr ht.2), neg_sub] using hend |
| 87 | have hlow := (le_abs_self (r (mu (b - B)) - r (arc n t))).trans |
| 88 | (htriangle (mu (b - B)) (arc n t)) |
| 89 | have hupp := (le_abs_self (r (arc n t) - r (q n))).trans |
| 90 | (htriangle (arc n t) (q n)) |
| 91 | rw [hanchorRadius, hstart'] at hlow |
| 92 | rw [hend'] at hupp |
| 93 | constructor <;> linarith |
| 94 | have hprefix : ∀ T0 : ℝ, 0 < T0 → T0 < B → |
| 95 | ∃ K : Set U, IsCompact K ∧ |
| 96 | ∀ᶠ n in atTop, ∀ t ∈ Icc (0 : ℝ) T0, arc n t ∈ K := by |
| 97 | intro T0 _hT0 hT0B |
| 98 | obtain ⟨d, _hdhalf, hd1, hdecay⟩ := htail ((B - T0) / 2) |
| 99 | (half_pos (sub_pos.mpr hT0B)) |
| 100 | let upper : ℝ := max d (3 / 4 : ℝ) |
| 101 | have hupper : upper < 1 := max_lt hd1 (by norm_num) |
| 102 | have hKambient : IsCompact (C.compactSlab (3 / 4) upper) := |
| 103 | C.isCompact_compactSlab (by norm_num) hupper |
| 104 | have hKU : C.compactSlab (3 / 4) upper ⊆ (U : Set M) := by |
| 105 | intro x hx |
| 106 | have hxread := (C.mem_compactSlab_iff (by norm_num) hupper).mp hx |
| 107 | rw [hU] |
| 108 | exact (C.mem_tail_iff_m28 true (by norm_num) (by norm_num)).mpr |
| 109 | ⟨hxread.1, (by norm_num : (1 / 2 : ℝ) < 3 / 4).trans_le hxread.2.1⟩ |
| 110 | let K : Set U := (Subtype.val : U → M) ⁻¹' C.compactSlab (3 / 4) upper |
| 111 | have hK : IsCompact K := |
| 112 | Topology.IsEmbedding.subtypeVal.isInducing.isCompact_preimage' hKambient |
| 113 | (fun x hx => ⟨⟨x, hKU hx⟩, rfl⟩) |
| 114 | refine ⟨K, hK, ?_⟩ |
| 115 | filter_upwards [hlength.eventually (lt_mem_nhds hT0B)] with n hn |
| 116 | intro t ht |
| 117 | have htime : t ∈ Icc (0 : ℝ) (length n) := ⟨ht.1, ht.2.trans hn.le⟩ |
| 118 | have hbound := (hradiusBounds n t htime).1 |
| 119 | have hheightUpper : (C.inverse (arc n t)).2 ≤ d := by |
| 120 | apply le_of_not_gt |
| 121 | intro hhigh |
| 122 | have hsmall := hdecay (arc n t) hhigh |
| 123 | change r (arc n t) < (B - T0) / 2 at hsmall |
| 124 | linarith [ht.2] |
| 125 | change (arc n t : M) ∈ C.compactSlab (3 / 4) upper |
| 126 | exact (C.mem_compactSlab_iff (by norm_num) hupper).mpr |
| 127 | ⟨hUV (arc n t).property, harcLower n t htime, |
| 128 | hheightUpper.trans (le_max_left _ _)⟩ |
| 129 | obtain ⟨sigma, hsigma0, _hsigmaIsometry, hsigmaMetric, hsigmaLimit⟩ := |
| 130 | exists_isometric_finite_ray_of_compact_prefixes hB hlength |
| 131 | (Eventually.of_forall hanchor) hprefix harcMetric |
| 132 | have hsigmaRadius : ∀ t ∈ Ico (0 : ℝ) B, r (sigma t) = B - t := by |
| 133 | apply finite_ray_radius_eq_of_source_bounds (r := r) hcontinuous |
| 134 | hlength hdefect hsigmaLimit |
| 135 | intro t ht |
| 136 | exact (hlength.eventually (lt_mem_nhds ht.2)).mono fun n hn => |
| 137 | hradiusBounds n t ⟨ht.1, hn.le⟩ |
| 138 | have hremaining : b - (b - B) = B := by ring |
| 139 | have heq : ∀ t ∈ Ico (0 : ℝ) B, sigma t = mu (b - B + t) := by |
| 140 | have h := intrinsic_end_ray_eq_after_interior g U hfinite E |
| 141 | (a := b) (t0 := b - B) (gamma := mu) (sigma := sigma) |
| 142 | ⟨by linarith, by linarith⟩ hsigma0 hmu |
| 143 | (by simpa only [hremaining] using hsigmaMetric) hmuRadius |
| 144 | (by simpa only [hremaining] using hsigmaRadius) |
| 145 | simpa only [hremaining] using h |
| 146 | intro t ht |
| 147 | simpa only [heq t ht] using hsigmaLimit t ht |
| 148 | |
| 149 | end PoincareMT.M28 |