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.Cylinders.CylinderSphereCrossings |
| 3 | |
| 4 | /-! |
| 5 | # The actual compact confinement set between selected chain necks |
| 6 | |
| 7 | Morgan--Tian Claim 10.3, printed pp. 248-249. The two actual chain-sphere |
| 8 | isotopies produce ordered heights. Their closed middle region is compact |
| 9 | inside one finite cylinder slab. Adding both actual middle-neck slabs |
| 10 | gives the common K, and every exit has the exact return crossings needed |
| 11 | by endpoint-neck shortening. No end-separation or confinement input is used. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | |
| 16 | open Set |
| 17 | open scoped Manifold ContDiff Bundle Topology |
| 18 | |
| 19 | universe u |
| 20 | |
| 21 | namespace PoincareMT.EpsilonTubeCertificate |
| 22 | |
| 23 | open M28 |
| 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 | /-- Two disjoint actual selected chain necks produce one compact K and |
| 30 | all literal endpoint-sphere return crossings for paths leaving it. |
| 31 | The scalar-separation producer supplies disjointness in Claim 10.3. -/ |
| 32 | theorem exists_chain_neck_confinement (T : EpsilonTubeCertificate g X) |
| 33 | (i j : ℤ) (hi : i ∈ T.chain.shape.active) (hj : j ∈ T.chain.shape.active) |
| 34 | (hdisj : Disjoint (T.chain.neck i).carrier (T.chain.neck j).carrier) : |
| 35 | let N : Bool → EpsilonNeck g := fun b => T.chain.neck (if b then j else i) |
| 36 | ∃ K : Set M, IsCompact K ∧ K ⊆ T.carrier ∧ |
| 37 | ∀ γ : ℝ → M, γ 0 ∈ (N false).central_sphere → γ 1 ∈ (N true).central_sphere → |
| 38 | ContinuousOn γ (Icc (0 : ℝ) 1) → MapsTo γ (Icc (0 : ℝ) 1) T.carrier → |
| 39 | ∀ t ∈ Icc (0 : ℝ) 1, γ t ∉ K → |
| 40 | ∃ (k : Bool) (c d : ℝ), 0 ≤ c ∧ c ≤ t ∧ t ≤ d ∧ d ≤ 1 ∧ |
| 41 | γ c ∈ (N k).central_sphere ∧ γ d ∈ (N k).central_sphere ∧ |
| 42 | γ t ∉ (N k).region (-((N k).epsilon⁻¹ / 2)) ((N k).epsilon⁻¹ / 2) := by |
| 43 | let U : TopologicalSpace.Opens M := ⟨T.carrier, T.carrier_open⟩ |
| 44 | let N₀ := T.chain.neck i |
| 45 | let N₁ := T.chain.neck j |
| 46 | have hN₀ : N₀.carrier ⊆ T.carrier := by |
| 47 | rw [T.carrier_eq_chain_union] |
| 48 | exact subset_iUnion_of_subset ⟨i, hi⟩ Subset.rfl |
| 49 | have hN₁ : N₁.carrier ⊆ T.carrier := by |
| 50 | rw [T.carrier_eq_chain_union] |
| 51 | exact subset_iUnion_of_subset ⟨j, hj⟩ Subset.rfl |
| 52 | have hSdisj : Disjoint N₀.central_sphere N₁.central_sphere := |
| 53 | hdisj.mono N₀.central_sphere_subset N₁.central_sphere_subset |
| 54 | obtain ⟨h₀, h₁, a, b, ha, _, _, hb, hc₀, hc₁, hz₀, hz₁, |
| 55 | hlow, hhigh, horder⟩ := T.cylinder.exists_ordered_isotopic_sphere_heights |
| 56 | (U := U) (T.central_sphere_isotopy i hi) (T.central_sphere_isotopy j hj) hSdisj |
| 57 | have horiented : ∃ f₀ f₁ : M → ℝ, |
| 58 | ContinuousOn f₀ T.carrier ∧ ContinuousOn f₁ T.carrier ∧ |
| 59 | (∀ x ∈ T.carrier, f₀ x = 0 ↔ x ∈ N₀.central_sphere) ∧ |
| 60 | (∀ x ∈ T.carrier, f₁ x = 0 ↔ x ∈ N₁.central_sphere) ∧ |
| 61 | (∀ x ∈ N₁.central_sphere, 0 < f₀ x) ∧ |
| 62 | (∀ x ∈ N₀.central_sphere, f₁ x < 0) ∧ |
| 63 | ∀ x ∈ T.carrier, 0 ≤ f₀ x → f₁ x ≤ 0 → |
| 64 | x ∈ T.cylinder.compactSlab a b := by |
| 65 | rcases horder with horder | horder |
| 66 | · refine ⟨h₀, h₁, hc₀, hc₁, hz₀, hz₁, |
| 67 | fun x hx => horder.1 x (hN₁ (N₁.central_sphere_subset hx)) hx, |
| 68 | fun x hx => horder.2 x (hN₀ (N₀.central_sphere_subset hx)) hx, ?_⟩ |
| 69 | intro x hx hf₀ hf₁ |
| 70 | apply (T.cylinder.mem_compactSlab_iff ha hb).mpr |
| 71 | refine ⟨hx, ?_, ?_⟩ |
| 72 | · exact le_of_not_gt (fun h => (not_lt_of_ge hf₀) (hlow x hx h).1) |
| 73 | · exact le_of_not_gt (fun h => (not_lt_of_ge hf₁) (hhigh x hx h).2) |
| 74 | · refine ⟨fun x => -h₀ x, fun x => -h₁ x, hc₀.neg, hc₁.neg, |
| 75 | fun x hx => by simpa only [neg_eq_zero] using hz₀ x hx, |
| 76 | fun x hx => by simpa only [neg_eq_zero] using hz₁ x hx, |
| 77 | fun x hx => neg_pos.mpr (horder.1 x (hN₁ (N₁.central_sphere_subset hx)) hx), |
| 78 | fun x hx => neg_neg_of_pos (horder.2 x (hN₀ (N₀.central_sphere_subset hx)) hx), ?_⟩ |
| 79 | intro x hx hf₀ hf₁ |
| 80 | apply (T.cylinder.mem_compactSlab_iff ha hb).mpr |
| 81 | refine ⟨hx, ?_, ?_⟩ |
| 82 | · apply le_of_not_gt |
| 83 | intro h |
| 84 | have hh := (hlow x hx h).2 |
| 85 | linarith |
| 86 | · apply le_of_not_gt |
| 87 | intro h |
| 88 | have hh := (hhigh x hx h).1 |
| 89 | linarith |
| 90 | obtain ⟨f₀, f₁, hf₀, hf₁, hzero₀, hzero₁, hother₀, hother₁, hcapture⟩ := horiented |
| 91 | let Slab := T.cylinder.compactSlab a b |
| 92 | have hSlab : IsCompact Slab := T.cylinder.isCompact_compactSlab ha hb |
| 93 | have hSlabU : Slab ⊆ T.carrier := T.cylinder.compactSlab_subset ha hb |
| 94 | let J := Slab ∩ f₀ ⁻¹' Ici (0 : ℝ) |
| 95 | have hJclosed : IsClosed J := |
| 96 | (hf₀.mono hSlabU).preimage_isClosed_of_isClosed hSlab.isClosed isClosed_Ici |
| 97 | have hJ : IsCompact J := hSlab.of_isClosed_subset hJclosed inter_subset_left |
| 98 | have hJU : J ⊆ T.carrier := inter_subset_left.trans hSlabU |
| 99 | let Middle := J ∩ f₁ ⁻¹' Iic (0 : ℝ) |
| 100 | have hMiddleClosed : IsClosed Middle := |
| 101 | (hf₁.mono hJU).preimage_isClosed_of_isClosed hJclosed isClosed_Iic |
| 102 | have hMiddle : IsCompact Middle := hJ.of_isClosed_subset hMiddleClosed inter_subset_left |
| 103 | have hMiddleU : Middle ⊆ T.carrier := inter_subset_left.trans hJU |
| 104 | have hmiddleCapture {x : M} (hx : x ∈ T.carrier) (hx₀ : 0 ≤ f₀ x) (hx₁ : f₁ x ≤ 0) : |
| 105 | x ∈ Middle := ⟨⟨hcapture x hx hx₀ hx₁, hx₀⟩, hx₁⟩ |
| 106 | let D₀ := N₀.coordinate_map '' (univ ×ˢ Icc (-(N₀.epsilon⁻¹ / 2)) (N₀.epsilon⁻¹ / 2)) |
| 107 | let D₁ := N₁.coordinate_map '' (univ ×ˢ Icc (-(N₁.epsilon⁻¹ / 2)) (N₁.epsilon⁻¹ / 2)) |
| 108 | have hA₀ : 0 < N₀.epsilon⁻¹ := inv_pos.mpr N₀.epsilon_pos |
| 109 | have hA₁ : 0 < N₁.epsilon⁻¹ := inv_pos.mpr N₁.epsilon_pos |
| 110 | have hD₀ : IsCompact D₀ := N₀.isCompact_coordinate_slab_intrinsic (by linarith) (by linarith) |
| 111 | have hD₁ : IsCompact D₁ := N₁.isCompact_coordinate_slab_intrinsic (by linarith) (by linarith) |
| 112 | have hD₀U : D₀ ⊆ T.carrier := |
| 113 | (N₀.coordinate_slab_subset_carrier_m28 (by linarith) (by linarith)).trans hN₀ |
| 114 | have hD₁U : D₁ ⊆ T.carrier := |
| 115 | (N₁.coordinate_slab_subset_carrier_m28 (by linarith) (by linarith)).trans hN₁ |
| 116 | have hregion₀ : N₀.region (-(N₀.epsilon⁻¹ / 2)) (N₀.epsilon⁻¹ / 2) ⊆ D₀ := by |
| 117 | intro x hx |
| 118 | exact ⟨N₀.coordinate_inverse x, ⟨mem_univ _, hx.2.1.le, hx.2.2.le⟩, |
| 119 | N₀.coordinate_map_coordinate_inverse hx.1⟩ |
| 120 | have hregion₁ : N₁.region (-(N₁.epsilon⁻¹ / 2)) (N₁.epsilon⁻¹ / 2) ⊆ D₁ := by |
| 121 | intro x hx |
| 122 | exact ⟨N₁.coordinate_inverse x, ⟨mem_univ _, hx.2.1.le, hx.2.2.le⟩, |
| 123 | N₁.coordinate_map_coordinate_inverse hx.1⟩ |
| 124 | let K := (Middle ∪ D₀) ∪ D₁ |
| 125 | refine ⟨K, (hMiddle.union hD₀).union hD₁, |
| 126 | union_subset (union_subset hMiddleU hD₀U) hD₁U, ?_⟩ |
| 127 | intro γ hγ₀ hγ₁ hγ hγU t ht htK |
| 128 | have htMiddle : γ t ∉ Middle := fun hx => htK (Or.inl (Or.inl hx)) |
| 129 | have hexit₀ : γ t ∉ N₀.region (-(N₀.epsilon⁻¹ / 2)) (N₀.epsilon⁻¹ / 2) := |
| 130 | fun hx => htK (Or.inl (Or.inr (hregion₀ hx))) |
| 131 | have hexit₁ : γ t ∉ N₁.region (-(N₁.epsilon⁻¹ / 2)) (N₁.epsilon⁻¹ / 2) := |
| 132 | fun hx => htK (Or.inr (hregion₁ hx)) |
| 133 | by_cases ht₀ : f₀ (γ t) < 0 |
| 134 | · obtain ⟨d, hd, hdsphere⟩ := exists_sphere_return_after_negative_height |
| 135 | hf₀ hzero₀ ht.1 ht.2 hγ hγU ht₀ (hother₀ _ hγ₁) |
| 136 | exact ⟨false, 0, d, le_rfl, ht.1, hd.1.le, hd.2.le, hγ₀, hdsphere, hexit₀⟩ |
| 137 | · have ht₁ : 0 < f₁ (γ t) := by |
| 138 | by_contra h |
| 139 | exact htMiddle (hmiddleCapture (hγU ht) (le_of_not_gt ht₀) (le_of_not_gt h)) |
| 140 | obtain ⟨c, hc, hcsphere⟩ := exists_sphere_hit_before_positive_height |
| 141 | hf₁ hzero₁ ht.1 ht.2 hγ hγU (hother₁ _ hγ₀) ht₁ |
| 142 | exact ⟨true, c, 1, hc.1.le, hc.2.le, ht.2, le_rfl, hcsphere, hγ₁, hexit₁⟩ |
| 143 | |
| 144 | end PoincareMT.EpsilonTubeCertificate |