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.AlgebraicTopology.HomotopyGroup.LoopSpace.Compatibility.ThreeManifoldTopology |
| 2 | import PoincareLib.AlgebraicTopology.HomotopyGroup.LoopSpace.Compatibility.ThreeManifoldTopology |
| 3 | import Mathlib.Topology.Compactness.LocallyCompact |
| 4 | |
| 5 | /-! |
| 6 | # Detecting absolute top homology on compact supports |
| 7 | |
| 8 | This is the chain and relative-sequence step in Hatcher, Proposition 3.29, |
| 9 | printed p. 239. An absolute cycle has finite compact image. An open |
| 10 | neighborhood of that image maps injectively to relative top homology when |
| 11 | the next relative degree vanishes on the intervening compact support. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | |
| 16 | noncomputable section |
| 17 | |
| 18 | open CategoryTheory Limits HomologicalComplex Set |
| 19 | |
| 20 | universe u |
| 21 | |
| 22 | namespace PoincareMT.Proofs.M59 |
| 23 | |
| 24 | open M02.Topology |
| 25 | |
| 26 | variable {X : Type u} [TopologicalSpace X] |
| 27 | |
| 28 | /-- The injection in the relative-sequence diagram of Hatcher Proposition |
| 29 | 3.29, p. 239. The open sets need not cover the ambient space. -/ |
| 30 | theorem integralDisjointToRelativeHomology_mono |
| 31 | (U V : Set X) (hU : IsOpen U) (hV : IsOpen V) (hUV : Disjoint U V) |
| 32 | (n : Nat) (hzero : IsZero (integralRelativeHomology (V ∪ U) (n + 1))) : |
| 33 | Mono (homologyMap (integralSubspaceChains U ≫ integralRelativeProjection V) n) := by |
| 34 | have hempty : (Subtype.val : U → X) ⁻¹' V = ∅ := by |
| 35 | apply eq_empty_iff_forall_notMem.mpr |
| 36 | intro x hx |
| 37 | exact Set.disjoint_left.mp hUV x.property hx |
| 38 | let : IsIso (integralRelativeProjection ((Subtype.val : U → X) ⁻¹' V)) := by |
| 39 | rw [hempty] |
| 40 | exact integralRelativeProjection_empty_isIso |
| 41 | let := integralSumComparison_homology_isIso V U hV hU (n + 1) |
| 42 | have hQ : IsZero ((integralSumQuotient V U).homology (n + 1)) := |
| 43 | hzero.of_iso (asIso (homologyMap (integralSumComparison V U) (n + 1))) |
| 44 | have hS : (ShortComplex.cokernelSequence (integralPairInclusion V U)).ShortExact := { |
| 45 | exact := ShortComplex.cokernelSequence_exact _ |
| 46 | mono_f := integralPairInclusion_mono V U } |
| 47 | let : Mono (homologyMap (integralPairInclusion V U) n) := |
| 48 | (hS.homology_exact₁ (n + 1) n rfl).mono_g (hQ.eq_zero_of_src _) |
| 49 | rw [← integralPairInclusion_projection, homologyMap_comp] |
| 50 | infer_instance |
| 51 | |
| 52 | /-- A cycle supported in a subspace lifts as an actual homology class of that |
| 53 | subspace. Source: the finite-cycle step of Hatcher Proposition 3.29, p. 239. -/ |
| 54 | theorem exists_integralSubspaceHomology_lift (U : Set X) (n : Nat) |
| 55 | (z : (integralChains X).cycles n) |
| 56 | (hz : (integralChains X).iCycles n z ∈ |
| 57 | LinearMap.range ((integralSubspaceChains U).f n).hom) : |
| 58 | ∃ b : integralHomology U n, |
| 59 | homologyMap (integralSubspaceChains U) n b = (integralChains X).homologyπ n z := by |
| 60 | let C := integralChains X |
| 61 | let D := integralChains U |
| 62 | let f := integralSubspaceChains U |
| 63 | obtain ⟨c, hc⟩ := hz |
| 64 | let : Mono f := integralSubspaceChains_mono U |
| 65 | have hd : (D.sc n).g c = 0 := by |
| 66 | apply (ModuleCat.mono_iff_injective (f.f ((ComplexShape.down Nat).next n))).mp |
| 67 | inferInstance |
| 68 | change (f.f _).hom ((D.d n _).hom c) = (f.f _).hom 0 |
| 69 | rw [map_zero] |
| 70 | change f.f _ (D.d n _ c) = 0 |
| 71 | rw [← ConcreteCategory.comp_apply, ← f.comm, ConcreteCategory.comp_apply] |
| 72 | rw [hc] |
| 73 | exact congrArg (fun k => k.hom z) (C.iCycles_d n ((ComplexShape.down Nat).next n)) |
| 74 | let w : D.cycles n := (D.sc n).moduleCatCyclesIso.inv ⟨c, hd⟩ |
| 75 | have hw : D.iCycles n w = c := |
| 76 | congrArg (fun k => k ⟨c, hd⟩) (D.sc n).moduleCatCyclesIso_inv_iCycles |
| 77 | have hcycles : cyclesMap f n w = z := by |
| 78 | apply (ModuleCat.mono_iff_injective (C.iCycles n)).mp inferInstance |
| 79 | rw [← ConcreteCategory.comp_apply, cyclesMap_i, ConcreteCategory.comp_apply, hw] |
| 80 | exact hc |
| 81 | refine ⟨D.homologyπ n w, ?_⟩ |
| 82 | rw [← ConcreteCategory.comp_apply, homologyπ_naturality, ConcreteCategory.comp_apply, |
| 83 | hcycles] |
| 84 | |
| 85 | /-- Every absolute class is represented in an open subset with compact |
| 86 | closure. Source: Hatcher Proposition 3.29, p. 239. -/ |
| 87 | theorem exists_integralHomology_compact_open_lift [T2Space X] [LocallyCompactSpace X] |
| 88 | (n : Nat) (a : integralHomology X n) : |
| 89 | ∃ U : Set X, IsOpen U ∧ IsCompact (closure U) ∧ |
| 90 | ∃ b : integralHomology U n, homologyMap (integralSubspaceChains U) n b = a := by |
| 91 | classical |
| 92 | obtain ⟨z, hz⟩ := (ModuleCat.epi_iff_surjective ((integralChains X).homologyπ n)).mp |
| 93 | inferInstance a |
| 94 | let c := (integralChains X).iCycles n z |
| 95 | let F := (integralChainCoordinates X n c).support |
| 96 | let K : Set X := ⋃ s ∈ F, Set.range s |
| 97 | have hK : IsCompact K := F.isCompact_biUnion (fun s _ => isCompact_range s.continuous) |
| 98 | obtain ⟨L, hL, hKL, _⟩ := exists_compact_between hK isOpen_univ (subset_univ K) |
| 99 | have hclosure : IsCompact (closure (interior L)) := |
| 100 | hL.of_isClosed_subset isClosed_closure (closure_minimal interior_subset hL.isClosed) |
| 101 | have hc : c ∈ LinearMap.range ((integralSubspaceChains (interior L)).f n).hom := by |
| 102 | apply (integral_subspace_range_iff (interior L) n c).mpr |
| 103 | intro s hs x hx |
| 104 | exact hKL (mem_iUnion₂.mpr ⟨s, hs, hx⟩) |
| 105 | obtain ⟨b, hb⟩ := exists_integralSubspaceHomology_lift (interior L) n z hc |
| 106 | exact ⟨interior L, isOpen_interior, hclosure, b, hb.trans hz⟩ |
| 107 | |
| 108 | /-- Restricting an absolute class twice is the actual relative projection. |
| 109 | Source: the naturality square of Hatcher Proposition 3.29, p. 239. -/ |
| 110 | theorem integralToRelativeHomology_restriction {A B : Set X} (hAB : A ⊆ B) |
| 111 | (n : Nat) (a : integralHomology X n) : |
| 112 | homologyMap (integralRelativeRestriction hAB) n (integralToRelativeHomology A n a) = |
| 113 | integralToRelativeHomology B n a := by |
| 114 | rw [← ConcreteCategory.comp_apply, ← homologyMap_comp, |
| 115 | integralRelativeRestriction_projection] |
| 116 | |
| 117 | /-- Compact support detection and next-degree vanishing detect absolute top |
| 118 | homology even when the whole space is noncompact. Source: Hatcher 3.29, p. 239. -/ |
| 119 | theorem integralHomology_eq_zero_of_point_restrictions [T2Space X] [LocallyCompactSpace X] |
| 120 | (n : Nat) |
| 121 | (hupper : ∀ K : Set X, IsCompact K → IsZero (integralSupportHomology K (n + 1))) |
| 122 | (hdet : ∀ K : Set X, IsCompact K → IntegralSupportDetected K n) |
| 123 | (a : integralHomology X n) |
| 124 | (ha : ∀ x : X, integralToRelativeHomology ({x}ᶜ : Set X) n a = 0) : a = 0 := by |
| 125 | obtain ⟨U, hU, hclosure, b, hb⟩ := exists_integralHomology_compact_open_lift n a |
| 126 | let V := (closure U)ᶜ |
| 127 | have hV : IsOpen V := isClosed_closure.isOpen_compl |
| 128 | have hUV : Disjoint U V := Set.disjoint_left.mpr fun _ hx hy => hy (subset_closure hx) |
| 129 | have hcompact : IsCompact (V ∪ U)ᶜ := |
| 130 | hclosure.of_isClosed_subset (hV.union hU).isClosed_compl (by |
| 131 | intro x hx |
| 132 | by_contra h |
| 133 | exact hx (Or.inl h)) |
| 134 | have hzero : IsZero (integralRelativeHomology (V ∪ U) (n + 1)) := by |
| 135 | simpa only [integralSupportHomology, compl_compl] using hupper (V ∪ U)ᶜ hcompact |
| 136 | let := integralDisjointToRelativeHomology_mono U V hU hV hUV n hzero |
| 137 | have hrelative : integralToRelativeHomology V n a = 0 := by |
| 138 | apply hdet (closure U) hclosure |
| 139 | intro x hx |
| 140 | exact (integralToRelativeHomology_restriction |
| 141 | (compl_subset_compl.mpr (singleton_subset_iff.mpr hx)) n a).trans (ha x) |
| 142 | have hbzero : b = 0 := by |
| 143 | apply (ModuleCat.mono_iff_injective |
| 144 | (homologyMap (integralSubspaceChains U ≫ integralRelativeProjection V) n)).mp |
| 145 | inferInstance |
| 146 | rw [map_zero, homologyMap_comp, ConcreteCategory.comp_apply, hb] |
| 147 | exact hrelative |
| 148 | rw [← hb, hbzero, map_zero] |
| 149 | |
| 150 | /-- A finite singular cycle misses a point in a noncompact space, and its |
| 151 | local relative homology class there is zero. Source: Hatcher 3.29, p. 239. -/ |
| 152 | theorem exists_integralHomology_point_restriction_zero |
| 153 | (hnoncompact : ¬IsCompact (univ : Set X)) (n : Nat) (a : integralHomology X n) : |
| 154 | ∃ x : X, integralToRelativeHomology ({x}ᶜ : Set X) n a = 0 := by |
| 155 | classical |
| 156 | let C := integralChains X |
| 157 | obtain ⟨z, hz⟩ := (ModuleCat.epi_iff_surjective (C.homologyπ n)).mp inferInstance a |
| 158 | let c := C.iCycles n z |
| 159 | let F := (integralChainCoordinates X n c).support |
| 160 | let K : Set X := ⋃ s ∈ F, Set.range s |
| 161 | have hK : IsCompact K := F.isCompact_biUnion (fun s _ => isCompact_range s.continuous) |
| 162 | have hproper : K ≠ univ := fun h => hnoncompact (h ▸ hK) |
| 163 | obtain ⟨x, hx⟩ := (Set.ne_univ_iff_exists_notMem K).mp hproper |
| 164 | let P := integralRelativeProjection ({x}ᶜ : Set X) |
| 165 | have hc : P.f n c = 0 := by |
| 166 | apply (integralProjection_eq_zero_iff (integralSubspaceChains ({x}ᶜ : Set X)) n c).mpr |
| 167 | apply (integral_subspace_range_iff ({x}ᶜ : Set X) n c).mpr |
| 168 | intro s hs y hy hyx |
| 169 | exact hx (hyx ▸ mem_iUnion₂.mpr ⟨s, hs, hy⟩) |
| 170 | have hcycles : cyclesMap P n z = 0 := by |
| 171 | apply (ModuleCat.mono_iff_injective ((integralRelativeChains ({x}ᶜ : Set X)).iCycles n)).mp |
| 172 | inferInstance |
| 173 | rw [map_zero, ← ConcreteCategory.comp_apply, cyclesMap_i, ConcreteCategory.comp_apply] |
| 174 | exact hc |
| 175 | refine ⟨x, ?_⟩ |
| 176 | rw [← hz] |
| 177 | change homologyMap P n (C.homologyπ n z) = 0 |
| 178 | rw [← ConcreteCategory.comp_apply, homologyπ_naturality, ConcreteCategory.comp_apply, |
| 179 | hcycles, map_zero] |
| 180 | |
| 181 | end PoincareMT.Proofs.M59 |