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.Limits.SelectedInteriorWall |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.Cylinders.CylinderSphereCrossings |
| 4 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.IntrinsicGeometry.IntrinsicMetricSpace |
| 5 | import PoincareLib.Topology.Manifold.NeckCap.Isotopy.Composition |
| 6 | import Mathlib.Topology.MetricSpace.Completion |
| 7 | import Mathlib.Topology.Order.Compact |
| 8 | |
| 9 | /-! |
| 10 | # Actual end rays cross literal selected spheres |
| 11 | |
| 12 | Positive completion radius on compact original-cylinder slabs converts |
| 13 | small radius into high cylinder height. The selected isotopy then gives |
| 14 | a genuine signed-height crossing, with the original recut metric fixed. |
| 15 | Source: Morgan--Tian Lemma 10.27, p. 261; M28 derivation 155. |
| 16 | -/ |
| 17 | |
| 18 | set_option autoImplicit false |
| 19 | set_option backward.isDefEq.respectTransparency false |
| 20 | |
| 21 | open Set |
| 22 | open scoped Manifold ContDiff Bundle Topology ENNReal |
| 23 | |
| 24 | universe u |
| 25 | |
| 26 | namespace PoincareMT.M28 |
| 27 | |
| 28 | variable {M : Type u} [TopologicalSpace M] [T2Space M] |
| 29 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] |
| 30 | [IsManifold (𝓡 3) ∞ M] {g : RiemannianMetric 3 M} {X : Set M} |
| 31 | |
| 32 | /-- Above a fixed lower height, sufficiently small actual completion |
| 33 | radius forces any prescribed higher cylinder level. The threshold is |
| 34 | uniform over all points, before a ray is chosen. Derivation 155. -/ |
| 35 | theorem exists_completion_radius_threshold_for_cylinder_height |
| 36 | (T : EpsilonTubeCertificate g X) (A : OpenCylinderModel T.carrier) |
| 37 | (U : TopologicalSpace.Opens M) (hU : (U : Set M) = A.tail true (1 / 2)) |
| 38 | (hfinite : ∀ p q : U, intrinsicEDist g (U : Set M) (p : M) (q : M) ≠ ⊤) : |
| 39 | letI := intrinsicOpenMetricSpace g U hfinite |
| 40 | ∀ E : UniformSpace.Completion U, |
| 41 | E ∉ range ((↑) : U → UniformSpace.Completion U) → |
| 42 | ∀ c : ℝ, c < 1 → ∃ eta : ℝ, 0 < eta ∧ |
| 43 | ∀ x : U, (3 / 4 : ℝ) ≤ (A.inverse x).2 → |
| 44 | dist (x : UniformSpace.Completion U) E < eta → c < (A.inverse x).2 := by |
| 45 | let := intrinsicOpenMetricSpace g U hfinite |
| 46 | intro E houtside c hc |
| 47 | let r : U → ℝ := fun x => dist (x : UniformSpace.Completion U) E |
| 48 | have hr : Continuous r := |
| 49 | (UniformSpace.Completion.continuous_coe U).dist continuous_const |
| 50 | have hrpos (x : U) : 0 < r x := |
| 51 | dist_pos.mpr fun hx => houtside ⟨x, hx⟩ |
| 52 | let d : ℝ := max c (3 / 4 : ℝ) |
| 53 | have hd1 : d < 1 := max_lt hc (by norm_num) |
| 54 | have hKU : A.compactSlab (3 / 4) d ⊆ (U : Set M) := by |
| 55 | intro x hx |
| 56 | have hh := (A.mem_compactSlab_iff (by norm_num) hd1).mp hx |
| 57 | rw [hU] |
| 58 | exact (A.mem_tail_iff_m28 true (by norm_num) (by norm_num)).mpr |
| 59 | ⟨hh.1, (by norm_num : (1 / 2 : ℝ) < 3 / 4).trans_le hh.2.1⟩ |
| 60 | let K : Set U := (Subtype.val : U → M) ⁻¹' A.compactSlab (3 / 4) d |
| 61 | have hK : IsCompact K := |
| 62 | Topology.IsEmbedding.subtypeVal.isInducing.isCompact_preimage' |
| 63 | (A.isCompact_compactSlab (by norm_num) hd1) |
| 64 | (fun x hx => ⟨⟨x, hKU hx⟩, rfl⟩) |
| 65 | have hUV : (U : Set M) ⊆ T.carrier := by |
| 66 | rw [hU] |
| 67 | exact A.tail_subset_m28 true (by norm_num) (by norm_num) |
| 68 | have hmem (x : U) (hlo : (3 / 4 : ℝ) ≤ (A.inverse x).2) |
| 69 | (hhi : (A.inverse x).2 ≤ c) : x ∈ K := |
| 70 | (A.mem_compactSlab_iff (by norm_num) hd1).mpr |
| 71 | ⟨hUV x.property, hlo, hhi.trans (le_max_left _ _)⟩ |
| 72 | rcases K.eq_empty_or_nonempty with hEmpty | hNonempty |
| 73 | · refine ⟨1, zero_lt_one, ?_⟩ |
| 74 | intro x hlo _hradius |
| 75 | apply lt_of_not_ge |
| 76 | intro hhi |
| 77 | have hx := hmem x hlo hhi |
| 78 | simp only [hEmpty, mem_empty_iff_false] at hx |
| 79 | · obtain ⟨z, _hz, hmin⟩ := hK.exists_isMinOn hNonempty hr.continuousOn |
| 80 | refine ⟨r z, hrpos z, ?_⟩ |
| 81 | intro x hlo hradius |
| 82 | apply lt_of_not_ge |
| 83 | intro hhi |
| 84 | exact (not_le_of_gt hradius) (hmin (hmem x hlo hhi)) |
| 85 | |
| 86 | /-- The existing same-wall segment provider also bounds every point of |
| 87 | the small-radius sublevel below in height: test the pair `(x,x)`. |
| 88 | No additional field on ray data is needed. Derivation 155. -/ |
| 89 | theorem cylinder_height_ge_threeQuarter_of_radius_barrier |
| 90 | (T : EpsilonTubeCertificate g X) (A : OpenCylinderModel T.carrier) |
| 91 | (U : TopologicalSpace.Opens M) (f : M → ℝ) |
| 92 | (hfinite : ∀ p q : U, intrinsicEDist g (U : Set M) (p : M) (q : M) ≠ ⊤) : |
| 93 | letI := intrinsicOpenMetricSpace g U hfinite |
| 94 | ∀ (E : UniformSpace.Completion U) (alpha : ℝ), |
| 95 | (∀ x : U, dist (x : UniformSpace.Completion U) E < alpha → 0 < f x) → |
| 96 | (∀ p q : U, 0 < f p → 0 < f q → |
| 97 | ∃ mu : ℝ → U, mu 0 = p ∧ mu 1 = q ∧ Continuous mu ∧ |
| 98 | (∀ t : ℝ, (3 / 4 : ℝ) ≤ (A.inverse (mu t)).2) ∧ |
| 99 | ∀ s ∈ Icc (0 : ℝ) 1, ∀ t ∈ Icc (0 : ℝ) 1, |
| 100 | (intrinsicOpenMetric g U).edist (mu s) (mu t) = |
| 101 | ENNReal.ofReal |s - t| * (intrinsicOpenMetric g U).edist p q) → |
| 102 | ∀ x : U, dist (x : UniformSpace.Completion U) E < alpha → |
| 103 | (3 / 4 : ℝ) ≤ (A.inverse x).2 := by |
| 104 | let := intrinsicOpenMetricSpace g U hfinite |
| 105 | intro E alpha hbarrier hsegments x hx |
| 106 | obtain ⟨mu, h0, _h1, _hcontinuous, hlower, _hmetric⟩ := |
| 107 | hsegments x x (hbarrier x hx) (hbarrier x hx) |
| 108 | simpa only [h0] using hlower 0 |
| 109 | |
| 110 | /-- An inward ray starting below a whole selected neck crosses that |
| 111 | literal central sphere before its missing endpoint. Compact slab radius |
| 112 | minima produce the high-end test point. Source: Lemma 10.27, p. 261; |
| 113 | M28 derivation 155, also used by the scale-ratio argument. -/ |
| 114 | theorem exists_inward_ray_crossing_selected_sphere |
| 115 | (T : EpsilonTubeCertificate g X) (A : OpenCylinderModel T.carrier) |
| 116 | (U : TopologicalSpace.Opens M) (hU : (U : Set M) = A.tail true (1 / 2)) |
| 117 | (hA : SmoothSphereIsotopicIn T.carrier A.middleSphere T.cylinder.middleSphere) |
| 118 | (i : ℤ) (hi : i ∈ T.chain.shape.active) |
| 119 | {c : ℝ} (hc : 1 / 2 < c) (hc1 : c < 1) |
| 120 | (hN : (T.chain.neck i).carrier ⊆ A.tail true c) |
| 121 | (hfinite : ∀ p q : U, intrinsicEDist g (U : Set M) (p : M) (q : M) ≠ ⊤) : |
| 122 | letI := intrinsicOpenMetricSpace g U hfinite |
| 123 | ∀ E : UniformSpace.Completion U, |
| 124 | E ∉ range ((↑) : U → UniformSpace.Completion U) → |
| 125 | ∀ (a : ℝ), 0 < a → ∀ gamma : ℝ → U, |
| 126 | ContinuousOn gamma (Ico (0 : ℝ) a) → |
| 127 | (∀ t ∈ Ico (0 : ℝ) a, (3 / 4 : ℝ) ≤ (A.inverse (gamma t)).2) → |
| 128 | (∀ t ∈ Ico (0 : ℝ) a, |
| 129 | dist (gamma t : UniformSpace.Completion U) E = a - t) → |
| 130 | (A.inverse (gamma 0)).2 < c → |
| 131 | ∃ t ∈ Ioo (0 : ℝ) a, (gamma t : M) ∈ (T.chain.neck i).central_sphere := by |
| 132 | let := intrinsicOpenMetricSpace g U hfinite |
| 133 | intro E houtside a ha gamma hgamma hlower hradius hstart |
| 134 | have hUV : (U : Set M) ⊆ T.carrier := by |
| 135 | rw [hU] |
| 136 | exact A.tail_subset_m28 true (by norm_num) (by norm_num) |
| 137 | let V : TopologicalSpace.Opens M := ⟨T.carrier, T.carrier_open⟩ |
| 138 | obtain ⟨phi, _a0, b0, _ha0, _ha0half, hb0half, hb01, hzero, hread, hside⟩ := |
| 139 | exists_fixed_positive_side_above_cylinder_level (V := V) A (T.chain.neck i) |
| 140 | hc hc1 hN ((T.central_sphere_isotopy i hi).trans hA.symm) |
| 141 | let fN : M → ℝ := ambientCylinderSignedHeight phi |
| 142 | have hnegative : fN (gamma 0) < 0 := by |
| 143 | apply lt_of_not_ge |
| 144 | intro hpos |
| 145 | exact (not_le_of_gt hstart) (hside (gamma 0) (hUV (gamma 0).property) hpos) |
| 146 | obtain ⟨eta, heta, hhigh⟩ := |
| 147 | exists_completion_radius_threshold_for_cylinder_height T A U hU hfinite |
| 148 | E houtside b0 hb01 |
| 149 | let s : ℝ := min (a / 2) (eta / 2) |
| 150 | have hs : 0 < s := lt_min (half_pos ha) (half_pos heta) |
| 151 | have hsa : s < a := (min_le_left _ _).trans_lt (half_lt_self ha) |
| 152 | have hseta : s < eta := (min_le_right _ _).trans_lt (half_lt_self heta) |
| 153 | let b : ℝ := a - s |
| 154 | have hb0 : 0 < b := sub_pos.mpr hsa |
| 155 | have hba : b < a := sub_lt_self a hs |
| 156 | have hbmem : b ∈ Ico (0 : ℝ) a := ⟨hb0.le, hba⟩ |
| 157 | have hsmall : dist (gamma b : UniformSpace.Completion U) E < eta := by |
| 158 | rw [hradius b hbmem] |
| 159 | dsimp only [b] |
| 160 | linarith only [hseta] |
| 161 | have hbheight := hhigh (gamma b) (hlower b hbmem) hsmall |
| 162 | have hpositive : 0 < fN (gamma b) := by |
| 163 | rw [show fN (gamma b) = (A.inverse (gamma b)).2 - 1 / 2 from |
| 164 | hread (gamma b) (hUV (gamma b).property) (Or.inr hbheight)] |
| 165 | exact sub_pos.mpr (hb0half.trans hbheight) |
| 166 | have hsub : Icc (0 : ℝ) b ⊆ Ico (0 : ℝ) a := |
| 167 | fun _ ht => ⟨ht.1, ht.2.trans_lt hba⟩ |
| 168 | obtain ⟨t, ht, hS⟩ := exists_sphere_crossing_of_signed_height |
| 169 | (continuousOn_ambientCylinderSignedHeight phi) hzero hb0.le |
| 170 | (continuous_subtype_val.comp_continuousOn (hgamma.mono hsub)) |
| 171 | (fun t (_ : t ∈ Icc (0 : ℝ) b) => hUV (gamma t).property) |
| 172 | hnegative hpositive |
| 173 | exact ⟨t, ⟨ht.1, ht.2.trans hba⟩, hS⟩ |
| 174 | |
| 175 | end PoincareMT.M28 |