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 Mathlib.Topology.Covering.Basic |
| 2 | import Mathlib.Geometry.Manifold.IsManifold.Basic |
| 3 | |
| 4 | /-! |
| 5 | # Manifold structures pulled back through local homeomorphisms |
| 6 | |
| 7 | A local homeomorphism pulls a charted atlas back to its domain. Transition |
| 8 | maps agree with restrictions of the original transitions, so every |
| 9 | restriction-closed structure groupoid, in particular the smooth one, pulls |
| 10 | back as well. Covering maps also preserve the Hausdorff condition. |
| 11 | Source: Hatcher, Section 1.3, printed pp. 63-65; MT Claim 18.16, p. 430. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | |
| 16 | open Set Topology OpenPartialHomeomorph |
| 17 | open scoped Manifold ContDiff |
| 18 | |
| 19 | universe u v w |
| 20 | |
| 21 | namespace IsCoveringMap |
| 22 | |
| 23 | /-- A covering of a Hausdorff base is Hausdorff: separate points in different |
| 24 | fibers downstairs and points in the same fiber by sheets. |
| 25 | Source: Hatcher, Section 1.3, printed pp. 63-65. -/ |
| 26 | theorem t2Space {E : Type u} {X : Type v} [TopologicalSpace E] |
| 27 | [TopologicalSpace X] [T2Space X] {p : E → X} (hp : IsCoveringMap p) : T2Space E where |
| 28 | t2 a b hab := by |
| 29 | by_cases h : p a = p b |
| 30 | · exact hp.isSeparatedMap a b h hab |
| 31 | · obtain ⟨U, V, hU, hV, ha, hb, hUV⟩ := t2_separation h |
| 32 | exact ⟨p ⁻¹' U, p ⁻¹' V, hU.preimage hp.continuous, hV.preimage hp.continuous, |
| 33 | ha, hb, hUV.preimage p⟩ |
| 34 | |
| 35 | end IsCoveringMap |
| 36 | |
| 37 | namespace IsLocalHomeomorph |
| 38 | |
| 39 | variable {E : Type u} {M : Type v} {H : Type w} |
| 40 | [TopologicalSpace E] [TopologicalSpace M] [TopologicalSpace H] |
| 41 | [ChartedSpace H M] {p : E → M} |
| 42 | |
| 43 | /-- Pull back the chart at the image of a point along a local inverse sheet. |
| 44 | Source: Hatcher, Section 1.3, printed pp. 63-65. -/ |
| 45 | noncomputable def pullbackChart (hp : IsLocalHomeomorph p) (a : E) : |
| 46 | OpenPartialHomeomorph E H := |
| 47 | (hp.localInverseAt a).symm.trans (chartAt H (p a)) |
| 48 | |
| 49 | /-- The chosen point lies in the pulled-back chart domain. |
| 50 | Source: Hatcher, Section 1.3, printed pp. 63-65. -/ |
| 51 | theorem mem_pullbackChart_source (hp : IsLocalHomeomorph p) (a : E) : |
| 52 | a ∈ (hp.pullbackChart (H := H) a).source := by |
| 53 | change a ∈ (hp.localInverseAt a).target ∧ |
| 54 | (hp.localInverseAt a).symm a ∈ (chartAt H (p a)).source |
| 55 | simp |
| 56 | |
| 57 | /-- The manifold atlas pulled back along a local homeomorphism. |
| 58 | Source: Hatcher, Section 1.3, printed pp. 63-65. -/ |
| 59 | @[instance_reducible] noncomputable def pullbackChartedSpace (hp : IsLocalHomeomorph p) : |
| 60 | ChartedSpace H E where |
| 61 | atlas := Set.range (hp.pullbackChart (H := H)) |
| 62 | chartAt := hp.pullbackChart |
| 63 | mem_chart_source := hp.mem_pullbackChart_source |
| 64 | chart_mem_atlas a := Set.mem_range_self a |
| 65 | |
| 66 | private theorem pullback_transition |
| 67 | (hp : IsLocalHomeomorph p) (a b : E) : |
| 68 | let T := (hp.pullbackChart (H := H) a).symm.trans (hp.pullbackChart b) |
| 69 | let B := (chartAt H (p a)).symm.trans (chartAt H (p b)) |
| 70 | T.source ⊆ B.source ∧ Set.EqOn B T T.source := by |
| 71 | intro T B |
| 72 | have h (z : H) (hz : z ∈ T.source) : |
| 73 | p ((hp.localInverseAt a) ((chartAt H (p a)).symm z)) = |
| 74 | (chartAt H (p a)).symm z := by |
| 75 | apply hp.apply_localInverseAt_of_mem |
| 76 | exact hz.1.2 |
| 77 | constructor |
| 78 | · intro z hz |
| 79 | refine ⟨hz.1.1, ?_⟩ |
| 80 | change (chartAt H (p a)).symm z ∈ (chartAt H (p b)).source |
| 81 | have hb := hz.2.2 |
| 82 | change (hp.localInverseAt b).symm |
| 83 | ((hp.localInverseAt a) ((chartAt H (p a)).symm z)) ∈ (chartAt H (p b)).source at hb |
| 84 | simpa only [hp.localInverseAt_symm, h z hz] using hb |
| 85 | · intro z hz |
| 86 | change (chartAt H (p b)) ((chartAt H (p a)).symm z) = |
| 87 | (chartAt H (p b)) ((hp.localInverseAt b).symm |
| 88 | ((hp.localInverseAt a) ((chartAt H (p a)).symm z))) |
| 89 | rw [hp.localInverseAt_symm, h z hz] |
| 90 | |
| 91 | /-- Restriction-closed chart compatibility pulls back along local |
| 92 | homeomorphisms. Source: Hatcher, Section 1.3, printed pp. 63-65. -/ |
| 93 | theorem pullback_hasGroupoid (hp : IsLocalHomeomorph p) |
| 94 | (G : StructureGroupoid H) [HasGroupoid M G] [ClosedUnderRestriction G] : |
| 95 | @HasGroupoid H _ E _ (hp.pullbackChartedSpace (H := H)) G := by |
| 96 | let := hp.pullbackChartedSpace (H := H) |
| 97 | constructor |
| 98 | rintro _ _ ⟨a, rfl⟩ ⟨b, rfl⟩ |
| 99 | let T := (hp.pullbackChart (H := H) a).symm.trans (hp.pullbackChart (H := H) b) |
| 100 | have h := hp.pullback_transition (H := H) a b |
| 101 | have hG := G.compatible (chart_mem_atlas H (p a)) (chart_mem_atlas H (p b)) |
| 102 | have ht := G.restr_mem_of_eqOn hG T.open_source h.2 |
| 103 | (inter_subset_left.trans h.1) |
| 104 | change T.restr T.source ∈ G at ht |
| 105 | rw [OpenPartialHomeomorph.restr_eq_of_source_subset (subset_refl T.source)] at ht |
| 106 | exact ht |
| 107 | |
| 108 | /-- A smooth atlas pulls back to a smooth atlas on every covering space. |
| 109 | Source: Hatcher, Section 1.3, printed pp. 63-65; MT Claim 18.16, p. 430. -/ |
| 110 | theorem pullback_isManifold |
| 111 | {𝕜 : Type*} [NontriviallyNormedField 𝕜] |
| 112 | {V : Type*} [NormedAddCommGroup V] [NormedSpace 𝕜 V] |
| 113 | (I : ModelWithCorners 𝕜 V H) (n : ℕ∞ω) [IsManifold I n M] |
| 114 | (hp : IsLocalHomeomorph p) : |
| 115 | @IsManifold 𝕜 _ V _ _ H _ I n E _ (hp.pullbackChartedSpace (H := H)) := by |
| 116 | let := hp.pullbackChartedSpace (H := H) |
| 117 | let := hp.pullback_hasGroupoid (contDiffGroupoid n I) |
| 118 | exact IsManifold.mk' I n E |
| 119 | |
| 120 | end IsLocalHomeomorph |