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.Manifold.SmoothDomain.HalfSpaceChart |
| 2 | import PoincareLib.Geometry.Manifold.SmoothDomain.RelativeAtlas |
| 3 | import Mathlib.Geometry.Manifold.SmoothEmbedding |
| 4 | |
| 5 | open Set Function |
| 6 | open scoped Topology ContDiff Manifold |
| 7 | |
| 8 | noncomputable section |
| 9 | |
| 10 | /-! Adapted from AxelWorkspace, `MorganTianLib/Foundations/RegularDomain/Embedding.lean`, |
| 11 | revision `f1cdb30cabdc8781d2d3dec86d3d99ab1820f30e`. |
| 12 | See `references/analysis/axel-workspace/regular-domain-reuse.md`. -/ |
| 13 | |
| 14 | namespace Poincare.Manifold |
| 15 | |
| 16 | variable {n : ℕ} {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 17 | [FiniteDimensional ℝ E] {M : Type*} [TopologicalSpace M] |
| 18 | [ChartedSpace E M] [IsManifold 𝓘(ℝ, E) ∞ M] |
| 19 | |
| 20 | /-- Smooth ambient half-space charts give the actual subset a manifold with |
| 21 | boundary structure whose inclusion is a smooth embedding. -/ |
| 22 | theorem exists_smooth_embedding_of_halfspace_charts |
| 23 | (hn : Module.finrank ℝ E = n + 1) (K : Set M) |
| 24 | (amb : K → OpenPartialHomeomorph M (EuclideanSpace ℝ (Fin (n + 1)))) |
| 25 | (hamb : ∀ a : K, (a : M) ∈ (amb a).source ∧ |
| 26 | ContMDiffOn 𝓘(ℝ, E) (𝓡 (n + 1)) ∞ (amb a) (amb a).source ∧ |
| 27 | ContMDiffOn (𝓡 (n + 1)) 𝓘(ℝ, E) ∞ (amb a).symm (amb a).target ∧ |
| 28 | (amb a).IsImage K {y | 0 ≤ y 0}) : |
| 29 | ∃ (CS : ChartedSpace (EuclideanHalfSpace (n + 1)) K) |
| 30 | (rel : K → OpenPartialHomeomorph K (EuclideanHalfSpace (n + 1))) |
| 31 | (hsource : ∀ x : K, x ∈ (rel x).source), |
| 32 | CS = chartedSpaceOfRelativeCharts rel hsource ∧ |
| 33 | @IsManifold ℝ _ (EuclideanSpace ℝ (Fin (n + 1))) _ _ |
| 34 | (EuclideanHalfSpace (n + 1)) _ (𝓡∂ (n + 1)) ∞ K _ CS ∧ |
| 35 | Manifold.IsSmoothEmbedding (𝓡∂ (n + 1)) 𝓘(ℝ, E) ∞ |
| 36 | (fun x : K => (x : M)) := by |
| 37 | let H := EuclideanHalfSpace (n + 1) |
| 38 | let I := 𝓡∂ (n + 1) |
| 39 | let rel : K → OpenPartialHomeomorph K H := fun a => |
| 40 | subtypeRestrictImageOn (amb a) (hamb a).2.2.2 a (hamb a).1 |
| 41 | have hsource (a : K) : a ∈ (rel a).source := by |
| 42 | change a.1 ∈ (amb a).source |
| 43 | exact (hamb a).1 |
| 44 | let CS : ChartedSpace H K := chartedSpaceOfRelativeCharts rel hsource |
| 45 | have hman : @IsManifold ℝ _ (EuclideanSpace ℝ (Fin (n + 1))) _ _ |
| 46 | H _ I ∞ K _ CS := by |
| 47 | letI : ChartedSpace H K := CS |
| 48 | apply isManifold_of_contDiffOn I ∞ K |
| 49 | rintro e e' ⟨a, rfl⟩ ⟨b, rfl⟩ |
| 50 | let ea := amb a |
| 51 | let eb := amb b |
| 52 | let k := ea.symm.trans eb |
| 53 | let r := I.symm ⁻¹' ((rel a).symm.trans (rel b)).source ∩ range I |
| 54 | have hk : ContDiffOn ℝ ∞ k k.source := by |
| 55 | apply (contMDiffOn_iff_contDiffOn).mp |
| 56 | exact (hamb b).2.1.comp ((hamb a).2.2.1.mono (fun x hx => hx.1)) |
| 57 | (fun x hx => hx.2) |
| 58 | apply contDiffOn_corner_transition_of_eqOn I k.open_source hk |
| 59 | (fun x hx => by |
| 60 | rcases hx.1 with h |
| 61 | have hArel := h.1 |
| 62 | have hB := h.2 |
| 63 | have hxI : I (I.symm x) = x := I.right_inv hx.2 |
| 64 | have hAx' : ((I.symm x).val : EuclideanSpace ℝ (Fin (n + 1))) ∈ ea.target := by |
| 65 | change ((I.symm x).val : EuclideanSpace ℝ (Fin (n + 1))) ∈ ea.target at hArel |
| 66 | exact hArel |
| 67 | have hAx : x ∈ ea.target := by |
| 68 | rw [← hxI] |
| 69 | exact hAx' |
| 70 | have hco : |
| 71 | (((rel a).symm (I.symm x) : K) : M) = ea.symm x := by |
| 72 | have hc := subtypeRestrictImageOn_symm_apply_coe ea (hamb a).2.2.2 a |
| 73 | (hamb a).1 hAx' |
| 74 | have hIval : ((I.symm x).val : EuclideanSpace ℝ (Fin (n + 1))) = x := by |
| 75 | exact I.right_inv hx.2 |
| 76 | change (((rel a).symm (I.symm x) : K) : M) = ea.symm ((I.symm x).val) at hc |
| 77 | rw [hIval] at hc |
| 78 | exact hc |
| 79 | have hBx : ea.symm x ∈ eb.source := by |
| 80 | change (((rel a).symm (I.symm x) : K) : M) ∈ eb.source at hB |
| 81 | rw [hco] at hB |
| 82 | exact hB |
| 83 | exact ⟨hAx, hBx⟩) |
| 84 | intro x hx |
| 85 | have hxI : I (I.symm x) = x := I.right_inv hx.2 |
| 86 | have hArel := hx.1.1 |
| 87 | change ((I.symm x).val : EuclideanSpace ℝ (Fin (n + 1))) ∈ ea.target at hArel |
| 88 | have hcoA : |
| 89 | (((rel a).symm (I.symm x) : K) : M) = ea.symm x := by |
| 90 | have hc := subtypeRestrictImageOn_symm_apply_coe ea (hamb a).2.2.2 a |
| 91 | (hamb a).1 hArel |
| 92 | have hIval : ((I.symm x).val : EuclideanSpace ℝ (Fin (n + 1))) = x := by |
| 93 | exact I.right_inv hx.2 |
| 94 | change (((rel a).symm (I.symm x) : K) : M) = ea.symm ((I.symm x).val) at hc |
| 95 | rw [hIval] at hc |
| 96 | exact hc |
| 97 | have hBrel := hx.1.2 |
| 98 | change ((rel b) ((rel a).symm (I.symm x)) : H).val = k x |
| 99 | have hBsource : (rel a).symm (I.symm x) ∈ (rel b).source := hBrel |
| 100 | have hcoB : |
| 101 | (((rel b) ((rel a).symm (I.symm x)) : H).val : |
| 102 | EuclideanSpace ℝ (Fin (n + 1))) = |
| 103 | eb (((rel a).symm (I.symm x) : K) : M) := by |
| 104 | exact subtypeRestrictImageOn_apply_coe (amb b) (hamb b).2.2.2 b |
| 105 | (hamb b).1 hBsource |
| 106 | rw [hcoB, hcoA] |
| 107 | rfl |
| 108 | refine ⟨CS, rel, hsource, rfl, hman, ?_⟩ |
| 109 | letI : ChartedSpace H K := CS |
| 110 | letI : @IsManifold ℝ _ (EuclideanSpace ℝ (Fin (n + 1))) _ _ |
| 111 | H _ I ∞ K _ CS := hman |
| 112 | refine ⟨?_, Topology.IsEmbedding.subtypeVal⟩ |
| 113 | refine ⟨PUnit, by infer_instance, by infer_instance, ?_⟩ |
| 114 | intro a |
| 115 | have ha : a ∈ (rel a).source := hsource a |
| 116 | let B : EuclideanSpace ℝ (Fin (n + 1)) ≃L[ℝ] E := |
| 117 | ContinuousLinearEquiv.ofFinrankEq (by simp [hn]) |
| 118 | let cod : OpenPartialHomeomorph M E := |
| 119 | (amb a).trans B.toHomeomorph.toOpenPartialHomeomorph |
| 120 | have hcod : cod ∈ IsManifold.maximalAtlas 𝓘(ℝ, E) ∞ M := by |
| 121 | apply cod.mem_maximalAtlas_of_contMDiffOn |
| 122 | · simpa [cod, OpenPartialHomeomorph.trans_source, Function.comp_def] using |
| 123 | ((ContinuousLinearEquiv.contDiff B).contMDiff.contMDiffOn.comp |
| 124 | (hamb a).2.1 (fun x hx => (amb a).map_source hx)) |
| 125 | · simpa [cod, OpenPartialHomeomorph.trans_target, Function.comp_def] using |
| 126 | ((hamb a).2.2.1.comp |
| 127 | (ContinuousLinearEquiv.contDiff B.symm).contMDiff.contMDiffOn |
| 128 | (by |
| 129 | intro x hx |
| 130 | change B.symm x ∈ (amb a).target at hx |
| 131 | exact hx)) |
| 132 | refine Manifold.IsImmersionAtOfComplement.mk_of_charts |
| 133 | (x := a) (f := fun x : K => (x : M)) |
| 134 | ((ContinuousLinearEquiv.prodUnique ℝ |
| 135 | (EuclideanSpace ℝ (Fin (n + 1))) PUnit).trans B) |
| 136 | (rel a) cod ?_ ?_ ?_ ?_ ?_ ?_ |
| 137 | · exact ha |
| 138 | · simpa [cod, OpenPartialHomeomorph.trans_source] using (hamb a).1 |
| 139 | · change rel a ∈ IsManifold.maximalAtlas I ∞ K |
| 140 | exact IsManifold.subset_maximalAtlas (chart_mem_atlas H a) |
| 141 | · exact hcod |
| 142 | · intro x hx |
| 143 | change (x : M) ∈ (amb a).source at hx |
| 144 | simpa [cod, OpenPartialHomeomorph.trans_source] using hx |
| 145 | · intro x hx |
| 146 | let y : K := ((rel a).extend I).symm x |
| 147 | change (cod.extend 𝓘(ℝ, E)) (y : M) = |
| 148 | ((ContinuousLinearEquiv.prodUnique ℝ |
| 149 | (EuclideanSpace ℝ (Fin (n + 1))) PUnit).trans B) (x, 0) |
| 150 | have hy : y ∈ (rel a).source := by |
| 151 | simpa [y, OpenPartialHomeomorph.extend_source] using |
| 152 | ((rel a).extend I).map_target hx |
| 153 | have hrel := subtypeRestrictImageOn_apply_coe (amb a) (hamb a).2.2.2 a |
| 154 | (hamb a).1 hy |
| 155 | have hI : I (rel a (y : K)) = x := by |
| 156 | have hright := (rel a).extend I |>.right_inv hx |
| 157 | simpa [y, OpenPartialHomeomorph.extend_coe] using hright |
| 158 | calc |
| 159 | (cod.extend 𝓘(ℝ, E)) (y : M) = B (amb a (y : M)) := by |
| 160 | simp [cod, Function.comp_apply] |
| 161 | _ = B (I (rel a y)) := by |
| 162 | congr 1 |
| 163 | exact hrel.symm |
| 164 | _ = B x := by rw [hI] |
| 165 | _ = ((ContinuousLinearEquiv.prodUnique ℝ |
| 166 | (EuclideanSpace ℝ (Fin (n + 1))) PUnit).trans B) (x, 0) := by |
| 167 | rfl |
| 168 | |
| 169 | /-- The relative atlas charts the actual superlevel subtype, and its inclusion |
| 170 | is a smooth embedding into the ambient manifold. -/ |
| 171 | theorem exists_regular_superlevel_smooth_embedding |
| 172 | (hn : Module.finrank ℝ E = n + 1) {f : M → ℝ} |
| 173 | (hf : ContMDiff 𝓘(ℝ, E) 𝓘(ℝ, ℝ) ∞ f) (c : ℝ) |
| 174 | (hc : ∀ x, f x = c → |
| 175 | Surjective (mfderiv 𝓘(ℝ, E) 𝓘(ℝ, ℝ) f x)) : |
| 176 | ∃ (K : Set M) (CS : ChartedSpace (EuclideanHalfSpace (n + 1)) K) |
| 177 | (rel : K → OpenPartialHomeomorph K (EuclideanHalfSpace (n + 1))) |
| 178 | (hsource : ∀ x : K, x ∈ (rel x).source), |
| 179 | K = {x | c ≤ f x} ∧ |
| 180 | CS = chartedSpaceOfRelativeCharts rel hsource ∧ |
| 181 | @IsManifold ℝ _ (EuclideanSpace ℝ (Fin (n + 1))) _ _ |
| 182 | (EuclideanHalfSpace (n + 1)) _ (𝓡∂ (n + 1)) ∞ K _ CS ∧ |
| 183 | Manifold.IsSmoothEmbedding (𝓡∂ (n + 1)) 𝓘(ℝ, E) ∞ |
| 184 | (fun x : K => (x : M)) := by |
| 185 | let K : Set M := {x | c ≤ f x} |
| 186 | choose amb hamb using fun a : K => |
| 187 | exists_regular_superlevel_halfspace_chart hn hf c hc a.1 a.2 |
| 188 | obtain ⟨CS, rel, hsource, heq, hman, hemb⟩ := |
| 189 | exists_smooth_embedding_of_halfspace_charts hn K amb hamb |
| 190 | exact ⟨K, CS, rel, hsource, rfl, heq, hman, hemb⟩ |
| 191 | |
| 192 | end Poincare.Manifold |
| 193 |