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.Cone.Ends.EndRayAnnularDistortion |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.Limits.SelectedMetricEndRayData |
| 4 | |
| 5 | /-! |
| 6 | # Actual selected-point maps into completed chord annuli |
| 7 | |
| 8 | The retained selected-ray function chooses data through every small |
| 9 | source point, including that point as the outer endpoint. Their chord |
| 10 | labels give total annular maps with exact radius and uniform distortion |
| 11 | on the original open-region metric. |
| 12 | Source: Morgan--Tian Proposition 10.29, pp. 262-263; derivation 158. |
| 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 Bundle Topology ENNReal |
| 21 | |
| 22 | namespace PoincareMT.M28 |
| 23 | |
| 24 | variable {M : Type*} [TopologicalSpace M] [T2Space M] |
| 25 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] [IsManifold (𝓡 3) ∞ M] |
| 26 | {g : RiemannianMetric 3 M} {X : Set M} |
| 27 | |
| 28 | /-- Actual rays from the same selected-wall producer give maps from the |
| 29 | original source into each completed chord annulus. Radius is exact and |
| 30 | distortion tends uniformly to zero on every tested source annulus. |
| 31 | The chord compactness and limit inputs are readouts of the actual 155 |
| 32 | producer. Source: Proposition 10.29; derivation 158. -/ |
| 33 | theorem exists_selected_annular_approximation_maps |
| 34 | (T : EpsilonTubeCertificate g X) (A : OpenCylinderModel T.carrier) |
| 35 | (U : TopologicalSpace.Opens M) (f : 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) (alpha : ℝ), 0 < alpha → |
| 39 | E ∉ range ((↑) : U → UniformSpace.Completion U) → |
| 40 | let r : U → ℝ := fun x => dist (x : UniformSpace.Completion U) E |
| 41 | (∀ p : U, r p < alpha → 0 < f p) → |
| 42 | (∀ p : U, 0 < f p → ∃ gamma : ℝ → U, |
| 43 | gamma 0 = p ∧ Isometry (fun t : Ico (0 : ℝ) (r p) => gamma t.1) ∧ |
| 44 | (∀ s ∈ Ico (0 : ℝ) (r p), ∀ t ∈ Ico (0 : ℝ) (r p), |
| 45 | dist (gamma s) (gamma t) = |s - t|) ∧ |
| 46 | (∀ t ∈ Ico (0 : ℝ) (r p), r (gamma t) = r p - t) ∧ |
| 47 | ∀ t ∈ Ico (0 : ℝ) (r p), (3 / 4 : ℝ) ≤ (A.inverse (gamma t)).2) → |
| 48 | ∀ m : PseudoMetricSpace (MetricEndRay E alpha), |
| 49 | letI := m |
| 50 | CompactSpace (UniformSpace.Completion (MetricEndRay E alpha)) → |
| 51 | (∀ P Q : MetricEndRay E alpha, |
| 52 | ∀ s ∈ Ioo (0 : ℝ) P.length, ∀ t ∈ Ioo (0 : ℝ) Q.length, |
| 53 | chordDefect (fun u v => dist (P.point u) (Q.point v)) s t ≤ dist P Q ^ 2) → |
| 54 | (∀ P Q : MetricEndRay E alpha, ∀ r s : ℝ, 0 < r → 0 < s → Tendsto |
| 55 | (fun h : ℝ => dist (P.point (h * r)) (Q.point (h * s)) / h) |
| 56 | (𝓝[>] (0 : ℝ)) (𝓝 (chordConeDistance r s (dist P Q)))) → |
| 57 | ∀ (a b : ℝ) (ha : 0 < a) (hab : a ≤ b) |
| 58 | (htriangle : ∀ x y z : UniformSpace.Completion (MetricEndRay E alpha), |
| 59 | ∀ r s t : ℝ, 0 < r → 0 < s → 0 < t → |
| 60 | chordConeDistance r t (dist x z) ≤ |
| 61 | chordConeDistance r s (dist x y) + chordConeDistance s t (dist y z)), |
| 62 | letI := chordConeAnnulusMetric ha hab htriangle |
| 63 | ∃ F : ℝ → U → |
| 64 | ChordConeAnnulus (UniformSpace.Completion (MetricEndRay E alpha)) a b, |
| 65 | (∀ (h : ℝ) (x : U), r x / h ∈ Icc a b → |
| 66 | ((F h x).2 : ℝ) = r x / h) ∧ |
| 67 | ∀ eta : ℝ, 0 < eta → ∀ᶠ h : ℝ in 𝓝[>] (0 : ℝ), |
| 68 | ∀ x : U, r x / h ∈ Icc a b → |
| 69 | ∀ y : U, r y / h ∈ Icc a b → |
| 70 | 0 ≤ dist (F h x) (F h y) - dist x y / h ∧ |
| 71 | dist (F h x) (F h y) - dist x y / h < eta := by |
| 72 | classical |
| 73 | let := intrinsicOpenMetricSpace g U hfinite |
| 74 | intro E alpha halpha houtside |
| 75 | let r : U → ℝ := fun x => dist (x : UniformSpace.Completion U) E |
| 76 | dsimp only |
| 77 | intro hbarrier hproducer m |
| 78 | let := m |
| 79 | intro hcompact hupper hscaled a b ha hab htriangle |
| 80 | let := hcompact |
| 81 | let := chordConeAnnulusMetric ha hab htriangle |
| 82 | have hdata : ∀ x : {x : U // r x < alpha / 4}, |
| 83 | ∃ P : MetricEndRay E alpha, |
| 84 | P.length = r x.1 ∧ P.point P.length = x.1 := by |
| 85 | intro x |
| 86 | obtain ⟨P, hlength, hpoint, _hlower⟩ := |
| 87 | exists_selected_metricEndRay_at_point T A U f hfinite |
| 88 | E alpha halpha houtside hbarrier hproducer x.1 x.2 |
| 89 | exact ⟨P, hlength, hpoint⟩ |
| 90 | choose P hlength hpoint using hdata |
| 91 | obtain ⟨P₀, _Q₀, _hdifferent, _hP₀, _hQ₀⟩ := |
| 92 | exists_two_distinct_selected_metricEndRay_data T A U f hfinite |
| 93 | E alpha halpha houtside hbarrier hproducer |
| 94 | let datum (x : U) : MetricEndRay E alpha := |
| 95 | if hx : r x < alpha / 4 then P ⟨x, hx⟩ else P₀ |
| 96 | have hdatum (x : U) (hx : r x < alpha / 4) : |
| 97 | (datum x).length = r x ∧ (datum x).point (datum x).length = x := by |
| 98 | dsimp only [datum] |
| 99 | rw [dif_pos hx] |
| 100 | exact ⟨hlength ⟨x, hx⟩, hpoint ⟨x, hx⟩⟩ |
| 101 | let z₀ : ChordConeAnnulus |
| 102 | (UniformSpace.Completion (MetricEndRay E alpha)) a b := |
| 103 | metricEndRayAnnularPoint P₀ ⟨a, le_rfl, hab⟩ |
| 104 | let F (h : ℝ) (x : U) : ChordConeAnnulus |
| 105 | (UniformSpace.Completion (MetricEndRay E alpha)) a b := |
| 106 | if hx : r x / h ∈ Icc a b then |
| 107 | metricEndRayAnnularPoint (datum x) ⟨r x / h, hx⟩ |
| 108 | else z₀ |
| 109 | have hF (h : ℝ) (x : U) (hx : r x / h ∈ Icc a b) : |
| 110 | F h x = metricEndRayAnnularPoint (datum x) ⟨r x / h, hx⟩ := by |
| 111 | dsimp only [F] |
| 112 | rw [dif_pos hx] |
| 113 | have hb : 0 < b := ha.trans_le hab |
| 114 | have hsafe : 0 < alpha / (4 * b) := |
| 115 | div_pos halpha (mul_pos (by norm_num) hb) |
| 116 | have hcap {h : ℝ} (hh : 0 < h) (hsmall : h < alpha / (4 * b)) |
| 117 | {x : U} (hx : r x / h ∈ Icc a b) : r x < alpha / 4 := by |
| 118 | have hxbound : r x ≤ b * h := (div_le_iff₀ hh).mp hx.2 |
| 119 | have hbound : h * (4 * b) < alpha := |
| 120 | (lt_div_iff₀ (mul_pos (by norm_num : (0 : ℝ) < 4) hb)).mp hsmall |
| 121 | nlinarith only [hxbound, hbound] |
| 122 | refine ⟨F, ?_, ?_⟩ |
| 123 | · intro h x hx |
| 124 | rw [hF h x hx] |
| 125 | rfl |
| 126 | · intro eta heta |
| 127 | have huniform := eventually_metricEndRay_annular_distortion |
| 128 | (E := E) (alpha := alpha) ha hab htriangle hupper hscaled eta heta |
| 129 | have hsmall : ∀ᶠ h : ℝ in 𝓝[>] (0 : ℝ), h < alpha / (4 * b) := |
| 130 | mem_nhdsWithin_of_mem_nhds (Iio_mem_nhds hsafe) |
| 131 | filter_upwards [huniform, hsmall, self_mem_nhdsWithin] with h huniform hsmall hh |
| 132 | have hhpos : 0 < h := hh |
| 133 | intro x hx y hy |
| 134 | have hxdata := hdatum x (hcap hhpos hsmall hx) |
| 135 | have hydata := hdatum y (hcap hhpos hsmall hy) |
| 136 | let sx : Icc a b := ⟨r x / h, hx⟩ |
| 137 | let sy : Icc a b := ⟨r y / h, hy⟩ |
| 138 | have hxparameter : h * (sx : ℝ) = (datum x).length := by |
| 139 | change h * (r x / h) = (datum x).length |
| 140 | calc |
| 141 | h * (r x / h) = (r x / h) * h := mul_comm _ _ |
| 142 | _ = r x := div_mul_cancel₀ _ hhpos.ne' |
| 143 | _ = (datum x).length := hxdata.1.symm |
| 144 | have hyparameter : h * (sy : ℝ) = (datum y).length := by |
| 145 | change h * (r y / h) = (datum y).length |
| 146 | calc |
| 147 | h * (r y / h) = (r y / h) * h := mul_comm _ _ |
| 148 | _ = r y := div_mul_cancel₀ _ hhpos.ne' |
| 149 | _ = (datum y).length := hydata.1.symm |
| 150 | have hxpoint : (datum x).point (h * sx) = x := by |
| 151 | rw [hxparameter] |
| 152 | exact hxdata.2 |
| 153 | have hypoint : (datum y).point (h * sy) = y := by |
| 154 | rw [hyparameter] |
| 155 | exact hydata.2 |
| 156 | have hbound := huniform (datum x) (datum y) sx sy hxparameter.le hyparameter.le |
| 157 | rw [hxpoint, hypoint] at hbound |
| 158 | simpa only [hF h x hx, hF h y hy] using hbound |
| 159 | |
| 160 | end PoincareMT.M28 |