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.Operator.Banach |
| 3 | import Mathlib.Geometry.Manifold.ContMDiffMFDeriv |
| 4 | import Mathlib.Geometry.Manifold.Instances.Real |
| 5 | /-! |
| 6 | # Joint spatial inverses of smooth families |
| 7 | |
| 8 | The inverse function theorem applied to (t,x) mapped to (t,Phi(t,x)) |
| 9 | constructs a spatial right inverse smooth jointly in time and point. |
| 10 | -/ |
| 11 | |
| 12 | noncomputable section |
| 13 | set_option autoImplicit false |
| 14 | set_option backward.isDefEq.respectTransparency false |
| 15 | open Set Filter Bundle |
| 16 | open scoped Manifold ContDiff Bundle Topology |
| 17 | namespace Poincare.Manifold |
| 18 | private theorem exists_smooth_euclidean_localInverse |
| 19 | {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] |
| 20 | {U : Set E} (hU : IsOpen U) {f : E → E} |
| 21 | (hf : ContDiffOn ℝ ∞ f U) {p : E} (hp : p ∈ U) |
| 22 | (hbij : Function.Bijective (fderiv ℝ f p)) : |
| 23 | ∃ Q : OpenPartialHomeomorph E E, |
| 24 | p ∈ Q.source ∧ Q.source ⊆ U ∧ (Q : E → E) = f ∧ |
| 25 | ContDiffOn ℝ ∞ Q Q.source ∧ ContDiffOn ℝ ∞ Q.symm Q.target := by |
| 26 | have hfp := hf.contDiffAt (hU.mem_nhds hp) |
| 27 | let A := ContinuousLinearEquiv.ofBijective (fderiv ℝ f p) |
| 28 | (LinearMap.ker_eq_bot.mpr hbij.1) (LinearMap.range_eq_top.mpr hbij.2) |
| 29 | have hd : HasFDerivAt f A.toContinuousLinearMap p := |
| 30 | (hfp.differentiableAt (by simp)).hasFDerivAt |
| 31 | have hu : ∀ᶠ z in 𝓝 p, IsUnit (fderiv ℝ f z) := |
| 32 | (hfp.continuousAt_fderiv (by simp)).eventually |
| 33 | (Units.isOpen.mem_nhds (ContinuousLinearMap.isUnit_iff_bijective.mpr hbij)) |
| 34 | obtain ⟨W, hWU, hW, hpW⟩ := mem_nhds_iff.mp |
| 35 | (Filter.inter_mem (hU.mem_nhds hp) hu) |
| 36 | let Q := (hfp.toOpenPartialHomeomorph f hd (by simp)).restr W |
| 37 | have hQf : (Q : E → E) = f := rfl |
| 38 | have hQW : Q.source ⊆ W := fun _ hz => interior_subset hz.2 |
| 39 | refine ⟨Q, ?_, fun z hz => (hWU (hQW hz)).1, hQf, ?_, ?_⟩ |
| 40 | · exact ⟨hfp.mem_toOpenPartialHomeomorph_source hd (by simp), |
| 41 | by simpa only [hW.interior_eq] using hpW⟩ |
| 42 | · exact hf.mono (fun z hz => (hWU (hQW hz)).1) |
| 43 | · intro y hy |
| 44 | have hz := hQW (Q.symm.map_source hy) |
| 45 | have hF := hf.contDiffAt (hU.mem_nhds (hWU hz).1) |
| 46 | have hb := ContinuousLinearMap.isUnit_iff_bijective.mp (hWU hz).2 |
| 47 | let B := ContinuousLinearEquiv.ofBijective (fderiv ℝ f (Q.symm y)) |
| 48 | (LinearMap.ker_eq_bot.mpr hb.1) (LinearMap.range_eq_top.mpr hb.2) |
| 49 | have hDF : HasFDerivAt Q B.toContinuousLinearMap (Q.symm y) := |
| 50 | (hF.differentiableAt (by simp)).hasFDerivAt |
| 51 | exact (Q.contDiffAt_symm hy hDF hF).contDiffWithinAt |
| 52 | |
| 53 | private theorem exists_smooth_euclidean_parameterInverse |
| 54 | {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] |
| 55 | {U : Set (ℝ × E)} (hU : IsOpen U) {f : ℝ × E → E} |
| 56 | (hf : ContDiffOn ℝ ∞ f U) {s : ℝ} {p : E} (hp : (s, p) ∈ U) |
| 57 | (hi : ∀ᶠ y in 𝓝 p, f (s, y) = y) : |
| 58 | ∃ (W : Set (ℝ × E)) (ψ : ℝ × E → E), IsOpen W ∧ (s, p) ∈ W ∧ |
| 59 | ContDiffOn ℝ ∞ ψ W ∧ |
| 60 | ∀ z ∈ W, (z.1, ψ z) ∈ U ∧ f (z.1, ψ z) = z.2 := by |
| 61 | let F : ℝ × E → ℝ × E := fun z => (z.1, f z) |
| 62 | have hF : ContDiffOn ℝ ∞ F U := contDiff_fst.contDiffOn.prodMk hf |
| 63 | have hFd := (hF.contDiffAt (hU.mem_nhds hp)).differentiableAt (by simp) |
| 64 | let A := fderiv ℝ F (s, p) |
| 65 | have hfst (z : ℝ × E) : (A z).1 = z.1 := by |
| 66 | have h := hFd.hasFDerivAt.fst.unique (hasFDerivAt_fst (p := (s, p))) |
| 67 | exact congrArg (fun L : (ℝ × E) →L[ℝ] ℝ => L z) h |
| 68 | have hvertical (v : E) : A (0, v) = (0, v) := by |
| 69 | have hin : HasFDerivAt (fun y : E => (s, y)) |
| 70 | ((0 : E →L[ℝ] ℝ).prod (ContinuousLinearMap.id ℝ E)) p := |
| 71 | (hasFDerivAt_const s p).prodMk (hasFDerivAt_id p) |
| 72 | have heq : (fun y => F (s, y)) =ᶠ[𝓝 p] (fun y => (s, y)) := |
| 73 | hi.mono (fun y hy => Prod.ext rfl hy) |
| 74 | have h := (hFd.hasFDerivAt.comp p hin).unique |
| 75 | (hin.congr_of_eventuallyEq heq) |
| 76 | exact congrArg (fun L : E →L[ℝ] (ℝ × E) => L v) h |
| 77 | have hshape (r : ℝ) (v : E) : A (r, v) = (r, (A (r, 0)).2 + v) := by |
| 78 | have hz : (r, v) = (r, 0) + (0, v) := by simp |
| 79 | rw [hz, map_add, hvertical] |
| 80 | exact Prod.ext (by simpa using hfst (r, 0)) rfl |
| 81 | have hbij : Function.Bijective A := by |
| 82 | constructor |
| 83 | · rintro ⟨r, v⟩ ⟨t, w⟩ he |
| 84 | have hrt : r = t := by simpa only [hfst] using congrArg Prod.fst he |
| 85 | subst t |
| 86 | rw [hshape r v, hshape r w] at he |
| 87 | exact Prod.ext rfl (add_left_cancel (congrArg Prod.snd he)) |
| 88 | · rintro ⟨r, v⟩ |
| 89 | exact ⟨(r, v - (A (r, 0)).2), by rw [hshape]; simp⟩ |
| 90 | obtain ⟨Q, hpQ, hQU, hQF, _, hQi⟩ := |
| 91 | exists_smooth_euclidean_localInverse hU hF hp hbij |
| 92 | have hfix : F (s, p) = (s, p) := Prod.ext rfl (hi.self_of_nhds) |
| 93 | refine ⟨Q.target, fun z => (Q.symm z).2, Q.open_target, ?_, hQi.snd, ?_⟩ |
| 94 | · simpa only [hQF, hfix] using Q.map_source hpQ |
| 95 | · intro z hz |
| 96 | have hq := Q.right_inv hz |
| 97 | rw [hQF] at hq |
| 98 | have ht : (Q.symm z).1 = z.1 := by simpa only [F] using congrArg Prod.fst hq |
| 99 | have hpU := hQU (Q.symm.map_source hz) |
| 100 | have hv : f (Q.symm z) = z.2 := congrArg Prod.snd hq |
| 101 | simpa only [← ht, Prod.mk.eta] using And.intro hpU hv |
| 102 | |
| 103 | |
| 104 | variable {n : ℕ} {M : Type*} [TopologicalSpace M] |
| 105 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 106 | |
| 107 | /-- An initially identity smooth family has a jointly smooth spatial right |
| 108 | inverse on a spacetime neighborhood of every initial point. -/ |
| 109 | theorem exists_smooth_spatial_rightInverse_near_initial |
| 110 | {J : Set ℝ} {V : Set M} (hJ : IsOpen J) (hV : IsOpen V) |
| 111 | {Φ : ℝ × M → M} |
| 112 | (hΦ : ContMDiffOn (𝓘(ℝ, ℝ).prod (𝓡 n)) (𝓡 n) ∞ Φ (J ×ˢ V)) |
| 113 | {s : ℝ} (hs : s ∈ J) (hinit : ∀ y ∈ V, Φ (s, y) = y) |
| 114 | {p : M} (hp : p ∈ V) : |
| 115 | ∃ (W : Set (ℝ × M)) (ψ : ℝ × M → M), |
| 116 | IsOpen W ∧ (s, p) ∈ W ∧ |
| 117 | ContMDiffOn (𝓘(ℝ, ℝ).prod (𝓡 n)) (𝓡 n) ∞ ψ W ∧ |
| 118 | ∀ z ∈ W, z.1 ∈ J ∧ ψ z ∈ V ∧ Φ (z.1, ψ z) = z.2 := by |
| 119 | let E := EuclideanSpace ℝ (Fin n) |
| 120 | let c := extChartAt (𝓡 n) p |
| 121 | have hc : ContMDiffOn (𝓡 n) 𝓘(ℝ, E) ∞ c c.source := by |
| 122 | simpa only [c, extChartAt_source] using |
| 123 | (contMDiffOn_extChartAt (I := 𝓡 n) (x := p) (n := ∞)) |
| 124 | let κ : ℝ × E → ℝ × M := fun z => (z.1, c.symm z.2) |
| 125 | let D : Set (ℝ × E) := univ ×ˢ c.target |
| 126 | have hD : IsOpen D := isOpen_univ.prod (isOpen_extChartAt_target p) |
| 127 | have hκ : ContMDiffOn 𝓘(ℝ, ℝ × E) (𝓘(ℝ, ℝ).prod (𝓡 n)) ∞ κ D := by |
| 128 | apply contDiff_fst.contMDiff.contMDiffOn.prodMk |
| 129 | exact (contMDiffOn_extChartAt_symm p).comp contDiff_snd.contMDiff.contMDiffOn |
| 130 | (fun z hz => hz.2) |
| 131 | let D₁ := D ∩ κ ⁻¹' (J ×ˢ V) |
| 132 | have hD₁ : IsOpen D₁ := hκ.continuousOn.isOpen_inter_preimage hD (hJ.prod hV) |
| 133 | have hP : ContMDiffOn 𝓘(ℝ, ℝ × E) (𝓡 n) ∞ (Φ ∘ κ) D₁ := |
| 134 | hΦ.comp (hκ.mono inter_subset_left) (fun z hz => hz.2) |
| 135 | let U := D₁ ∩ (Φ ∘ κ) ⁻¹' c.source |
| 136 | have hU : IsOpen U := hP.continuousOn.isOpen_inter_preimage hD₁ |
| 137 | (isOpen_extChartAt_source p) |
| 138 | let f : ℝ × E → E := fun z => c (Φ (κ z)) |
| 139 | have hf : ContDiffOn ℝ ∞ f U := |
| 140 | (hc.comp (hP.mono inter_subset_left) |
| 141 | (fun z hz => hz.2)).contDiffOn |
| 142 | have hcp : c.symm (c p) = p := c.left_inv (mem_extChartAt_source p) |
| 143 | have hpU : (s, c p) ∈ U := by |
| 144 | refine ⟨⟨⟨mem_univ _, mem_extChartAt_target p⟩, ?_⟩, ?_⟩ |
| 145 | · change (s, c.symm (c p)) ∈ J ×ˢ V |
| 146 | rw [hcp] |
| 147 | exact ⟨hs, hp⟩ |
| 148 | · change Φ (s, c.symm (c p)) ∈ c.source |
| 149 | rw [hcp, hinit p hp] |
| 150 | exact mem_extChartAt_source p |
| 151 | have hi : ∀ᶠ y in 𝓝 (c p), f (s, y) = y := by |
| 152 | have hcs : ContinuousAt c.symm (c p) := |
| 153 | continuousAt_extChartAt_symm p |
| 154 | have hVn : ∀ᶠ y in 𝓝 (c p), c.symm y ∈ V := |
| 155 | hcs.preimage_mem_nhds (by rw [hcp]; exact hV.mem_nhds hp) |
| 156 | filter_upwards [hVn, (isOpen_extChartAt_target (I := 𝓡 n) p).mem_nhds |
| 157 | (mem_extChartAt_target p)] with y hy hyt |
| 158 | change c (Φ (s, c.symm y)) = y |
| 159 | rw [hinit _ hy, c.right_inv hyt] |
| 160 | obtain ⟨W₀, ψ₀, hW₀, hpW₀, hψ₀, hright⟩ := |
| 161 | exists_smooth_euclidean_parameterInverse hU hf hpU hi |
| 162 | let C : Set (ℝ × M) := univ ×ˢ c.source |
| 163 | let χ : ℝ × M → ℝ × E := fun z => (z.1, c z.2) |
| 164 | have hC : IsOpen C := isOpen_univ.prod (isOpen_extChartAt_source p) |
| 165 | have hχ : ContMDiffOn (𝓘(ℝ, ℝ).prod (𝓡 n)) 𝓘(ℝ, ℝ × E) ∞ χ C := by |
| 166 | exact contMDiff_fst.contMDiffOn.prodMk_space |
| 167 | (hc.comp contMDiff_snd.contMDiffOn (fun z hz => hz.2)) |
| 168 | let W := C ∩ χ ⁻¹' W₀ |
| 169 | let ψ : ℝ × M → M := fun z => c.symm (ψ₀ (χ z)) |
| 170 | have hW : IsOpen W := hχ.continuousOn.isOpen_inter_preimage hC hW₀ |
| 171 | have hright' (z : ℝ × M) (hz : z ∈ W) : |
| 172 | (z.1, ψ₀ (χ z)) ∈ U ∧ f (z.1, ψ₀ (χ z)) = c z.2 := |
| 173 | hright (χ z) hz.2 |
| 174 | refine ⟨W, ψ, hW, ⟨⟨mem_univ _, mem_extChartAt_source p⟩, hpW₀⟩, ?_, ?_⟩ |
| 175 | · apply (contMDiffOn_extChartAt_symm p).comp |
| 176 | (hψ₀.contMDiffOn.comp (hχ.mono inter_subset_left) (fun z hz => hz.2)) |
| 177 | intro z hz |
| 178 | exact (hright' z hz).1.1.1.2 |
| 179 | · intro z hz |
| 180 | have hr := hright' z hz |
| 181 | refine ⟨hr.1.1.2.1, hr.1.1.2.2, ?_⟩ |
| 182 | have hv := congrArg c.symm hr.2 |
| 183 | change c.symm (c (Φ (z.1, ψ z))) = c.symm (c z.2) at hv |
| 184 | have hsource : Φ (z.1, ψ z) ∈ c.source := hr.1.2 |
| 185 | rw [c.left_inv hsource, c.left_inv hz.1.2] at hv |
| 186 | exact hv |
| 187 | |
| 188 | end Poincare.Manifold |