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.Geometry.Manifold.LocalDiffeomorph |
| 2 | import Mathlib.Geometry.Manifold.ContMDiff.Atlas |
| 3 | |
| 4 | /-! |
| 5 | # Pulling back a smooth atlas along a local homeomorphism |
| 6 | |
| 7 | The charts on the source are local branches of the projection followed by |
| 8 | charts on the target. Their transitions restrict the target transitions, |
| 9 | so the projection becomes a local diffeomorphism for the lifted atlas. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | set_option backward.isDefEq.respectTransparency false |
| 14 | |
| 15 | open Set |
| 16 | open scoped Manifold ContDiff |
| 17 | |
| 18 | noncomputable section |
| 19 | |
| 20 | namespace Poincare.Manifold.LocalHomeomorphLift |
| 21 | |
| 22 | variable {H X M : Type*} [TopologicalSpace H] [TopologicalSpace X] |
| 23 | [TopologicalSpace M] [ChartedSpace H M] |
| 24 | {f : X → M} (hf : IsLocalHomeomorph f) |
| 25 | |
| 26 | def localChart (x : X) : OpenPartialHomeomorph X H := |
| 27 | (hf.localInverseAt x).symm.trans (chartAt H (f x)) |
| 28 | |
| 29 | @[reducible] def chartedSpace : ChartedSpace H X where |
| 30 | atlas := range (localChart (H := H) hf) |
| 31 | chartAt := localChart hf |
| 32 | mem_chart_source x := by simp [localChart] |
| 33 | chart_mem_atlas x := ⟨x, rfl⟩ |
| 34 | |
| 35 | theorem localChart_apply (x y : X) : localChart (H := H) hf x y = chartAt H (f x) (f y) := by |
| 36 | simp [localChart] |
| 37 | |
| 38 | theorem projection_localChart_symm (x : X) {z : H} |
| 39 | (hz : z ∈ (localChart (H := H) hf x).target) : |
| 40 | f ((localChart (H := H) hf x).symm z) = (chartAt H (f x)).symm z := by |
| 41 | apply hf.apply_localInverseAt_of_mem |
| 42 | exact hz.2 |
| 43 | |
| 44 | variable {𝕜 E : Type*} [NontriviallyNormedField 𝕜] [NormedAddCommGroup E] |
| 45 | [NormedSpace 𝕜 E] (I : ModelWithCorners 𝕜 E H) (r : ℕ∞ω) |
| 46 | |
| 47 | private theorem contDiffOn_model (a : H) {g : H → H} {s : Set H} |
| 48 | (hg : ContMDiffOn I I r g s) : |
| 49 | ContDiffOn 𝕜 r (I ∘ g ∘ I.symm) (I.symm ⁻¹' s ∩ range I) := by |
| 50 | have hs : s ⊆ (extChartAt I a).source := by simp |
| 51 | have ht : MapsTo g s (extChartAt I a).source := by simp |
| 52 | have h := (contMDiffOn_iff_of_subset_source' hs ht).mp hg |
| 53 | have hset : extChartAt I a '' s = I.symm ⁻¹' s ∩ range I := by |
| 54 | rw [← I.image_eq] |
| 55 | apply Set.image_congr' |
| 56 | intro z |
| 57 | simp only [extChartAt_coe, chartAt_self_eq, OpenPartialHomeomorph.refl_apply, |
| 58 | Function.comp_apply, id_eq] |
| 59 | rw [hset] at h |
| 60 | refine h.congr (fun z _ => ?_) |
| 61 | simp only [Function.comp_apply, extChartAt_coe, extChartAt_coe_symm, chartAt_self_eq, |
| 62 | OpenPartialHomeomorph.refl_symm, OpenPartialHomeomorph.refl_apply, id_eq] |
| 63 | |
| 64 | theorem isManifold [IsManifold I r M] : |
| 65 | letI := chartedSpace (H := H) hf |
| 66 | IsManifold I r X := by |
| 67 | let := chartedSpace (H := H) hf |
| 68 | apply isManifold_of_contDiffOn I r X |
| 69 | rintro _ _ ⟨x, rfl⟩ ⟨y, rfl⟩ |
| 70 | apply contDiffOn_model I r (chartAt H (f x) (f x)) |
| 71 | have hbase : ContMDiffOn I I r |
| 72 | ((chartAt H (f x)).symm.trans (chartAt H (f y))) |
| 73 | ((chartAt H (f x)).symm.trans (chartAt H (f y))).source := |
| 74 | (contMDiffOn_chart (I := I) (x := f y)).comp' |
| 75 | (contMDiffOn_chart_symm (I := I) (x := f x)) |
| 76 | have hsub : ((localChart (H := H) hf x).symm.trans (localChart (H := H) hf y)).source ⊆ |
| 77 | ((chartAt H (f x)).symm.trans (chartAt H (f y))).source := by |
| 78 | intro z hz |
| 79 | refine ⟨hz.1.1, ?_⟩ |
| 80 | have h := hz.2.2 |
| 81 | change (hf.localInverseAt y).symm ((localChart hf x).symm z) ∈ |
| 82 | (chartAt H (f y)).source at h |
| 83 | simp only [hf.localInverseAt_symm, projection_localChart_symm hf x hz.1] at h |
| 84 | exact h |
| 85 | apply (hbase.mono hsub).congr |
| 86 | intro z hz |
| 87 | change (localChart hf y) ((localChart hf x).symm z) = |
| 88 | chartAt H (f y) ((chartAt H (f x)).symm z) |
| 89 | rw [localChart_apply, projection_localChart_symm hf x hz.1] |
| 90 | |
| 91 | /-- The original topological projection is a local diffeomorphism for the lifted atlas. -/ |
| 92 | theorem isLocalDiffeomorph [IsManifold I r M] : |
| 93 | letI := chartedSpace (H := H) hf |
| 94 | IsLocalDiffeomorph I I r f := by |
| 95 | let := chartedSpace (H := H) hf |
| 96 | let := isManifold hf I r |
| 97 | intro x |
| 98 | have hx : localChart (H := H) hf x ∈ IsManifold.maximalAtlas I r X := |
| 99 | IsManifold.subset_maximalAtlas ⟨x, rfl⟩ |
| 100 | have hy : chartAt H (f x) ∈ IsManifold.maximalAtlas I r M := |
| 101 | IsManifold.chart_mem_maximalAtlas (f x) |
| 102 | let dx : PartialDiffeomorph I I X H r := |
| 103 | { toPartialEquiv := (localChart hf x).toPartialEquiv |
| 104 | open_source := (localChart hf x).open_source |
| 105 | open_target := (localChart hf x).open_target |
| 106 | contMDiffOn_toFun := contMDiffOn_of_mem_maximalAtlas hx |
| 107 | contMDiffOn_invFun := contMDiffOn_symm_of_mem_maximalAtlas hx } |
| 108 | let dy : PartialDiffeomorph I I M H r := |
| 109 | { toPartialEquiv := (chartAt H (f x)).toPartialEquiv |
| 110 | open_source := (chartAt H (f x)).open_source |
| 111 | open_target := (chartAt H (f x)).open_target |
| 112 | contMDiffOn_toFun := contMDiffOn_of_mem_maximalAtlas hy |
| 113 | contMDiffOn_invFun := contMDiffOn_symm_of_mem_maximalAtlas hy } |
| 114 | refine ⟨dx.trans dy.symm, ?_, ?_⟩ |
| 115 | · change x ∈ (localChart hf x).source ∧ |
| 116 | localChart hf x x ∈ (chartAt H (f x)).target |
| 117 | constructor |
| 118 | · exact mem_chart_source H x |
| 119 | · rw [localChart_apply] |
| 120 | exact (chartAt H (f x)).map_source (mem_chart_source H (f x)) |
| 121 | · intro y hy |
| 122 | change f y = (chartAt H (f x)).symm (localChart hf x y) |
| 123 | rw [localChart_apply] |
| 124 | apply ((chartAt H (f x)).left_inv _).symm |
| 125 | have h := hy.1.2 |
| 126 | change (hf.localInverseAt x).symm y ∈ (chartAt H (f x)).source at h |
| 127 | simpa only [hf.localInverseAt_symm] using h |
| 128 | |
| 129 | /-- A continuous lift is smooth when its projection is smooth. -/ |
| 130 | theorem contMDiff_of_continuous_projection [IsManifold I r M] {g : X → X} |
| 131 | (hg : Continuous g) : |
| 132 | letI := chartedSpace (H := H) hf |
| 133 | ContMDiff I I r (f ∘ g) → ContMDiff I I r g := by |
| 134 | let := chartedSpace (H := H) hf |
| 135 | let := isManifold hf I r |
| 136 | intro hfg x |
| 137 | let hx := isLocalDiffeomorph hf I r (g x) |
| 138 | have hs := hx.localInverse_contMDiffAt.comp x (hfg x) |
| 139 | apply hs.congr_of_eventuallyEq |
| 140 | filter_upwards [hg.continuousAt.preimage_mem_nhds |
| 141 | (hx.localInverse.open_target.mem_nhds hx.localInverse_mem_target)] with y hy |
| 142 | exact (hx.localInverse_left_inv hy).symm |
| 143 | |
| 144 | end Poincare.Manifold.LocalHomeomorphLift |