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.Analysis.Coordinates.MetricEndRay |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.Geometry.DistinctEndRays |
| 4 | |
| 5 | /-! |
| 6 | # Actual selected rays as finite outward data |
| 7 | |
| 8 | The retained ray function at the same completion point supplies every |
| 9 | small source point as an included outer endpoint. The proved distinct |
| 10 | rays give two literal data with different end germs. The selected wall, |
| 11 | source metric and original-cylinder height are preserved. |
| 12 | Source: Morgan--Tian Lemmas 10.16 and 10.18, p. 258; |
| 13 | M28 derivations 135, 153 and 152c. |
| 14 | -/ |
| 15 | |
| 16 | noncomputable section |
| 17 | set_option autoImplicit false |
| 18 | set_option backward.isDefEq.respectTransparency false |
| 19 | |
| 20 | open Set Filter |
| 21 | open scoped Manifold ContDiff Bundle Topology ENNReal |
| 22 | |
| 23 | namespace PoincareMT.M28 |
| 24 | |
| 25 | variable {M : Type*} [TopologicalSpace M] [T2Space M] |
| 26 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] [IsManifold (𝓡 3) ∞ M] |
| 27 | {g : RiemannianMetric 3 M} {X : Set M} |
| 28 | |
| 29 | /-- Every actual small source point is the included outer endpoint of |
| 30 | a datum obtained from the SAME retained selected-ray function. |
| 31 | Source: MT Lemma 10.16, p. 258; derivations 135 and 152c. -/ |
| 32 | theorem exists_selected_metricEndRay_at_point |
| 33 | (T : EpsilonTubeCertificate g X) (C : OpenCylinderModel T.carrier) |
| 34 | (U : TopologicalSpace.Opens M) (f : M → ℝ) |
| 35 | (hfinite : ∀ p q : U, intrinsicEDist g (U : Set M) (p : M) (q : M) ≠ ⊤) : |
| 36 | letI := intrinsicOpenMetricSpace g U hfinite |
| 37 | ∀ (E : UniformSpace.Completion U) (alpha : ℝ), 0 < alpha → |
| 38 | E ∉ Set.range ((↑) : U → UniformSpace.Completion U) → |
| 39 | let r : U → ℝ := fun x => dist (x : UniformSpace.Completion U) E |
| 40 | (∀ p : U, r p < alpha → 0 < f p) → |
| 41 | (∀ p : U, 0 < f p → ∃ gamma : ℝ → U, |
| 42 | gamma 0 = p ∧ Isometry (fun t : Ico (0 : ℝ) (r p) => gamma t.1) ∧ |
| 43 | (∀ s ∈ Ico (0 : ℝ) (r p), ∀ t ∈ Ico (0 : ℝ) (r p), |
| 44 | dist (gamma s) (gamma t) = |s - t|) ∧ |
| 45 | (∀ t ∈ Ico (0 : ℝ) (r p), r (gamma t) = r p - t) ∧ |
| 46 | ∀ t ∈ Ico (0 : ℝ) (r p), (3 / 4 : ℝ) ≤ (C.inverse (gamma t)).2) → |
| 47 | ∀ p : U, r p < alpha / 4 → ∃ P : MetricEndRay E alpha, |
| 48 | P.length = r p ∧ P.point P.length = p ∧ |
| 49 | ∀ s ∈ Ioc (0 : ℝ) P.length, (3 / 4 : ℝ) ≤ (C.inverse (P.point s)).2 := by |
| 50 | let := intrinsicOpenMetricSpace g U hfinite |
| 51 | intro E alpha halpha houtside |
| 52 | let r : U → ℝ := fun x => dist (x : UniformSpace.Completion U) E |
| 53 | dsimp only |
| 54 | intro hbarrier hproducer p hp |
| 55 | have hpos : 0 < r p := dist_pos.mpr fun h => houtside ⟨p, h⟩ |
| 56 | have hpalpha : r p < alpha := by linarith only [hp, halpha] |
| 57 | obtain ⟨gamma, hgamma0, _hgammaIsometry, hgammaMetric, hgammaRadius, hgammaLower⟩ := |
| 58 | hproducer p (hbarrier p hpalpha) |
| 59 | let P : MetricEndRay E alpha := |
| 60 | MetricEndRay.ofInward hpos hp gamma hgammaMetric hgammaRadius |
| 61 | refine ⟨P, rfl, ?_, ?_⟩ |
| 62 | · change gamma (r p - r p) = p |
| 63 | simpa only [sub_self] using hgamma0 |
| 64 | · intro s hs |
| 65 | change s ∈ Ioc (0 : ℝ) (r p) at hs |
| 66 | exact hgammaLower (r p - s) |
| 67 | ⟨by linarith only [hs.2], by linarith only [hs.1]⟩ |
| 68 | |
| 69 | /-- The actual distinct selected rays become data with different end |
| 70 | germs, retaining their literal source-point maps and lower heights. |
| 71 | Source: MT Lemma 10.18, p. 258; derivations 153 and 152c. -/ |
| 72 | theorem exists_two_distinct_selected_metricEndRay_data |
| 73 | (T : EpsilonTubeCertificate g X) (C : OpenCylinderModel T.carrier) |
| 74 | (U : TopologicalSpace.Opens M) (f : M → ℝ) |
| 75 | (hfinite : ∀ p q : U, intrinsicEDist g (U : Set M) (p : M) (q : M) ≠ ⊤) : |
| 76 | letI := intrinsicOpenMetricSpace g U hfinite |
| 77 | ∀ (E : UniformSpace.Completion U) (alpha : ℝ), 0 < alpha → |
| 78 | E ∉ Set.range ((↑) : U → UniformSpace.Completion U) → |
| 79 | let r : U → ℝ := fun x => dist (x : UniformSpace.Completion U) E |
| 80 | (∀ p : U, r p < alpha → 0 < f p) → |
| 81 | (∀ p : U, 0 < f p → ∃ gamma : ℝ → U, |
| 82 | gamma 0 = p ∧ Isometry (fun t : Ico (0 : ℝ) (r p) => gamma t.1) ∧ |
| 83 | (∀ s ∈ Ico (0 : ℝ) (r p), ∀ t ∈ Ico (0 : ℝ) (r p), |
| 84 | dist (gamma s) (gamma t) = |s - t|) ∧ |
| 85 | (∀ t ∈ Ico (0 : ℝ) (r p), r (gamma t) = r p - t) ∧ |
| 86 | ∀ t ∈ Ico (0 : ℝ) (r p), (3 / 4 : ℝ) ≤ (C.inverse (gamma t)).2) → |
| 87 | ∃ P Q : MetricEndRay E alpha, |
| 88 | ¬MetricEndRay.SameEndGerm P Q ∧ |
| 89 | (∀ s ∈ Ioc (0 : ℝ) P.length, (3 / 4 : ℝ) ≤ (C.inverse (P.point s)).2) ∧ |
| 90 | ∀ s ∈ Ioc (0 : ℝ) Q.length, (3 / 4 : ℝ) ≤ (C.inverse (Q.point s)).2 := by |
| 91 | let := intrinsicOpenMetricSpace g U hfinite |
| 92 | intro E alpha halpha houtside |
| 93 | let r : U → ℝ := fun x => dist (x : UniformSpace.Completion U) E |
| 94 | dsimp only |
| 95 | intro hbarrier hproducer |
| 96 | obtain ⟨p, q, gamma, mu, hpPositive, hpSmall, hqLower, hqUpper, |
| 97 | hgamma, hmu, _hoff, hnear⟩ := |
| 98 | exists_two_distinct_selected_metric_end_rays T C U f hfinite |
| 99 | E alpha halpha houtside hbarrier hproducer |
| 100 | obtain ⟨_hgamma0, _hgammaIsometry, hgammaMetric, hgammaRadius, hgammaLower⟩ := hgamma |
| 101 | obtain ⟨_hmu0, _hmuIsometry, hmuMetric, hmuRadius, hmuLower⟩ := hmu |
| 102 | have hqPositive : 0 < r q := by linarith only [hpPositive, hqLower] |
| 103 | have hqSmall : r q < alpha / 4 := by linarith only [hpPositive, hpSmall, hqUpper] |
| 104 | let P : MetricEndRay E alpha := |
| 105 | MetricEndRay.ofInward hpPositive hpSmall gamma hgammaMetric hgammaRadius |
| 106 | let Q : MetricEndRay E alpha := |
| 107 | MetricEndRay.ofInward hqPositive hqSmall mu hmuMetric hmuRadius |
| 108 | refine ⟨P, Q, ?_, ?_, ?_⟩ |
| 109 | · rintro ⟨c, hc, _hcP, _hcQ, hagree⟩ |
| 110 | obtain ⟨s, hs, hdifferent⟩ := hnear c hc |
| 111 | have heq := hagree ⟨hs.1, hs.2.le.trans (min_le_left _ _)⟩ |
| 112 | change gamma (r p - s) = mu (r q - s) at heq |
| 113 | exact hdifferent heq |
| 114 | · intro s hs |
| 115 | change s ∈ Ioc (0 : ℝ) (r p) at hs |
| 116 | exact hgammaLower (r p - s) |
| 117 | ⟨by linarith only [hs.2], by linarith only [hs.1]⟩ |
| 118 | · intro s hs |
| 119 | change s ∈ Ioc (0 : ℝ) (r q) at hs |
| 120 | exact hmuLower (r q - s) |
| 121 | ⟨by linarith only [hs.2], by linarith only [hs.1]⟩ |
| 122 | |
| 123 | end PoincareMT.M28 |