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.Topology.Gluing.Basic |
| 2 | import Mathlib.Geometry.Manifold.ChartedSpace |
| 3 | |
| 4 | /-! |
| 5 | Adapted from AxelWorkspace revision `f1cdb30cabdc8781d2d3dec86d3d99ab1820f30e`, |
| 6 | `MorganTianLib/Ch05/FiniteGaussianQuotient/Charts.lean`. |
| 7 | See `references/analysis/axel-workspace/chart-gluing-reuse.md` for provenance. |
| 8 | -/ |
| 9 | |
| 10 | |
| 11 | open Set Topology |
| 12 | |
| 13 | namespace Poincare.Gluing |
| 14 | |
| 15 | universe u v |
| 16 | |
| 17 | noncomputable section |
| 18 | |
| 19 | variable {I : Type u} {E : Type v} [TopologicalSpace E] |
| 20 | |
| 21 | /-! Charts on a quotient obtained by gluing open subsets of one model space. -/ |
| 22 | |
| 23 | variable (U : I → Set E) (hU : ∀ i, IsOpen (U i)) |
| 24 | |
| 25 | abbrev Piece (i : I) := U i |
| 26 | |
| 27 | instance pieceTopologicalSpace (i : I) : TopologicalSpace (Piece U i) := |
| 28 | inferInstance |
| 29 | |
| 30 | def quotientChart (D : OverlapSystem (fun i => Piece U i)) (i : I) |
| 31 | [Nonempty (Piece U i)] [Nonempty E] : |
| 32 | OpenPartialHomeomorph (Quotient D.setoid) E := |
| 33 | ((hU i).isOpenEmbedding_subtypeVal.toOpenPartialHomeomorph).lift_openEmbedding |
| 34 | (D.include_isOpenEmbedding i) |
| 35 | |
| 36 | theorem quotientChart_apply (D : OverlapSystem (fun i => Piece U i)) (i : I) |
| 37 | [Nonempty (Piece U i)] [Nonempty E] (x : Piece U i) : |
| 38 | quotientChart U hU D i (D.include i x) = (x : E) := by |
| 39 | simpa [quotientChart] using |
| 40 | (OpenPartialHomeomorph.lift_openEmbedding_apply |
| 41 | ((hU i).isOpenEmbedding_subtypeVal.toOpenPartialHomeomorph) |
| 42 | (D.include_isOpenEmbedding i) (x := x)) |
| 43 | |
| 44 | theorem quotientChart_source (D : OverlapSystem (fun i => Piece U i)) (i : I) |
| 45 | [Nonempty (Piece U i)] [Nonempty E] : |
| 46 | (quotientChart U hU D i).source = |
| 47 | D.include i '' Set.univ := by |
| 48 | simp [quotientChart] |
| 49 | |
| 50 | theorem quotientChart_target (D : OverlapSystem (fun i => Piece U i)) (i : I) |
| 51 | [Nonempty (Piece U i)] [Nonempty E] : |
| 52 | (quotientChart U hU D i).target = U i := by |
| 53 | simp [quotientChart] |
| 54 | |
| 55 | theorem quotientChart_symm_apply (D : OverlapSystem (fun i => Piece U i)) (i : I) |
| 56 | [Nonempty (Piece U i)] [Nonempty E] {x : E} (hx : x ∈ U i) : |
| 57 | (quotientChart U hU D i).symm x = D.include i ⟨x, hx⟩ := by |
| 58 | rw [quotientChart, OpenPartialHomeomorph.lift_openEmbedding_symm] |
| 59 | change D.include i ((hU i).isOpenEmbedding_subtypeVal.toOpenPartialHomeomorph.symm x) = _ |
| 60 | congr 1 |
| 61 | apply Subtype.ext |
| 62 | exact (Topology.IsOpenEmbedding.toOpenPartialHomeomorph_right_inv |
| 63 | (f := (Subtype.val : Piece U i → E)) |
| 64 | (h := (hU i).isOpenEmbedding_subtypeVal) (x := x) |
| 65 | ⟨⟨x, hx⟩, rfl⟩) |
| 66 | |
| 67 | theorem quotientChart_comp_mem_transition_source |
| 68 | (D : OverlapSystem (fun i => Piece U i)) (i j : I) |
| 69 | [Nonempty (Piece U i)] [Nonempty (Piece U j)] [Nonempty E] {x : E} |
| 70 | (hx : x ∈ |
| 71 | ((quotientChart U hU D i).symm.trans (quotientChart U hU D j)).source) : |
| 72 | ((hU i).isOpenEmbedding_subtypeVal.toOpenPartialHomeomorph.symm x) ∈ |
| 73 | (D.transition i j).source := by |
| 74 | rw [OpenPartialHomeomorph.trans_source] at hx |
| 75 | have hxi : x ∈ U i := by |
| 76 | rw [← quotientChart_target U hU D i] |
| 77 | exact hx.1 |
| 78 | have hqj : (quotientChart U hU D i).symm x ∈ |
| 79 | (quotientChart U hU D j).source := hx.2 |
| 80 | rw [quotientChart_source U hU D j] at hqj |
| 81 | rcases hqj with ⟨yj, _, hyj⟩ |
| 82 | have hsub : |
| 83 | (hU i).isOpenEmbedding_subtypeVal.toOpenPartialHomeomorph.symm x = |
| 84 | (⟨x, hxi⟩ : Piece U i) := by |
| 85 | apply Subtype.ext |
| 86 | exact (Topology.IsOpenEmbedding.toOpenPartialHomeomorph_right_inv |
| 87 | (f := (Subtype.val : Piece U i → E)) |
| 88 | (h := (hU i).isOpenEmbedding_subtypeVal) (x := x) |
| 89 | ⟨⟨x, hxi⟩, rfl⟩) |
| 90 | have heq : D.include i |
| 91 | ((hU i).isOpenEmbedding_subtypeVal.toOpenPartialHomeomorph.symm x) = |
| 92 | D.include j yj := by |
| 93 | rw [hsub, ← quotientChart_symm_apply U hU D i hxi] |
| 94 | exact hyj.symm |
| 95 | exact (D.include_eq_iff i j _ _).mp heq |>.1 |
| 96 | |
| 97 | theorem quotientChart_comp_apply |
| 98 | (D : OverlapSystem (fun i => Piece U i)) (i j : I) |
| 99 | [Nonempty (Piece U i)] [Nonempty (Piece U j)] [Nonempty E] {x : E} |
| 100 | (hx : x ∈ |
| 101 | ((quotientChart U hU D i).symm.trans (quotientChart U hU D j)).source) : |
| 102 | ((quotientChart U hU D i).symm.trans (quotientChart U hU D j)) x = |
| 103 | ((D.transition i j |
| 104 | ((hU i).isOpenEmbedding_subtypeVal.toOpenPartialHomeomorph.symm x) : |
| 105 | Piece U j) : E) := by |
| 106 | have hxi : x ∈ U i := by |
| 107 | rw [← quotientChart_target U hU D i] |
| 108 | exact (by |
| 109 | rw [OpenPartialHomeomorph.trans_source] at hx |
| 110 | exact hx.1) |
| 111 | have hsrc := quotientChart_comp_mem_transition_source U hU D i j hx |
| 112 | have hsub : |
| 113 | (hU i).isOpenEmbedding_subtypeVal.toOpenPartialHomeomorph.symm x = |
| 114 | (⟨x, hxi⟩ : Piece U i) := by |
| 115 | apply Subtype.ext |
| 116 | exact (Topology.IsOpenEmbedding.toOpenPartialHomeomorph_right_inv |
| 117 | (f := (Subtype.val : Piece U i → E)) |
| 118 | (h := (hU i).isOpenEmbedding_subtypeVal) (x := x) |
| 119 | ⟨⟨x, hxi⟩, rfl⟩) |
| 120 | rw [OpenPartialHomeomorph.trans_apply] |
| 121 | rw [quotientChart_symm_apply U hU D i hxi] |
| 122 | rw [← hsub] |
| 123 | have hq := (D.include_eq_iff i j _ _).mpr ⟨hsrc, rfl⟩ |
| 124 | rw [hq] |
| 125 | exact quotientChart_apply U hU D j (D.transition i j _) |
| 126 | |
| 127 | theorem quotientChart_source_cover (D : OverlapSystem (fun i => Piece U i)) |
| 128 | [∀ i, Nonempty (Piece U i)] [Nonempty E] : |
| 129 | (⋃ i, (quotientChart U hU D i).source) = Set.univ := by |
| 130 | apply Set.eq_univ_of_forall |
| 131 | intro q |
| 132 | induction q using Quotient.inductionOn with |
| 133 | | h a => |
| 134 | rcases a with ⟨i, x⟩ |
| 135 | refine Set.mem_iUnion.mpr ⟨i, ?_⟩ |
| 136 | rw [quotientChart_source U hU D i] |
| 137 | change D.include i x ∈ D.include i '' (Set.univ : Set (Piece U i)) |
| 138 | exact ⟨x, Set.mem_univ _, rfl⟩ |
| 139 | |
| 140 | @[implicit_reducible] |
| 141 | def quotientChartedSpace (D : OverlapSystem (fun i => Piece U i)) |
| 142 | [∀ i, Nonempty (Piece U i)] [Nonempty E] : |
| 143 | ChartedSpace E (Quotient D.setoid) := by |
| 144 | let charts : I → OpenPartialHomeomorph (Quotient D.setoid) E := |
| 145 | fun i => quotientChart U hU D i |
| 146 | have hcover : ∀ q : Quotient D.setoid, ∃ i : I, q ∈ (charts i).source := by |
| 147 | intro q |
| 148 | have hq : q ∈ ⋃ i, (charts i).source := by |
| 149 | rw [quotientChart_source_cover U hU D] |
| 150 | exact Set.mem_univ q |
| 151 | rcases Set.mem_iUnion.mp hq with ⟨i, hi⟩ |
| 152 | exact ⟨i, hi⟩ |
| 153 | let indexAt : Quotient D.setoid → I := fun q => Classical.choose (hcover q) |
| 154 | refine { |
| 155 | atlas := Set.range charts |
| 156 | chartAt := fun q => charts (indexAt q) |
| 157 | mem_chart_source := fun q => Classical.choose_spec (hcover q) |
| 158 | chart_mem_atlas := fun q => ⟨indexAt q, rfl⟩ } |
| 159 | |
| 160 | theorem quotientChart_overlap_apply (D : OverlapSystem (fun i => Piece U i)) |
| 161 | (i j : I) [Nonempty (Piece U i)] [Nonempty (Piece U j)] [Nonempty E] |
| 162 | (x : Piece U i) (hx : x ∈ (D.transition i j).source) : |
| 163 | quotientChart U hU D j (D.include i x) = |
| 164 | ((D.transition i j x : Piece U j) : E) := by |
| 165 | have hq : D.include i x = D.include j (D.transition i j x) := |
| 166 | (D.include_eq_iff i j x (D.transition i j x)).mpr ⟨hx, rfl⟩ |
| 167 | rw [hq] |
| 168 | exact quotientChart_apply U hU D j (D.transition i j x) |
| 169 | |
| 170 | end |
| 171 | |
| 172 | end Poincare.Gluing |