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.MetricEndRayChord |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Angles.Limits.SelectedEndRayChordLimits |
| 4 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Cone.Limits.SelectedChordPacking |
| 5 | |
| 6 | /-! |
| 7 | # The actual selected end has a compact completed chord link |
| 8 | |
| 9 | The missing-end comparison first produces the joint limits and the |
| 10 | source-derived pseudometric. Actual selected-sphere packing then proves |
| 11 | total boundedness and compactness of its standard completion. All |
| 12 | distance-limit and end-germ readouts of the same metric are retained. |
| 13 | Source: Morgan--Tian Lemmas 10.21-10.22 and Corollary 10.28, pp. 259-262; |
| 14 | M28 derivations 152b and 155. |
| 15 | -/ |
| 16 | |
| 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 | universe u |
| 24 | |
| 25 | namespace PoincareMT.M28 |
| 26 | |
| 27 | variable {M : Type u} [TopologicalSpace M] [T2Space M] |
| 28 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] |
| 29 | [IsManifold (𝓡 3) ∞ M] [MeasurableSpace M] [BorelSpace M] [T3Space M] |
| 30 | {g : RiemannianMetric 3 M} {X : Set M} |
| 31 | |
| 32 | /-- The actual original-region geometry produces a chord pseudometric |
| 33 | whose completion is compact, retaining all source-distance and germ |
| 34 | readouts. No chord limit, sphere crossing, packing or link compactness |
| 35 | is an input to this theorem. Source: Corollary 10.28; derivation 155. -/ |
| 36 | theorem exists_compact_selected_end_chord_link |
| 37 | (T : EpsilonTubeCertificate g X) (A : OpenCylinderModel T.carrier) |
| 38 | (U : TopologicalSpace.Opens M) [PreconnectedSpace U] |
| 39 | (hU : (U : Set M) = A.tail true (1 / 2)) |
| 40 | (hA : SmoothSphereIsotopicIn T.carrier A.middleSphere T.cylinder.middleSphere) |
| 41 | (R : M → ℝ) (hR : ContinuousOn R T.carrier) |
| 42 | (hratio : ∀ i ∈ T.chain.shape.active, |
| 43 | ∀ y ∈ (T.chain.neck i).carrier, ∀ z ∈ (T.chain.neck i).carrier, |
| 44 | R y ≤ 2 * R z) |
| 45 | (hdiverge : ∀ B : ℝ, ∃ d : ℝ, 1 / 2 < d ∧ d < 1 ∧ |
| 46 | ∀ x ∈ T.carrier, d < (A.inverse x).2 → B < R x) |
| 47 | (f : M → ℝ) |
| 48 | (hfinite : ∀ p q : U, intrinsicEDist g (U : Set M) (p : M) (q : M) ≠ ⊤) |
| 49 | (D : LeviCivitaData (intrinsicOpenMetric g U)) |
| 50 | (hsec : D.NonnegativeSectionalCurvature) : |
| 51 | letI := intrinsicOpenMetricSpace g U hfinite |
| 52 | ∀ (E : UniformSpace.Completion U) (alpha : ℝ), |
| 53 | E ∉ range ((↑) : U → UniformSpace.Completion U) → 0 < alpha → |
| 54 | (∀ eta : ℝ, 0 < eta → ∃ c : ℝ, 1 / 2 < c ∧ c < 1 ∧ |
| 55 | ∀ x : U, c < (A.inverse x).2 → |
| 56 | dist (x : UniformSpace.Completion U) E < eta) → |
| 57 | (∀ x : U, dist (x : UniformSpace.Completion U) E < alpha → 0 < f x) → |
| 58 | (∀ p q : U, 0 < f p → 0 < f q → |
| 59 | ∃ mu : ℝ → U, mu 0 = p ∧ mu 1 = q ∧ Continuous mu ∧ |
| 60 | (∀ t : ℝ, (3 / 4 : ℝ) ≤ (A.inverse (mu t)).2) ∧ |
| 61 | ∀ s ∈ Icc (0 : ℝ) 1, ∀ t ∈ Icc (0 : ℝ) 1, |
| 62 | (intrinsicOpenMetric g U).edist (mu s) (mu t) = |
| 63 | ENNReal.ofReal |s - t| * (intrinsicOpenMetric g U).edist p q) → |
| 64 | ∃ m : PseudoMetricSpace (MetricEndRay E alpha), |
| 65 | letI := m |
| 66 | TotallyBounded (univ : Set (MetricEndRay E alpha)) ∧ |
| 67 | CompactSpace (UniformSpace.Completion (MetricEndRay E alpha)) ∧ |
| 68 | (∀ P Q : MetricEndRay E alpha, dist P Q ≤ 2) ∧ |
| 69 | (∀ P Q : MetricEndRay E alpha, Tendsto |
| 70 | (fun p : ℝ × ℝ => chordDefect (fun s t => dist (P.point s) (Q.point t)) p.1 p.2) |
| 71 | ((𝓝[>] (0 : ℝ)) ×ˢ (𝓝[>] (0 : ℝ))) (𝓝 (dist P Q ^ 2))) ∧ |
| 72 | (∀ P Q : MetricEndRay E alpha, Tendsto |
| 73 | (fun h : ℝ => dist (P.point h) (Q.point h) / h) |
| 74 | (𝓝[>] (0 : ℝ)) (𝓝 (dist P Q))) ∧ |
| 75 | (∀ P Q : MetricEndRay E alpha, ∀ r s : ℝ, 0 < r → 0 < s → Tendsto |
| 76 | (fun h : ℝ => dist (P.point (h * r)) (Q.point (h * s)) / h) |
| 77 | (𝓝[>] (0 : ℝ)) |
| 78 | (𝓝 (Real.sqrt ((r - s) ^ 2 + r * s * dist P Q ^ 2)))) ∧ |
| 79 | (∀ P Q : MetricEndRay E alpha, ∀ s ∈ Ioo (0 : ℝ) P.length, |
| 80 | ∀ t ∈ Ioo (0 : ℝ) Q.length, |
| 81 | chordDefect (fun u v => dist (P.point u) (Q.point v)) s t ≤ dist P Q ^ 2) ∧ |
| 82 | ∀ P Q : MetricEndRay E alpha, |
| 83 | dist P Q = 0 ↔ MetricEndRay.SameEndGerm P Q := by |
| 84 | let := intrinsicOpenMetricSpace g U hfinite |
| 85 | intro E alpha houtside halpha htail hbarrier hsegments |
| 86 | obtain ⟨K, hK, hupper, hlimit⟩ := exists_selected_end_ray_chord_limits |
| 87 | T A U hU f hfinite D hsec E alpha halpha htail hbarrier hsegments |
| 88 | obtain ⟨m, hm⟩ := exists_metricEndRay_chord_pseudometric E alpha K hK hupper hlimit |
| 89 | refine ⟨m, ?_⟩ |
| 90 | let := m |
| 91 | obtain ⟨hdiam, hjoint, hequal, hfixed, hstrict, hzero⟩ := hm |
| 92 | have htotally := totallyBounded_selected_end_ray_chord T A U hU hA R hR hratio |
| 93 | hdiverge f hfinite E alpha houtside halpha htail hbarrier hsegments m hjoint |
| 94 | exact ⟨htotally, UniformSpace.Completion.compactSpace_of_totallyBounded_univ htotally, |
| 95 | hdiam, hjoint, hequal, hfixed, hstrict, hzero⟩ |
| 96 | |
| 97 | end PoincareMT.M28 |