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.IntrinsicMetricRayRegularity |
| 3 | import Mathlib.Topology.MetricSpace.Completion |
| 4 | |
| 5 | /-! |
| 6 | # Uniqueness after a strict shortening of an actual end ray |
| 7 | |
| 8 | The completion radius makes a concatenation with any competing end ray |
| 9 | an exact metric ray. Local metric regularity gives its geodesic equation, |
| 10 | and agreement of germs before the join propagates along the open ray. |
| 11 | All distances remain those of the original intrinsic recut. |
| 12 | Source: Morgan--Tian Corollary 10.15, p. 258; M28 derivation 145. |
| 13 | -/ |
| 14 | |
| 15 | noncomputable section |
| 16 | set_option autoImplicit false |
| 17 | set_option backward.isDefEq.respectTransparency false |
| 18 | |
| 19 | open Set Filter |
| 20 | open scoped Manifold ContDiff Topology ENNReal Bundle |
| 21 | |
| 22 | universe u |
| 23 | |
| 24 | namespace PoincareMT.M28 |
| 25 | |
| 26 | variable {M : Type u} [TopologicalSpace M] [T2Space M] |
| 27 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] |
| 28 | [IsManifold (𝓡 3) ∞ M] |
| 29 | |
| 30 | /-- Any competing normalized metric end ray starting at a strict |
| 31 | interior point of the retained ray agrees with its remaining sub-ray. |
| 32 | Neither input ray is assumed smooth. Corollary 10.15, p. 258; |
| 33 | M28 derivation 145. -/ |
| 34 | theorem intrinsic_end_ray_eq_after_interior |
| 35 | (g : RiemannianMetric 3 M) (U : TopologicalSpace.Opens M) |
| 36 | (hfinite : ∀ p q : U, intrinsicEDist g (U : Set M) (p : M) (q : M) ≠ ⊤) : |
| 37 | letI := intrinsicOpenMetricSpace g U hfinite |
| 38 | ∀ (E : UniformSpace.Completion U) {a t0 : ℝ} {gamma sigma : ℝ → U}, |
| 39 | t0 ∈ Ioo (0 : ℝ) a → |
| 40 | sigma 0 = gamma t0 → |
| 41 | (∀ s ∈ Ico (0 : ℝ) a, ∀ t ∈ Ico (0 : ℝ) a, |
| 42 | dist (gamma s) (gamma t) = |s - t|) → |
| 43 | (∀ s ∈ Ico (0 : ℝ) (a - t0), ∀ t ∈ Ico (0 : ℝ) (a - t0), |
| 44 | dist (sigma s) (sigma t) = |s - t|) → |
| 45 | (∀ s ∈ Ico (0 : ℝ) a, |
| 46 | dist (gamma s : UniformSpace.Completion U) E = a - s) → |
| 47 | (∀ s ∈ Ico (0 : ℝ) (a - t0), |
| 48 | dist (sigma s : UniformSpace.Completion U) E = a - t0 - s) → |
| 49 | ∀ s ∈ Ico (0 : ℝ) (a - t0), sigma s = gamma (t0 + s) := by |
| 50 | let := intrinsicOpenMetricSpace g U hfinite |
| 51 | intro E a t0 gamma sigma ht0 hstart hgamma hsigma hgammaRadius hsigmaRadius |
| 52 | let tau : ℝ → U := fun t => if t ≤ t0 then gamma t else sigma (t - t0) |
| 53 | have hleft (t : ℝ) (ht : t ≤ t0) : tau t = gamma t := by |
| 54 | simp only [tau, if_pos ht] |
| 55 | have hright (t : ℝ) (ht : t0 < t) : tau t = sigma (t - t0) := by |
| 56 | simp only [tau, if_neg (not_le.mpr ht)] |
| 57 | have ht0ray : t0 ∈ Ico (0 : ℝ) a := ⟨ht0.1.le, ht0.2⟩ |
| 58 | have hzero : (0 : ℝ) ∈ Ico (0 : ℝ) (a - t0) := |
| 59 | ⟨le_rfl, sub_pos.mpr ht0.2⟩ |
| 60 | have hshift (t : ℝ) (ht : t ∈ Ico (0 : ℝ) a) (ht0t : t0 < t) : |
| 61 | t - t0 ∈ Ico (0 : ℝ) (a - t0) := |
| 62 | ⟨(sub_pos.mpr ht0t).le, sub_lt_sub_right ht.2 t0⟩ |
| 63 | have hlipschitz (x y : U) : |
| 64 | dist (x : UniformSpace.Completion U) E - |
| 65 | dist (y : UniformSpace.Completion U) E ≤ dist x y := by |
| 66 | have h := dist_triangle (x : UniformSpace.Completion U) |
| 67 | (y : UniformSpace.Completion U) E |
| 68 | rw [UniformSpace.Completion.dist_eq] at h |
| 69 | linarith |
| 70 | have hcross (s : ℝ) (hs : s ∈ Ico (0 : ℝ) a) |
| 71 | (t : ℝ) (ht : t ∈ Ico (0 : ℝ) a) (hst0 : s ≤ t0) (ht0t : t0 < t) : |
| 72 | dist (tau s) (tau t) = |s - t| := by |
| 73 | have htshift := hshift t ht ht0t |
| 74 | have hleg1 : dist (gamma s) (gamma t0) = t0 - s := by |
| 75 | simpa only [abs_of_nonpos (sub_nonpos.mpr hst0), neg_sub] using |
| 76 | hgamma s hs t0 ht0ray |
| 77 | have hleg2 : dist (gamma t0) (sigma (t - t0)) = t - t0 := by |
| 78 | simpa only [hstart, zero_sub, abs_neg, abs_of_nonneg htshift.1] using |
| 79 | hsigma 0 hzero (t - t0) htshift |
| 80 | have hupper := dist_triangle (gamma s) (gamma t0) (sigma (t - t0)) |
| 81 | rw [hleg1, hleg2] at hupper |
| 82 | have hlower := hlipschitz (gamma s) (sigma (t - t0)) |
| 83 | rw [hgammaRadius s hs, hsigmaRadius (t - t0) htshift] at hlower |
| 84 | rw [hleft s hst0, hright t ht0t, |
| 85 | abs_of_nonpos (sub_nonpos.mpr (hst0.trans ht0t.le)), neg_sub] |
| 86 | linarith |
| 87 | have htau : ∀ s ∈ Ico (0 : ℝ) a, ∀ t ∈ Ico (0 : ℝ) a, |
| 88 | dist (tau s) (tau t) = |s - t| := by |
| 89 | intro s hs t ht |
| 90 | by_cases hst0 : s ≤ t0 |
| 91 | · by_cases htt0 : t ≤ t0 |
| 92 | · rw [hleft s hst0, hleft t htt0] |
| 93 | exact hgamma s hs t ht |
| 94 | · exact hcross s hs t ht hst0 (lt_of_not_ge htt0) |
| 95 | · have ht0s : t0 < s := lt_of_not_ge hst0 |
| 96 | by_cases htt0 : t ≤ t0 |
| 97 | · rw [dist_comm, abs_sub_comm] |
| 98 | exact hcross t ht s hs htt0 ht0s |
| 99 | · have ht0t : t0 < t := lt_of_not_ge htt0 |
| 100 | rw [hright s ht0s, hright t ht0t, |
| 101 | hsigma (s - t0) (hshift s hs ht0s) (t - t0) (hshift t ht ht0t)] |
| 102 | congr 1 |
| 103 | ring |
| 104 | have hgammaGeo := (intrinsic_metric_ray_regular g U hfinite hgamma).1 |
| 105 | have htauGeo := (intrinsic_metric_ray_regular g U hfinite htau).1 |
| 106 | have hmid : t0 / 2 ∈ Ioo (0 : ℝ) a := |
| 107 | ⟨half_pos ht0.1, (half_lt_self ht0.1).trans ht0.2⟩ |
| 108 | have hnear : gamma =ᶠ[𝓝 (t0 / 2)] tau := by |
| 109 | filter_upwards [Ioo_mem_nhds (half_pos ht0.1) (half_lt_self ht0.1)] with t ht |
| 110 | exact (hleft t ht.2.le).symm |
| 111 | have heq := hgammaGeo.eqOn_of_eq_nhds htauGeo |
| 112 | (convex_Ioo (0 : ℝ) a).isPreconnected hmid hnear |
| 113 | intro s hs |
| 114 | by_cases hs0 : s = 0 |
| 115 | · subst s |
| 116 | simpa only [add_zero] using hstart |
| 117 | · have hspos : 0 < s := lt_of_le_of_ne hs.1 (Ne.symm hs0) |
| 118 | have htime : t0 + s ∈ Ioo (0 : ℝ) a := by |
| 119 | constructor <;> linarith [ht0.1, hs.2] |
| 120 | have h := heq htime |
| 121 | rw [hright (t0 + s) (by linarith), add_sub_cancel_left] at h |
| 122 | exact h.symm |
| 123 | |
| 124 | end PoincareMT.M28 |