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.Persistence.CapTopology.NeckCollar |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Analysis.Geometry.LastLevel |
| 4 | |
| 5 | /-! |
| 6 | # The actual old-end sign of a first-exit path |
| 7 | |
| 8 | Morgan--Tian, Proposition A.11 and the frontier extension in Appendix A, |
| 9 | pp. 503--507. A compact coordinate slab misses the actual first exit. |
| 10 | Continuity and connectedness place the final path suffix in one old end. |
| 11 | Last-level selection then keeps that same signed end on the whole retained |
| 12 | suffix. The old coordinate inverse is never used at the outside endpoint. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open Set Filter |
| 18 | open scoped Manifold ContDiff Topology |
| 19 | |
| 20 | universe u |
| 21 | |
| 22 | namespace PoincareMT.M28 |
| 23 | |
| 24 | variable {M : Type u} [TopologicalSpace M] [T2Space M] |
| 25 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] |
| 26 | [IsManifold (𝓡 3) ∞ M] {g : RiemannianMetric 3 M} |
| 27 | |
| 28 | /-- An actual first-exit path selects one signed old-neck end and a last |
| 29 | prescribed interior level. Its entire later half-open suffix stays above |
| 30 | that signed level; no tail orientation or end correspondence is assumed. -/ |
| 31 | theorem exists_signed_level_before_neck_exit (N : EpsilonNeck g) |
| 32 | {γ : ℝ → M} {s c b : ℝ} (hsc : s < c) |
| 33 | (hγ : ContinuousOn γ (Icc s c)) (hγs : γ s = N.center) |
| 34 | (hinside : MapsTo γ (Ico s c) N.carrier) (hout : γ c ∉ N.carrier) |
| 35 | (hbpos : 0 < b) (hb : b < N.epsilon⁻¹) : |
| 36 | ∃ sigma : ℝ, (sigma = 1 ∨ sigma = -1) ∧ |
| 37 | ∃ v ∈ Ioo s c, |
| 38 | sigma * (N.coordinate_inverse (γ v)).2 = b ∧ |
| 39 | ∀ t ∈ Ioo v c, b < sigma * (N.coordinate_inverse (γ t)).2 := by |
| 40 | let K : Set M := N.coordinate_map '' (univ ×ˢ Icc (-b) b) |
| 41 | have hK : IsCompact K := N.isCompact_coordinate_slab_intrinsic |
| 42 | (by linarith) hb |
| 43 | have hKsub : K ⊆ N.carrier := N.coordinate_slab_subset_carrier_m28 (by linarith) hb |
| 44 | have hKout : γ c ∈ Kᶜ := fun h => hout (hKsub h) |
| 45 | have hnhds : γ ⁻¹' Kᶜ ∈ 𝓝[Icc s c] c := |
| 46 | (hγ c (right_mem_Icc.mpr hsc.le)).preimage_mem_nhdsWithin |
| 47 | (hK.isClosed.isOpen_compl.mem_nhds hKout) |
| 48 | obtain ⟨delta, hdelta, hball⟩ := Metric.mem_nhdsWithin_iff.mp hnhds |
| 49 | obtain ⟨u, hu, huc⟩ := exists_between |
| 50 | (show max s (c - delta) < c from max_lt hsc (by linarith)) |
| 51 | have hsu : s < u := (le_max_left _ _).trans_lt hu |
| 52 | have hdu : c - u < delta := by |
| 53 | have h := (le_max_right s (c - delta)).trans_lt hu |
| 54 | linarith |
| 55 | have havoid (t : ℝ) (ht : t ∈ Ico u c) : γ t ∉ K := by |
| 56 | apply hball |
| 57 | refine ⟨?_, ⟨hsu.le.trans ht.1, ht.2.le⟩⟩ |
| 58 | rw [Metric.mem_ball, Real.dist_eq, abs_of_nonpos (sub_nonpos.mpr ht.2.le)] |
| 59 | linarith [ht.1] |
| 60 | let axis : ℝ → ℝ := fun t => (N.coordinate_inverse (γ t)).2 |
| 61 | have haxis : ContinuousOn axis (Ico s c) := |
| 62 | continuous_snd.comp_continuousOn |
| 63 | (N.coordinate_inverse_smooth.continuousOn.comp |
| 64 | (hγ.mono Ico_subset_Icc_self) hinside) |
| 65 | have habs (t : ℝ) (ht : t ∈ Ico u c) : b < |axis t| := by |
| 66 | by_contra h |
| 67 | have hle : |axis t| ≤ b := le_of_not_gt h |
| 68 | apply havoid t ht |
| 69 | refine ⟨N.coordinate_inverse (γ t), ⟨mem_univ _, ?_⟩, |
| 70 | N.coordinate_map_coordinate_inverse (hinside ⟨hsu.le.trans ht.1, ht.2⟩)⟩ |
| 71 | exact abs_le.mp hle |
| 72 | have hne (t : ℝ) (ht : t ∈ Ico u c) : axis t ≠ 0 := by |
| 73 | have h := habs t ht |
| 74 | intro heq |
| 75 | rw [heq, abs_zero] at h |
| 76 | exact (not_lt_of_ge hbpos.le) h |
| 77 | have hsign : ∃ sigma : ℝ, (sigma = 1 ∨ sigma = -1) ∧ |
| 78 | ∀ t ∈ Ico u c, b < sigma * axis t := by |
| 79 | rcases isPreconnected_Ico.mapsTo_Ioi_or_Iio |
| 80 | (haxis.mono (Ico_subset_Ico_left hsu.le)) hne with hpos | hneg |
| 81 | · refine ⟨1, Or.inl rfl, ?_⟩ |
| 82 | intro t ht |
| 83 | simpa only [one_mul, abs_of_pos (show 0 < axis t from hpos ht)] using habs t ht |
| 84 | · refine ⟨-1, Or.inr rfl, ?_⟩ |
| 85 | intro t ht |
| 86 | simpa only [neg_one_mul, abs_of_neg (show axis t < 0 from hneg ht)] using habs t ht |
| 87 | obtain ⟨sigma, hsigma, hlate⟩ := hsign |
| 88 | have hzero : axis s = 0 := by |
| 89 | dsimp only [axis] |
| 90 | rw [hγs] |
| 91 | exact (N.mem_central_sphere_iff_of_mem_carrier |
| 92 | (N.central_sphere_subset N.center_on_central_sphere)).mp N.center_on_central_sphere |
| 93 | have htest : ContinuousOn (fun t => sigma * axis t) (Icc s u) := |
| 94 | continuousOn_const.mul (haxis.mono |
| 95 | (fun t ht => ⟨ht.1, ht.2.trans_lt huc⟩)) |
| 96 | obtain ⟨v, hv, hlevel, habove⟩ := exists_last_eq_of_continuousOn hsu.le htest |
| 97 | (show sigma * axis s ≤ b by simpa only [hzero, mul_zero] using hbpos.le) |
| 98 | (hlate u ⟨le_rfl, huc⟩) |
| 99 | have hsv : s < v := lt_of_le_of_ne hv.1 (by |
| 100 | intro heq |
| 101 | subst v |
| 102 | have hbzero : b = 0 := hlevel.symm.trans (by rw [hzero, mul_zero]) |
| 103 | exact hbpos.ne' hbzero) |
| 104 | refine ⟨sigma, hsigma, v, ⟨hsv, hv.2.trans_lt huc⟩, hlevel, ?_⟩ |
| 105 | intro t ht |
| 106 | by_cases htu : t ≤ u |
| 107 | · exact habove t ⟨ht.1, htu⟩ |
| 108 | · exact hlate t ⟨(lt_of_not_ge htu).le, ht.2⟩ |
| 109 | |
| 110 | end PoincareMT.M28 |