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.Analysis.Calculus.InverseFunctionTheorem.ContDiff |
| 2 | import Mathlib.Analysis.Normed.Module.Complemented |
| 3 | import Mathlib.Analysis.Normed.Ring.Units |
| 4 | import Mathlib.Geometry.Manifold.Submersion |
| 5 | import Mathlib.Geometry.Manifold.MFDeriv.NormedSpace |
| 6 | |
| 7 | /-! |
| 8 | # Submersions with finite-dimensional target |
| 9 | |
| 10 | For smooth maps from a manifold modeled on a finite-dimensional real normed |
| 11 | space, a surjective differential gives the local projection normal form. |
| 12 | The proof splits the differential and applies the inverse function theorem |
| 13 | to the map consisting of the given function and the complementary coordinates. |
| 14 | -/ |
| 15 | |
| 16 | noncomputable section |
| 17 | set_option autoImplicit false |
| 18 | set_option backward.isDefEq.respectTransparency false |
| 19 | |
| 20 | open Set Filter Function |
| 21 | open scoped Manifold ContDiff Topology |
| 22 | |
| 23 | namespace Poincare.Geometry.Manifold |
| 24 | |
| 25 | /-- The differential of a finite family of smooth scalar functions has the |
| 26 | scalar differentials as its components. The target is the finite Pi space. -/ |
| 27 | theorem mfderiv_pi_apply |
| 28 | {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 29 | {M : Type*} [TopologicalSpace M] [ChartedSpace E M] |
| 30 | {ι : Type*} [Fintype ι] |
| 31 | (f : ι → M → ℝ) (hf : ∀ i, ContMDiff 𝓘(ℝ, E) 𝓘(ℝ, ℝ) ∞ (f i)) |
| 32 | (x : M) (v : TangentSpace 𝓘(ℝ, E) x) (i : ι) : |
| 33 | mfderiv 𝓘(ℝ, E) 𝓘(ℝ, ι → ℝ) (fun y i => f i y) x v i = |
| 34 | mvfderiv 𝓘(ℝ, E) (f i) x v := by |
| 35 | let c := extChartAt 𝓘(ℝ, E) x |
| 36 | have hjoint : ContMDiff 𝓘(ℝ, E) 𝓘(ℝ, ι → ℝ) ∞ (fun y i => f i y) := |
| 37 | contMDiff_pi_space.mpr hf |
| 38 | have hi (j : ι) : HasFDerivAt (f j ∘ c.symm) |
| 39 | (mfderiv 𝓘(ℝ, E) 𝓘(ℝ, ℝ) (f j) x) (c x) := by |
| 40 | simpa [c, writtenInExtChartAt, hasFDerivWithinAt_univ] using |
| 41 | ((hf j x).mdifferentiableAt (by simp)).hasMFDerivAt.2 |
| 42 | have hJ : HasFDerivAt (fun z j => f j (c.symm z)) |
| 43 | (mfderiv 𝓘(ℝ, E) 𝓘(ℝ, ι → ℝ) (fun y i => f i y) x) (c x) := by |
| 44 | simpa [c, writtenInExtChartAt, hasFDerivWithinAt_univ] using |
| 45 | ((hjoint x).mdifferentiableAt (by simp)).hasMFDerivAt.2 |
| 46 | exact congrArg (fun L => L v i) (hJ.unique (hasFDerivAt_pi.mpr hi)) |
| 47 | |
| 48 | private theorem exists_smooth_local_equiv |
| 49 | {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] |
| 50 | {f : E → E} {s : Set E} (hs : IsOpen s) (hf : ContDiffOn ℝ ∞ f s) |
| 51 | {x : E} (hx : x ∈ s) |
| 52 | (hd : HasFDerivAt f (ContinuousLinearEquiv.refl ℝ E : E →L[ℝ] E) x) : |
| 53 | ∃ G : OpenPartialHomeomorph E E, G.source ⊆ s ∧ x ∈ G.source ∧ |
| 54 | (G : E → E) = f ∧ ContDiffOn ℝ ∞ G G.source ∧ |
| 55 | ContDiffOn ℝ ∞ G.symm G.target := by |
| 56 | have hfx := hf.contDiffAt (hs.mem_nhds hx) |
| 57 | let G₀ := hfx.toOpenPartialHomeomorph f hd (by simp) |
| 58 | have hxG : x ∈ G₀.source := hfx.mem_toOpenPartialHomeomorph_source hd (by simp) |
| 59 | let t : Set E := (s ∩ G₀.source) ∩ (fderiv ℝ f) ⁻¹' {L : E →L[ℝ] E | IsUnit L} |
| 60 | have ht : IsOpen t := by |
| 61 | apply ContinuousOn.isOpen_inter_preimage |
| 62 | · exact (hf.continuousOn_fderiv_of_isOpen hs (by exact_mod_cast le_top)).mono |
| 63 | inter_subset_left |
| 64 | · exact hs.inter G₀.open_source |
| 65 | · exact Units.isOpen |
| 66 | have hxt : x ∈ t := by |
| 67 | refine ⟨⟨hx, hxG⟩, ?_⟩ |
| 68 | change IsUnit (fderiv ℝ f x) |
| 69 | rw [hd.fderiv, show (ContinuousLinearEquiv.refl ℝ E : E →L[ℝ] E) = 1 from |
| 70 | ContinuousLinearMap.ext fun y => by simp [ContinuousLinearMap.one_def]] |
| 71 | exact isUnit_one |
| 72 | let G := G₀.restrOpen t ht |
| 73 | refine ⟨G, fun y hy => hy.2.1.1, ⟨hxG, hxt⟩, rfl, ?_, ?_⟩ |
| 74 | · exact hf.mono fun y hy => hy.2.1.1 |
| 75 | · intro y hy |
| 76 | have hys := G.map_target hy |
| 77 | have hyf : G.symm y ∈ s := hys.2.1.1 |
| 78 | have hyu : IsUnit (fderiv ℝ f (G.symm y)) := hys.2.2 |
| 79 | have hd' : HasFDerivAt f |
| 80 | (ContinuousLinearEquiv.ofUnit hyu.unit : E →L[ℝ] E) (G.symm y) := by |
| 81 | convert ((hf.contDiffAt (hs.mem_nhds hyf)).differentiableAt (by simp)).hasFDerivAt |
| 82 | using 1 |
| 83 | exact ContinuousLinearMap.ext fun z => by |
| 84 | simp [ContinuousLinearEquiv.ofUnit, IsUnit.unit_spec] |
| 85 | exact (G.contDiffAt_symm hy hd' (hf.contDiffAt (hs.mem_nhds hyf))).contDiffWithinAt |
| 86 | |
| 87 | /-- A surjective differential gives a smooth projection chart with the |
| 88 | actual differential kernel as its complementary coordinate space. -/ |
| 89 | theorem exists_projection_chart_of_surjective_mfderiv |
| 90 | {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] |
| 91 | [NormedAddCommGroup F] [NormedSpace ℝ F] [FiniteDimensional ℝ F] |
| 92 | {M : Type*} [TopologicalSpace M] [ChartedSpace E M] [IsManifold 𝓘(ℝ, E) ∞ M] |
| 93 | {f : M → F} (hf : ContMDiff 𝓘(ℝ, E) 𝓘(ℝ, F) ∞ f) (x : M) |
| 94 | (hsurj : Function.Surjective (mfderiv 𝓘(ℝ, E) 𝓘(ℝ, F) f x)) : |
| 95 | ∃ e : E ≃L[ℝ] (F × (mfderiv 𝓘(ℝ, E) 𝓘(ℝ, F) f x : E →L[ℝ] F).ker), |
| 96 | ∃ d : OpenPartialHomeomorph M E, x ∈ d.source ∧ |
| 97 | ContMDiffOn 𝓘(ℝ, E) 𝓘(ℝ, E) ∞ d d.source ∧ |
| 98 | ContMDiffOn 𝓘(ℝ, E) 𝓘(ℝ, E) ∞ d.symm d.target ∧ |
| 99 | ∀ y ∈ d.target, f (d.symm y) = (e y).1 := by |
| 100 | let c := chartAt E x |
| 101 | let u := c x |
| 102 | let fc : E → F := f ∘ c.symm |
| 103 | let L : E →L[ℝ] F := mfderiv 𝓘(ℝ, E) 𝓘(ℝ, F) f x |
| 104 | have hfc : ContDiffOn ℝ ∞ fc c.target := by |
| 105 | apply contMDiffOn_iff_contDiffOn.mp |
| 106 | exact hf.comp_contMDiffOn (contMDiffOn_chart_symm (I := 𝓘(ℝ, E)) (x := x)) |
| 107 | have hd : HasFDerivAt fc L u := by |
| 108 | have h := ((hf x).mdifferentiableAt (by simp)).hasMFDerivAt.2 |
| 109 | simpa [fc, L, u, c, writtenInExtChartAt, hasFDerivWithinAt_univ] using h |
| 110 | obtain ⟨p, hp⟩ := L.ker_closedComplemented_of_finiteDimensional_range |
| 111 | let e : E ≃L[ℝ] (F × L.ker) := L.equivProdOfSurjectiveOfIsCompl p |
| 112 | (LinearMap.range_eq_top.mpr hsurj) (LinearMap.range_eq_of_proj hp) |
| 113 | (LinearMap.isCompl_of_proj hp) |
| 114 | let H : E → E := fun v => e.symm (fc v, p v) |
| 115 | have hH : ContDiffOn ℝ ∞ H c.target := |
| 116 | e.symm.contDiff.comp_contDiffOn (hfc.prodMk p.contDiff.contDiffOn) |
| 117 | have hHd : HasFDerivAt H (ContinuousLinearEquiv.refl ℝ E : E →L[ℝ] E) u := by |
| 118 | convert e.symm.hasFDerivAt.comp u (hd.prodMk p.hasFDerivAt) using 1 |
| 119 | · rfl |
| 120 | · ext v |
| 121 | exact (e.symm_apply_apply v).symm |
| 122 | obtain ⟨G, hGc, huG, hG, hGs, hGis⟩ := |
| 123 | exists_smooth_local_equiv c.open_target hH (mem_chart_target E x) hHd |
| 124 | let d := c.trans G |
| 125 | have hdsource : x ∈ d.source := ⟨mem_chart_source E x, huG⟩ |
| 126 | have hds : ContMDiffOn 𝓘(ℝ, E) 𝓘(ℝ, E) ∞ d d.source := by |
| 127 | exact hGs.contMDiffOn.comp |
| 128 | ((contMDiffOn_chart (I := 𝓘(ℝ, E)) (x := x)).mono inter_subset_left) |
| 129 | (fun y hy => hy.2) |
| 130 | have hdis : ContMDiffOn 𝓘(ℝ, E) 𝓘(ℝ, E) ∞ d.symm d.target := by |
| 131 | exact (contMDiffOn_chart_symm (I := 𝓘(ℝ, E)) (x := x)).comp |
| 132 | (hGis.contMDiffOn.mono inter_subset_left) (fun y hy => hy.2) |
| 133 | refine ⟨e, d, hdsource, hds, hdis, ?_⟩ |
| 134 | intro y hy |
| 135 | have hyG : y ∈ G.target := hy.1 |
| 136 | have hyinv : H (G.symm y) = y := by rw [← hG]; exact G.right_inv hyG |
| 137 | have heq := congrArg (fun z => (e z).1) hyinv |
| 138 | change f (d.symm y) = (e y).1 |
| 139 | simpa [d, H, fc, Function.comp_def] using heq |
| 140 | |
| 141 | /-- A smooth map to a finite-dimensional normed space is a submersion at |
| 142 | every point where its actual manifold differential is surjective. -/ |
| 143 | theorem isSubmersionAt_of_surjective_mfderiv |
| 144 | {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] |
| 145 | [NormedAddCommGroup F] [NormedSpace ℝ F] [FiniteDimensional ℝ F] |
| 146 | {M : Type*} [TopologicalSpace M] [ChartedSpace E M] [IsManifold 𝓘(ℝ, E) ∞ M] |
| 147 | {f : M → F} (hf : ContMDiff 𝓘(ℝ, E) 𝓘(ℝ, F) ∞ f) (x : M) |
| 148 | (hsurj : Function.Surjective (mfderiv 𝓘(ℝ, E) 𝓘(ℝ, F) f x)) : |
| 149 | Manifold.IsSubmersionAt 𝓘(ℝ, E) 𝓘(ℝ, F) ∞ f x := by |
| 150 | obtain ⟨e, d, hx, hd, hdi, heq⟩ := |
| 151 | exists_projection_chart_of_surjective_mfderiv hf x hsurj |
| 152 | let L : E →L[ℝ] F := mfderiv 𝓘(ℝ, E) 𝓘(ℝ, F) f x |
| 153 | change E ≃L[ℝ] (F × L.ker) at e |
| 154 | apply Manifold.IsSubmersionAt.mk_of_charts e d (OpenPartialHomeomorph.refl F) |
| 155 | hx (by simp) (d.mem_maximalAtlas_of_contMDiffOn hd hdi) |
| 156 | (OpenPartialHomeomorph.refl F |>.mem_maximalAtlas_of_contMDiffOn |
| 157 | contMDiffOn_id contMDiffOn_id) (by simp) |
| 158 | intro y hy |
| 159 | change f (d.symm y) = (e y).1 |
| 160 | exact heq y hy.2 |
| 161 | |
| 162 | end Poincare.Geometry.Manifold |