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.Ends.ChainEndBarrier |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Tube.Local.Geometry.LocalGraphRegions |
| 4 | import Mathlib.Topology.Connected.Clopen |
| 5 | |
| 6 | /-! |
| 7 | # The relative frontier and component below the initial graph |
| 8 | |
| 9 | The first-end chain barrier excludes extra closure points outside the |
| 10 | least-index neck. Its below-graph region is therefore clopen in the actual |
| 11 | tube minus the graph and is a full relative connected component. No ambient |
| 12 | separation is assumed. Source: Morgan--Tian Proposition 10.7, pp. 253-254, |
| 13 | and Appendix A.12, pp. 504-505; M28 derivation 91. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | |
| 18 | open Set |
| 19 | open scoped Manifold ContDiff Topology |
| 20 | |
| 21 | universe u |
| 22 | |
| 23 | namespace PoincareMT |
| 24 | |
| 25 | variable {M : Type u} [TopologicalSpace M] [T2Space M] |
| 26 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] |
| 27 | [IsManifold (𝓡 3) ∞ M] {g : RiemannianMetric 3 M} {X : Set M} |
| 28 | |
| 29 | /-- The graph is the entire additional relative closure of the region |
| 30 | below it in the least-index neck. A uniform upper height strictly inside |
| 31 | the neck excludes additional first-end closure points in the tube. |
| 32 | Source: Proposition 10.7; M28 derivation 91. -/ |
| 33 | theorem EpsilonTubeCertificate.closure_first_belowGraph |
| 34 | (T : EpsilonTubeCertificate g X) {i : ℤ} (hi : IsLeast T.chain.shape.active i) |
| 35 | (f : UnitTwoSphere → ℝ) (hf : Continuous f) |
| 36 | (hdom : ∀ q, f q ∈ Ioo (-(T.chain.neck i).epsilon⁻¹) (T.chain.neck i).epsilon⁻¹) |
| 37 | {c : ℝ} (hc : c < T.epsilon⁻¹) (hbound : ∀ q, f q ≤ c) : |
| 38 | closure ((T.chain.neck i).belowGraph_m28 f) ∩ T.carrier = |
| 39 | (T.chain.neck i).belowGraph_m28 f ∪ |
| 40 | range (fun q => (T.chain.neck i).coordinate_map (q, f q)) := by |
| 41 | let N := T.chain.neck i |
| 42 | have heps : N.epsilon = T.epsilon := T.chain.epsilon_eq i hi.1 |
| 43 | have hNT : N.carrier ⊆ T.carrier := by |
| 44 | intro x hx |
| 45 | rw [T.carrier_eq_chain_union] |
| 46 | exact mem_iUnion.mpr ⟨⟨i, hi.1⟩, hx⟩ |
| 47 | have hregion : N.belowGraph_m28 f ⊆ N.region (-T.epsilon⁻¹) c := by |
| 48 | intro x hx |
| 49 | have hlo := (N.coordinate_inverse_mem x hx.1).2.1 |
| 50 | rw [heps] at hlo |
| 51 | exact ⟨hx.1, hlo, hx.2.trans_le (hbound _)⟩ |
| 52 | ext x |
| 53 | constructor |
| 54 | · intro hx |
| 55 | have hxtube : x ∈ ⋃ j : {j // j ∈ T.chain.shape.active}, |
| 56 | (T.chain.neck j.1).carrier := T.carrier_eq_chain_union ▸ hx.2 |
| 57 | obtain ⟨j, hxj⟩ := mem_iUnion.mp hxtube |
| 58 | have hxN : x ∈ N.carrier := |
| 59 | T.chain.closure_region_inter_later_carrier_subset hi.1 j.2 (hi.2 j.2) hc |
| 60 | ⟨closure_mono hregion hx.1, hxj⟩ |
| 61 | rcases lt_trichotomy (N.coordinate_inverse x).2 (f (N.coordinate_inverse x).1) with |
| 62 | hneg | heq | hpos |
| 63 | · exact Or.inl ⟨hxN, hneg⟩ |
| 64 | · exact Or.inr ((N.mem_coordinate_graph_iff_m28 f hdom).mpr ⟨hxN, heq⟩) |
| 65 | · obtain ⟨y, hypos, hyneg⟩ := mem_closure_iff.mp hx.1 |
| 66 | (N.aboveGraph_m28 f) (N.isOpen_aboveGraph_m28 f hf) ⟨hxN, hpos⟩ |
| 67 | exact False.elim (not_lt_of_ge hyneg.2.le hypos.2) |
| 68 | · rintro (hx | hx) |
| 69 | · exact ⟨subset_closure hx, hNT hx.1⟩ |
| 70 | · obtain ⟨q, rfl⟩ := hx |
| 71 | exact ⟨N.coordinate_graph_mem_closure_belowGraph_m28 f hdom q, |
| 72 | hNT (N.coordinate_map_mem_of_axial _ (hdom q))⟩ |
| 73 | |
| 74 | /-- The actual initial graph is precisely the frontier of its negative |
| 75 | region relative to the tube carrier. Source: Proposition 10.7; |
| 76 | M28 derivation 91. -/ |
| 77 | theorem EpsilonTubeCertificate.frontier_first_belowGraph |
| 78 | (T : EpsilonTubeCertificate g X) {i : ℤ} (hi : IsLeast T.chain.shape.active i) |
| 79 | (f : UnitTwoSphere → ℝ) (hf : Continuous f) |
| 80 | (hdom : ∀ q, f q ∈ Ioo (-(T.chain.neck i).epsilon⁻¹) (T.chain.neck i).epsilon⁻¹) |
| 81 | {c : ℝ} (hc : c < T.epsilon⁻¹) (hbound : ∀ q, f q ≤ c) : |
| 82 | frontier ((T.chain.neck i).belowGraph_m28 f) ∩ T.carrier = |
| 83 | range (fun q => (T.chain.neck i).coordinate_map (q, f q)) := by |
| 84 | let N := T.chain.neck i |
| 85 | have hopen := N.isOpen_belowGraph_m28 f hf |
| 86 | have hclosure := T.closure_first_belowGraph hi f hf hdom hc hbound |
| 87 | ext x |
| 88 | constructor |
| 89 | · intro hx |
| 90 | have hcl : x ∈ closure (N.belowGraph_m28 f) ∩ T.carrier := |
| 91 | ⟨frontier_subset_closure hx.1, hx.2⟩ |
| 92 | have hnot : x ∉ N.belowGraph_m28 f := (hopen.frontier_eq ▸ hx.1).2 |
| 93 | exact (hclosure ▸ hcl).resolve_left hnot |
| 94 | · intro hx |
| 95 | have hcl : x ∈ closure (N.belowGraph_m28 f) ∩ T.carrier := |
| 96 | hclosure.symm ▸ Or.inr hx |
| 97 | have hnot : x ∉ N.belowGraph_m28 f := by |
| 98 | intro hn |
| 99 | have heq := ((N.mem_coordinate_graph_iff_m28 f hdom).mp hx).2 |
| 100 | exact (ne_of_lt hn.2) heq |
| 101 | exact ⟨hopen.frontier_eq.symm ▸ And.intro hcl.1 hnot, hcl.2⟩ |
| 102 | |
| 103 | /-- In the actual tube with the graph removed, the region below the first |
| 104 | graph is both open and closed. The topology is the literal complement |
| 105 | subtype, not the whole ambient slice. Source: M28 derivation 91. -/ |
| 106 | theorem EpsilonTubeCertificate.isClopen_first_belowGraph_complement |
| 107 | (T : EpsilonTubeCertificate g X) {i : ℤ} (hi : IsLeast T.chain.shape.active i) |
| 108 | (f : UnitTwoSphere → ℝ) (hf : Continuous f) |
| 109 | (hdom : ∀ q, f q ∈ Ioo (-(T.chain.neck i).epsilon⁻¹) (T.chain.neck i).epsilon⁻¹) |
| 110 | {c : ℝ} (hc : c < T.epsilon⁻¹) (hbound : ∀ q, f q ≤ c) : |
| 111 | IsClopen ((Subtype.val : |
| 112 | ↥(T.carrier \ range (fun q => (T.chain.neck i).coordinate_map (q, f q))) → M) ⁻¹' |
| 113 | (T.chain.neck i).belowGraph_m28 f) := by |
| 114 | let N := T.chain.neck i |
| 115 | refine ⟨isClosed_of_closure_subset ?_, |
| 116 | (N.isOpen_belowGraph_m28 f hf).preimage continuous_subtype_val⟩ |
| 117 | intro x hx |
| 118 | have hxcl := continuous_subtype_val.closure_preimage_subset (N.belowGraph_m28 f) hx |
| 119 | have hcl : (x : M) ∈ closure (N.belowGraph_m28 f) ∩ T.carrier := ⟨hxcl, x.property.1⟩ |
| 120 | have hmem := (T.closure_first_belowGraph hi f hf hdom hc hbound) ▸ hcl |
| 121 | exact hmem.resolve_right x.property.2 |
| 122 | |
| 123 | /-- The negative graph region is a full connected component of the tube |
| 124 | minus its graph. In particular this entire component lies in the actual |
| 125 | first neck. Source: Proposition 10.7, pp. 253-254; M28 derivation 91. -/ |
| 126 | theorem EpsilonTubeCertificate.connectedComponentIn_first_belowGraph |
| 127 | (T : EpsilonTubeCertificate g X) {i : ℤ} (hi : IsLeast T.chain.shape.active i) |
| 128 | (f : UnitTwoSphere → ℝ) (hf : Continuous f) |
| 129 | (hdom : ∀ q, f q ∈ Ioo (-(T.chain.neck i).epsilon⁻¹) (T.chain.neck i).epsilon⁻¹) |
| 130 | {c : ℝ} (hc : c < T.epsilon⁻¹) (hbound : ∀ q, f q ≤ c) |
| 131 | {x : M} (hx : x ∈ (T.chain.neck i).belowGraph_m28 f) : |
| 132 | connectedComponentIn |
| 133 | (T.carrier \ range (fun q => (T.chain.neck i).coordinate_map (q, f q))) x = |
| 134 | (T.chain.neck i).belowGraph_m28 f := by |
| 135 | let N := T.chain.neck i |
| 136 | let U := T.carrier \ range (fun q => N.coordinate_map (q, f q)) |
| 137 | have hFU : N.belowGraph_m28 f ⊆ U := by |
| 138 | intro y hy |
| 139 | have hcl : y ∈ closure (N.belowGraph_m28 f) ∩ T.carrier := |
| 140 | (T.closure_first_belowGraph hi f hf hdom hc hbound).symm ▸ Or.inl hy |
| 141 | refine ⟨hcl.2, ?_⟩ |
| 142 | intro hgraph |
| 143 | exact (ne_of_lt hy.2) ((N.mem_coordinate_graph_iff_m28 f hdom).mp hgraph).2 |
| 144 | have hclopen := T.isClopen_first_belowGraph_complement hi f hf hdom hc hbound |
| 145 | apply Subset.antisymm |
| 146 | · rw [connectedComponentIn_eq_image (hFU hx)] |
| 147 | rintro y ⟨z, hz, rfl⟩ |
| 148 | exact hclopen.connectedComponent_subset hx hz |
| 149 | · exact (N.isConnected_belowGraph_m28 f hf hdom).isPreconnected.subset_connectedComponentIn hx hFU |
| 150 | |
| 151 | end PoincareMT |