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.SmoothEmbedding |
| 2 | import Mathlib.Geometry.Manifold.LocalDiffeomorph |
| 3 | import Mathlib.Analysis.Calculus.InverseFunctionTheorem.ContDiff |
| 4 | import Mathlib.Analysis.InnerProductSpace.PiL2 |
| 5 | import Mathlib.LinearAlgebra.Projection |
| 6 | |
| 7 | /-! |
| 8 | # Injective differentials and finite-dimensional immersions |
| 9 | |
| 10 | An injective differential admits a finite-dimensional linear complement. |
| 11 | Extending a map along this complement and applying the inverse function |
| 12 | theorem produces the complementary chart normal form of a smooth immersion. |
| 13 | -/ |
| 14 | |
| 15 | noncomputable section |
| 16 | set_option autoImplicit false |
| 17 | set_option backward.isDefEq.respectTransparency false |
| 18 | |
| 19 | open Set Filter |
| 20 | open scoped Manifold ContDiff Topology |
| 21 | |
| 22 | namespace Poincare.Geometry.Manifold |
| 23 | |
| 24 | variable {E F : Type*} [NormedAddCommGroup E] [NormedSpace Real E] |
| 25 | [NormedAddCommGroup F] [NormedSpace Real F] |
| 26 | [FiniteDimensional Real E] [FiniteDimensional Real F] |
| 27 | |
| 28 | /-- Complete an injective linear map to an isomorphism using one fixed |
| 29 | Euclidean model for its complement. -/ |
| 30 | theorem exists_continuousLinearEquiv_prod_of_injective |
| 31 | (L : E →L[Real] F) (hL : Function.Injective L) : |
| 32 | ∃ A : (E × EuclideanSpace Real |
| 33 | (Fin (Module.finrank Real F - Module.finrank Real E))) ≃L[Real] F, |
| 34 | ∀ x, A (x, 0) = L x := by |
| 35 | let P := LinearMap.range L.toLinearMap |
| 36 | obtain ⟨Q, hQ⟩ := Submodule.exists_isCompl P |
| 37 | let B : E ≃ₗ[Real] P := LinearEquiv.ofInjective L.toLinearMap hL |
| 38 | have hdim : Module.finrank Real Q = Module.finrank Real F - Module.finrank Real E := by |
| 39 | have hd := Submodule.finrank_add_eq_of_isCompl hQ |
| 40 | rw [← B.finrank_eq] at hd |
| 41 | omega |
| 42 | let C : EuclideanSpace Real |
| 43 | (Fin (Module.finrank Real F - Module.finrank Real E)) ≃L[Real] Q := |
| 44 | ContinuousLinearEquiv.ofFinrankEq (by simpa using hdim.symm) |
| 45 | let A := ((B.prodCongr C.toLinearEquiv).trans (P.prodEquivOfIsCompl Q hQ)).toContinuousLinearEquiv |
| 46 | refine ⟨A, fun x => ?_⟩ |
| 47 | simp [A, B, Submodule.coe_prodEquivOfIsCompl'] |
| 48 | rfl |
| 49 | |
| 50 | private theorem exists_partialDiffeomorph_of_contDiffOn |
| 51 | {G H : Type*} [NormedAddCommGroup G] [NormedSpace Real G] |
| 52 | [NormedAddCommGroup H] [NormedSpace Real H] [CompleteSpace G] [CompleteSpace H] |
| 53 | {g : G -> H} {s : Set G} (hs : IsOpen s) (hg : ContDiffOn Real ∞ g s) |
| 54 | {a : G} (ha : a ∈ s) (hb : Function.Bijective (fderiv Real g a)) : |
| 55 | ∃ d : PartialDiffeomorph 𝓘(Real, G) 𝓘(Real, H) G H ∞, |
| 56 | a ∈ d.source ∧ d.source ⊆ s ∧ (d : G -> H) = g := by |
| 57 | let A := ContinuousLinearEquiv.ofBijective (fderiv Real g a) |
| 58 | (LinearMap.ker_eq_bot.mpr hb.1) (LinearMap.range_eq_top.mpr hb.2) |
| 59 | have hga : ContDiffAt Real ∞ g a := hg.contDiffAt (hs.mem_nhds ha) |
| 60 | have hd : HasFDerivAt g A.toContinuousLinearMap a := |
| 61 | (hga.differentiableAt (by simp)).hasFDerivAt |
| 62 | let U := s ∩ (fderiv Real g) ⁻¹' |
| 63 | range (fun B : G ≃L[Real] H => B.toContinuousLinearMap) |
| 64 | have hU : IsOpen U := |
| 65 | (hg.continuousOn_fderiv_of_isOpen hs (by simp)).isOpen_inter_preimage hs |
| 66 | ContinuousLinearEquiv.isOpen |
| 67 | let Q := hga.toOpenPartialHomeomorph g hd (by simp) |
| 68 | let D := Q.restr U |
| 69 | have hDs : D.source ⊆ U := fun _ hz => interior_subset hz.2 |
| 70 | have hDa : a ∈ D.source := by |
| 71 | rw [Q.restr_source' U hU] |
| 72 | exact ⟨hga.mem_toOpenPartialHomeomorph_source hd (by simp), ha, A, rfl⟩ |
| 73 | have hDi : ContMDiffOn 𝓘(Real, H) 𝓘(Real, G) ∞ D.symm D.target := by |
| 74 | intro y hy |
| 75 | have hz := hDs (D.map_target hy) |
| 76 | obtain ⟨B, hB⟩ := hz.2 |
| 77 | dsimp only at hB |
| 78 | have hgz : ContDiffAt Real ∞ g (D.symm y) := hg.contDiffAt (hs.mem_nhds hz.1) |
| 79 | have hdB : HasFDerivAt D B.toContinuousLinearMap (D.symm y) := by |
| 80 | change HasFDerivAt g B.toContinuousLinearMap (D.symm y) |
| 81 | rw [hB] |
| 82 | exact (hgz.differentiableAt (by simp)).hasFDerivAt |
| 83 | exact (D.contDiffAt_symm hy hdB hgz).contMDiffWithinAt.mono (subset_univ _) |
| 84 | let d : PartialDiffeomorph 𝓘(Real, G) 𝓘(Real, H) G H ∞ := { |
| 85 | toPartialEquiv := D.toPartialEquiv |
| 86 | open_source := D.open_source |
| 87 | open_target := D.open_target |
| 88 | contMDiffOn_toFun := (hg.mono (fun _ hz => (hDs hz).1)).contMDiffOn |
| 89 | contMDiffOn_invFun := hDi } |
| 90 | exact ⟨d, hDa, fun _ hz => (hDs hz).1, rfl⟩ |
| 91 | |
| 92 | variable {M : Type*} [TopologicalSpace M] [ChartedSpace E M] |
| 93 | [IsManifold 𝓘(Real, E) ∞ M] |
| 94 | |
| 95 | /-- An injective differential gives the complementary chart normal form of |
| 96 | an immersion into a finite-dimensional real normed space. -/ |
| 97 | theorem isImmersionAtOfComplement_of_injective_mfderiv |
| 98 | {f : M -> F} (hf : ContMDiff 𝓘(Real, E) 𝓘(Real, F) ∞ f) (x : M) |
| 99 | (hinj : Function.Injective (mfderiv 𝓘(Real, E) 𝓘(Real, F) f x)) : |
| 100 | _root_.Manifold.IsImmersionAtOfComplement |
| 101 | (EuclideanSpace Real (Fin (Module.finrank Real F - Module.finrank Real E))) |
| 102 | 𝓘(Real, E) 𝓘(Real, F) ∞ f x := by |
| 103 | let C := EuclideanSpace Real (Fin (Module.finrank Real F - Module.finrank Real E)) |
| 104 | let c := chartAt E x |
| 105 | let g : E -> F := f ∘ c.symm |
| 106 | have hg : ContDiffOn Real ∞ g c.target := |
| 107 | (hf.comp_contMDiffOn (contMDiffOn_chart_symm (I := 𝓘(Real, E)))).contDiffOn |
| 108 | have hder : mfderiv 𝓘(Real, E) 𝓘(Real, F) f x = fderiv Real g (c x) := by |
| 109 | rw [mfderiv, if_pos ((hf x).mdifferentiableAt (by simp))] |
| 110 | simp [g, c, writtenInExtChartAt] |
| 111 | obtain ⟨A, hA⟩ := exists_continuousLinearEquiv_prod_of_injective |
| 112 | (fderiv Real g (c x)) (hder ▸ hinj) |
| 113 | let G : E × C -> F := fun z => g z.1 + A (0, z.2) |
| 114 | have hG : ContDiffOn Real ∞ G (c.target ×ˢ univ) := |
| 115 | (hg.comp contDiffOn_fst (fun _ hz => hz.1)).add |
| 116 | (A.contDiff.comp (contDiff_const.prodMk contDiff_snd)).contDiffOn |
| 117 | have hcx : c x ∈ c.target := c.map_source (mem_chart_source E x) |
| 118 | have hdG : HasFDerivAt G A.toContinuousLinearMap (c x, 0) := by |
| 119 | have hdg := (hg.contDiffAt (c.open_target.mem_nhds hcx)).differentiableAt (by simp) |
| 120 | have hd := (hdg.hasFDerivAt.comp (c x, (0 : C)) hasFDerivAt_fst).add |
| 121 | (A.hasFDerivAt.comp (c x, (0 : C)) |
| 122 | ((hasFDerivAt_const (0 : E) (c x, (0 : C))).prodMk hasFDerivAt_snd)) |
| 123 | have heq : A.toContinuousLinearMap = |
| 124 | (fderiv Real g (c x)).comp (ContinuousLinearMap.fst Real E C) + |
| 125 | A.toContinuousLinearMap.comp |
| 126 | ((0 : E × C →L[Real] E).prod (ContinuousLinearMap.snd Real E C)) := by |
| 127 | apply ContinuousLinearMap.ext |
| 128 | intro z |
| 129 | change A z = fderiv Real g (c x) z.1 + A (0, z.2) |
| 130 | rw [← hA z.1, ← map_add] |
| 131 | congr 1 |
| 132 | simp |
| 133 | rw [heq] |
| 134 | exact hd |
| 135 | obtain ⟨d, hd0, hds, hdGfun⟩ := exists_partialDiffeomorph_of_contDiffOn |
| 136 | (c.open_target.prod isOpen_univ) hG (show (c x, (0 : C)) ∈ c.target ×ˢ univ from ⟨hcx, trivial⟩) |
| 137 | (by rw [hdG.fderiv]; exact A.bijective) |
| 138 | let V : Set E := {u | (u, (0 : C)) ∈ d.source} |
| 139 | have hV : IsOpen V := d.open_source.preimage (continuous_id.prodMk continuous_const) |
| 140 | let a := (c.symm.restrOpen V hV).symm |
| 141 | let b := d.symm.toOpenPartialHomeomorph.trans A.toHomeomorph.toOpenPartialHomeomorph |
| 142 | have ham : a ∈ IsManifold.maximalAtlas 𝓘(Real, E) ∞ M := by |
| 143 | apply a.mem_maximalAtlas_of_contMDiffOn |
| 144 | · exact (contMDiffOn_chart (I := 𝓘(Real, E)) (x := x)).mono inter_subset_left |
| 145 | · exact (contMDiffOn_chart_symm (I := 𝓘(Real, E)) (x := x)).mono inter_subset_left |
| 146 | have hbm : b ∈ IsManifold.maximalAtlas 𝓘(Real, F) ∞ F := by |
| 147 | apply b.mem_maximalAtlas_of_contMDiffOn |
| 148 | · exact A.contDiff.contMDiff.comp_contMDiffOn |
| 149 | (d.contMDiffOn_invFun.mono inter_subset_left) |
| 150 | · exact d.contMDiffOn_toFun.comp A.symm.contDiff.contMDiff.contMDiffOn |
| 151 | (fun _ hy => hy.2) |
| 152 | have hax : x ∈ a.source := ⟨mem_chart_source E x, hd0⟩ |
| 153 | have hGzero (y : M) (hy : y ∈ c.source) : d (c y, 0) = f y := by |
| 154 | rw [hdGfun] |
| 155 | simp [G, g, c.left_inv hy] |
| 156 | have hsource (y : M) (hy : y ∈ a.source) : f y ∈ b.source := by |
| 157 | have hyD : (c y, (0 : C)) ∈ d.source := hy.2 |
| 158 | refine ⟨?_, mem_univ _⟩ |
| 159 | rw [← hGzero y hy.1] |
| 160 | exact d.map_source hyD |
| 161 | apply _root_.Manifold.IsImmersionAtOfComplement.mk_of_charts A a b hax |
| 162 | (hsource x hax) ham hbm hsource |
| 163 | intro u hu |
| 164 | have hu' : u ∈ a.target := by simpa using hu |
| 165 | have huD : (u, (0 : C)) ∈ d.source := hu'.2 |
| 166 | change A (d.symm (f (c.symm u))) = A (u, 0) |
| 167 | have heq : f (c.symm u) = d (u, 0) := by |
| 168 | rw [hdGfun] |
| 169 | simp [G, g] |
| 170 | rw [heq] |
| 171 | exact congrArg A (d.left_inv huD) |
| 172 | |
| 173 | /-- A smooth map into a finite-dimensional real normed space whose |
| 174 | differential is injective everywhere is a smooth immersion. -/ |
| 175 | theorem isImmersion_of_injective_mfderiv |
| 176 | {f : M -> F} (hf : ContMDiff 𝓘(Real, E) 𝓘(Real, F) ∞ f) |
| 177 | (hinj : ∀ x, Function.Injective (mfderiv 𝓘(Real, E) 𝓘(Real, F) f x)) : |
| 178 | _root_.Manifold.IsImmersion 𝓘(Real, E) 𝓘(Real, F) ∞ f := |
| 179 | _root_.Manifold.IsImmersionOfComplement.isImmersion |
| 180 | (fun x => isImmersionAtOfComplement_of_injective_mfderiv hf x (hinj x)) |
| 181 | |
| 182 | /-- A compact injective smooth map with injective differentials is a smooth |
| 183 | embedding into a finite-dimensional real normed space. -/ |
| 184 | theorem isSmoothEmbedding_of_injective_mfderiv [CompactSpace M] |
| 185 | {f : M -> F} (hf : ContMDiff 𝓘(Real, E) 𝓘(Real, F) ∞ f) |
| 186 | (hfi : Function.Injective f) |
| 187 | (hinj : ∀ x, Function.Injective (mfderiv 𝓘(Real, E) 𝓘(Real, F) f x)) : |
| 188 | _root_.Manifold.IsSmoothEmbedding 𝓘(Real, E) 𝓘(Real, F) ∞ f := |
| 189 | ⟨isImmersion_of_injective_mfderiv hf hinj, |
| 190 | (hf.continuous.isClosedEmbedding hfi).isEmbedding⟩ |
| 191 | |
| 192 | end Poincare.Geometry.Manifold |