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.ImplicitContDiff |
| 2 | import Mathlib.Geometry.Manifold.Instances.Real |
| 3 | import Mathlib.Geometry.Manifold.MFDeriv.NormedSpace |
| 4 | import Mathlib.Geometry.Manifold.Algebra.LieGroup |
| 5 | import Mathlib.Analysis.Calculus.Deriv.MeanValue |
| 6 | |
| 7 | /-! |
| 8 | # Smooth hitting times for uniformly decreasing trajectories |
| 9 | |
| 10 | Strict decrease gives uniqueness and a quantitative time bound. The |
| 11 | intermediate value theorem constructs the roots, and local implicit |
| 12 | functions identify the selected roots smoothly on a common open domain. |
| 13 | -/ |
| 14 | |
| 15 | noncomputable section |
| 16 | set_option autoImplicit false |
| 17 | set_option backward.isDefEq.respectTransparency false |
| 18 | open Set Filter |
| 19 | open scoped Manifold ContDiff Bundle Topology |
| 20 | |
| 21 | namespace Poincare.Manifold |
| 22 | private theorem contMDiffAt_unique_time_root |
| 23 | {n : ℕ} {M : Type*} [TopologicalSpace M] |
| 24 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 25 | {F : ℝ × M → ℝ} {σ : M → ℝ} {I : Set ℝ} {V : Set M} |
| 26 | (hI : IsOpen I) (hV : IsOpen V) |
| 27 | (hF : ContMDiffOn (𝓘(ℝ, ℝ).prod (𝓡 n)) 𝓘(ℝ, ℝ) ∞ F (I ×ˢ V)) |
| 28 | (hroot : ∀ y ∈ V, σ y ∈ I ∧ F (σ y, y) = 0) |
| 29 | (hinj : ∀ y ∈ V, InjOn (fun s => F (s, y)) I) |
| 30 | {y : M} (hy : y ∈ V) {v : ℝ} (hv : v ≠ 0) |
| 31 | (hder : HasDerivAt (fun s => F (s, y)) v (σ y)) : |
| 32 | ContMDiffAt (𝓡 n) 𝓘(ℝ, ℝ) ∞ σ y := by |
| 33 | let e := extChartAt (𝓡 n) y |
| 34 | have he := (contMDiffWithinAt_extChartAt_symm_target (n := ∞) y |
| 35 | (mem_extChartAt_target y)).contMDiffAt |
| 36 | (extChartAt_target_mem_nhds' (I := 𝓡 n) (mem_extChartAt_target y)) |
| 37 | let G : EuclideanSpace ℝ (Fin n) × ℝ → ℝ := fun q => F (q.2, e.symm q.1) |
| 38 | let q₀ : EuclideanSpace ℝ (Fin n) × ℝ := (e y, σ y) |
| 39 | have hG : ContDiffAt ℝ ∞ G q₀ := by |
| 40 | have he' : ContMDiffAt 𝓘(ℝ, EuclideanSpace ℝ (Fin n) × ℝ) (𝓡 n) ∞ |
| 41 | (fun q => e.symm q.1) q₀ := he.comp q₀ contDiffAt_fst.contMDiffAt |
| 42 | have hpair : ContMDiffAt 𝓘(ℝ, EuclideanSpace ℝ (Fin n) × ℝ) |
| 43 | (𝓘(ℝ, ℝ).prod (𝓡 n)) ∞ (fun q => (q.2, e.symm q.1)) q₀ := |
| 44 | contDiffAt_snd.contMDiffAt.prodMk he' |
| 45 | have hF' := hF.contMDiffAt ((hI.prod hV).mem_nhds |
| 46 | (show (σ y, y) ∈ I ×ˢ V from ⟨(hroot y hy).1, hy⟩)) |
| 47 | have hsame : (q₀.2, e.symm q₀.1) = (σ y, y) := by |
| 48 | simp only [q₀, e.left_inv (mem_extChartAt_source y)] |
| 49 | rw [← hsame] at hF' |
| 50 | exact (hF'.comp q₀ hpair).contDiffAt |
| 51 | have hGder : HasDerivAt (fun s => G (q₀.1, s)) v (σ y) := by |
| 52 | simpa only [G, q₀, e.left_inv (mem_extChartAt_source y)] using hder |
| 53 | have hpart : (fderiv ℝ G q₀).comp |
| 54 | (ContinuousLinearMap.inr ℝ (EuclideanSpace ℝ (Fin n)) ℝ) = |
| 55 | v • (ContinuousLinearMap.id ℝ ℝ) := by |
| 56 | have hd := (hG.differentiableAt (by simp)).hasFDerivAt |
| 57 | have hcomp := hd.comp (σ y) |
| 58 | ((hasFDerivAt_const q₀.1 (σ y)).prodMk (hasFDerivAt_id (σ y))) |
| 59 | have heq := hcomp.unique hGder.hasFDerivAt |
| 60 | apply ContinuousLinearMap.ext |
| 61 | intro z |
| 62 | have hz := congrArg (fun L : ℝ →L[ℝ] ℝ => L z) heq |
| 63 | change fderiv ℝ G q₀ (0, z) = z * v at hz |
| 64 | change fderiv ℝ G q₀ (0, z) = v * z |
| 65 | simpa only [mul_comm] using hz |
| 66 | have hinv : ((fderiv ℝ G q₀).comp |
| 67 | (ContinuousLinearMap.inr ℝ (EuclideanSpace ℝ (Fin n)) ℝ)).IsInvertible := by |
| 68 | rw [hpart] |
| 69 | refine ⟨(LinearEquiv.smulOfNeZero ℝ ℝ v hv).toContinuousLinearEquiv, ?_⟩ |
| 70 | apply ContinuousLinearMap.ext |
| 71 | intro z |
| 72 | rfl |
| 73 | let ψ := hG.implicitFunction (by simp) hinv |
| 74 | have hψ : ContDiffAt ℝ ∞ ψ (e y) := hG.contDiffAt_implicitFunction (by simp) hinv |
| 75 | have hψzero : ψ (e y) = σ y := hG.implicitFunction_apply_self (by simp) hinv |
| 76 | have hψeq : ∀ᶠ z in 𝓝 (e y), G (z, ψ z) = G q₀ := |
| 77 | hG.eventually_apply_implicitFunction (by simp) hinv |
| 78 | have hψI : ∀ᶠ z in 𝓝 (e y), ψ z ∈ I := by |
| 79 | apply hψ.continuousAt.preimage_mem_nhds |
| 80 | rw [hψzero] |
| 81 | exact hI.mem_nhds (hroot y hy).1 |
| 82 | have hechart : ContMDiffAt (𝓡 n) (𝓡 n) ∞ e y := contMDiffAt_extChartAt |
| 83 | have hcomp : ContMDiffAt (𝓡 n) 𝓘(ℝ, ℝ) ∞ (fun z => ψ (e z)) y := |
| 84 | hψ.contMDiffAt.comp y hechart |
| 85 | apply hcomp.congr_of_eventuallyEq |
| 86 | filter_upwards [hechart.continuousAt hψeq, hechart.continuousAt hψI, |
| 87 | hV.mem_nhds hy, extChartAt_source_mem_nhds' (I := 𝓡 n) (mem_extChartAt_source y)] with z heq hIz hz hchartz |
| 88 | apply (hinj z hz) (hroot z hz).1 hIz |
| 89 | change F (σ z, z) = F (ψ (e z), z) |
| 90 | rw [(hroot z hz).2] |
| 91 | have hback : e.symm (e z) = z := e.left_inv hchartz |
| 92 | change 0 = F (ψ (e z), z) |
| 93 | conv_rhs => arg 1; arg 2; rw [← hback] |
| 94 | change 0 = G (e z, ψ (e z)) |
| 95 | rw [heq] |
| 96 | simpa only [G, q₀, e.left_inv (mem_extChartAt_source y)] using (hroot y hy).2.symm |
| 97 | end Poincare.Manifold |
| 98 | |
| 99 | |
| 100 | namespace Poincare.Manifold |
| 101 | private theorem time_control_of_derivative_le_neg |
| 102 | {F : ℝ → ℝ} {F' : ℝ → ℝ} {a b c s : ℝ} |
| 103 | (ha : a < 0) (hb : 0 < b) (hc : 0 < c) (hs : s ∈ Ioo a b) |
| 104 | (hF : ∀ t ∈ Ioo a b, HasDerivAt F (F' t) t) |
| 105 | (hd : ∀ t ∈ Ioo a b, F' t ≤ -c) : |
| 106 | |s| ≤ |F 0 - F s| / c ∧ (0 ≤ s ↔ F s ≤ F 0) := by |
| 107 | have hz : (0 : ℝ) ∈ Ioo a b := ⟨ha, hb⟩ |
| 108 | have hcont : ContinuousOn F (Ioo a b) := fun t ht => |
| 109 | (hF t ht).continuousAt.continuousWithinAt |
| 110 | have hdiff : DifferentiableOn ℝ F (interior (Ioo a b)) := by |
| 111 | simpa only [interior_Ioo] using |
| 112 | (show DifferentiableOn ℝ F (Ioo a b) from fun t ht => |
| 113 | (hF t ht).differentiableAt.differentiableWithinAt) |
| 114 | have hder : ∀ t ∈ interior (Ioo a b), deriv F t ≤ -c := by |
| 115 | simpa only [interior_Ioo] using |
| 116 | (show ∀ t ∈ Ioo a b, deriv F t ≤ -c from fun t ht => by |
| 117 | rw [(hF t ht).deriv]; exact hd t ht) |
| 118 | by_cases hpos : 0 ≤ s |
| 119 | · have hle := (convex_Ioo a b).image_sub_le_mul_sub_of_deriv_le |
| 120 | hcont hdiff hder 0 hz s hs hpos |
| 121 | have hval : F s ≤ F 0 := by nlinarith |
| 122 | refine ⟨?_, iff_of_true hpos hval⟩ |
| 123 | rw [abs_of_nonneg hpos, abs_of_nonneg (sub_nonneg.mpr hval)] |
| 124 | exact (le_div_iff₀ hc).mpr (by nlinarith) |
| 125 | · have hneg : s < 0 := lt_of_not_ge hpos |
| 126 | have hle := (convex_Ioo a b).image_sub_le_mul_sub_of_deriv_le |
| 127 | hcont hdiff hder s hs 0 hz hneg.le |
| 128 | have hval : F 0 < F s := by nlinarith |
| 129 | refine ⟨?_, iff_of_false hpos (not_le.mpr hval)⟩ |
| 130 | rw [abs_of_neg hneg, abs_of_neg (sub_neg.mpr hval)] |
| 131 | exact (le_div_iff₀ hc).mpr (by nlinarith) |
| 132 | end Poincare.Manifold |
| 133 | |
| 134 | |
| 135 | namespace Poincare.Manifold |
| 136 | private theorem image_sub_le_of_derivative_le |
| 137 | {F F' : ℝ → ℝ} {a b c u v : ℝ} |
| 138 | (hF : ∀ s ∈ Ioo a b, HasDerivAt F (F' s) s) |
| 139 | (hd : ∀ s ∈ Ioo a b, F' s ≤ -c) |
| 140 | (hu : u ∈ Ioo a b) (hv : v ∈ Ioo a b) (huv : u ≤ v) : |
| 141 | F v - F u ≤ -c * (v - u) := |
| 142 | (convex_Ioo a b).image_sub_le_mul_sub_of_deriv_le |
| 143 | (fun s hs => (hF s hs).continuousAt.continuousWithinAt) |
| 144 | (fun s hs => (hF s (interior_subset hs)).differentiableAt.differentiableWithinAt) |
| 145 | (fun s hs => by rw [(hF s (interior_subset hs)).deriv]; exact hd s (interior_subset hs)) |
| 146 | u hu v hv huv |
| 147 | |
| 148 | private theorem strictAntiOn_of_derivative_le_neg |
| 149 | {F F' : ℝ → ℝ} {a b c : ℝ} (hc : 0 < c) |
| 150 | (hF : ∀ s ∈ Ioo a b, HasDerivAt F (F' s) s) |
| 151 | (hd : ∀ s ∈ Ioo a b, F' s ≤ -c) : StrictAntiOn F (Ioo a b) := by |
| 152 | intro u hu v hv huv |
| 153 | have hle := image_sub_le_of_derivative_le hF hd hu hv huv.le |
| 154 | have hneg : -c * (v - u) < 0 := mul_neg_of_neg_of_pos (by linarith) (sub_pos.mpr huv) |
| 155 | linarith |
| 156 | end Poincare.Manifold |
| 157 | |
| 158 | |
| 159 | namespace Poincare.Manifold |
| 160 | theorem exists_smooth_hitting_time_of_derivative_le_neg |
| 161 | {n : ℕ} {M : Type*} [TopologicalSpace M] |
| 162 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 163 | {F : ℝ × M → ℝ} {F' : ℝ × M → ℝ} {W : Set M} (hW : IsOpen W) |
| 164 | {T δ c : ℝ} (hT : 0 ≤ T) (hδ : 0 < δ) (hc : 0 < c) |
| 165 | (hF : ContMDiffOn (𝓘(ℝ, ℝ).prod (𝓡 n)) 𝓘(ℝ, ℝ) ∞ F |
| 166 | (Ioo (-δ) (T + δ) ×ˢ W)) |
| 167 | (hder : ∀ y ∈ W, ∀ s ∈ Ioo (-δ) (T + δ), HasDerivAt (fun u => F (u, y)) (F' (s, y)) s) |
| 168 | (hbound : ∀ y ∈ W, ∀ s ∈ Ioo (-δ) (T + δ), F' (s, y) ≤ -c) |
| 169 | (t : ℝ) : |
| 170 | ∃ (V : Set M) (σ : M → ℝ), IsOpen V ∧ V ⊆ W ∧ |
| 171 | {y | y ∈ W ∧ t ≤ F (0, y) ∧ F (0, y) ≤ t + c * T} ⊆ V ∧ |
| 172 | ContMDiffOn (𝓡 n) 𝓘(ℝ, ℝ) ∞ σ V ∧ |
| 173 | (∀ y ∈ V, σ y ∈ Ioo (-δ) (T + δ) ∧ F (σ y, y) = t ∧ |
| 174 | |σ y| ≤ |F (0, y) - t| / c ∧ (0 ≤ σ y ↔ t ≤ F (0, y)) ∧ |
| 175 | (F (0, y) = t → σ y = 0)) ∧ |
| 176 | ∀ y ∈ V, t ≤ F (0, y) → F (0, y) ≤ t + c * T → σ y ∈ Icc 0 T := by |
| 177 | classical |
| 178 | let a := -δ / 2 |
| 179 | let b := T + δ / 2 |
| 180 | have ha : a ∈ Ioo (-δ) (T + δ) := by constructor <;> dsimp [a] <;> linarith |
| 181 | have hb : b ∈ Ioo (-δ) (T + δ) := by constructor <;> dsimp [b] <;> linarith |
| 182 | have hab : a ≤ b := by dsimp [a,b]; linarith |
| 183 | have hzero : (0 : ℝ) ∈ Ioo (-δ) (T + δ) := by constructor <;> linarith |
| 184 | have hIcc : Icc a b ⊆ Ioo (-δ) (T + δ) := fun _ hu => |
| 185 | ⟨ha.1.trans_le hu.1, hu.2.trans_lt hb.2⟩ |
| 186 | have hFtime (s : ℝ) (hs : s ∈ Ioo (-δ) (T + δ)) : |
| 187 | ContinuousOn (fun y => F (s, y)) W := by |
| 188 | intro y hy |
| 189 | exact ((hF.contMDiffAt ((isOpen_Ioo.prod hW).mem_nhds ⟨hs, hy⟩)).comp y |
| 190 | (contMDiffAt_const.prodMk contMDiffAt_id)).continuousAt.continuousWithinAt |
| 191 | let V := W ∩ {y | t < F (a, y)} ∩ {y | F (b, y) < t} |
| 192 | have hVo : IsOpen V := by |
| 193 | have haopen := (hFtime a ha).isOpen_inter_preimage hW (isOpen_Ioi (a := t)) |
| 194 | have hbopen := (hFtime b hb).isOpen_inter_preimage hW (isOpen_Iio (a := t)) |
| 195 | convert haopen.inter hbopen using 1 |
| 196 | ext y |
| 197 | simp only [V, mem_inter_iff, mem_ofPred_eq, mem_preimage, mem_Ioi, mem_Iio] |
| 198 | tauto |
| 199 | have hVW : V ⊆ W := fun _ hy => hy.1.1 |
| 200 | have hK : {y | y ∈ W ∧ t ≤ F (0, y) ∧ F (0, y) ≤ t + c * T} ⊆ V := by |
| 201 | intro y hy |
| 202 | have hleft := Poincare.Manifold.image_sub_le_of_derivative_le |
| 203 | (hder y hy.1) (hbound y hy.1) ha hzero (by dsimp [a]; linarith) |
| 204 | have hright := Poincare.Manifold.image_sub_le_of_derivative_le |
| 205 | (hder y hy.1) (hbound y hy.1) hzero hb (by dsimp [b]; linarith) |
| 206 | refine ⟨⟨hy.1, ?_⟩, ?_⟩ |
| 207 | · change t < F (a,y) |
| 208 | have hpos : 0 < c * (0-a) := mul_pos hc (by dsimp[a]; linarith) |
| 209 | nlinarith [hy.2.1] |
| 210 | · change F (b,y) < t |
| 211 | have hpos : 0 < c * (b-T) := mul_pos hc (by dsimp[b]; linarith) |
| 212 | nlinarith [hy.2.2] |
| 213 | have hex (y : M) : ∃ s : ℝ, y ∈ V → s ∈ Ioo (-δ) (T + δ) ∧ F (s, y) = t := by |
| 214 | by_cases hy : y ∈ V |
| 215 | · obtain ⟨s, hs, heq⟩ := intermediate_value_Icc' hab |
| 216 | (show ContinuousOn (fun s => F (s,y)) (Icc a b) from fun s hs => |
| 217 | (hder y (hVW hy) s (hIcc hs)).continuousAt.continuousWithinAt) |
| 218 | ⟨hy.2.le, hy.1.2.le⟩ |
| 219 | exact ⟨s, fun _ => ⟨hIcc hs, heq⟩⟩ |
| 220 | · exact ⟨0, fun h => (hy h).elim⟩ |
| 221 | choose σ hσroot using hex |
| 222 | have hanti (y : M) (hy : y ∈ W) : StrictAntiOn (fun s => F (s,y)) (Ioo (-δ) (T + δ)) := |
| 223 | Poincare.Manifold.strictAntiOn_of_derivative_le_neg hc (hder y hy) (hbound y hy) |
| 224 | have hσsmooth : ContMDiffOn (𝓡 n) 𝓘(ℝ, ℝ) ∞ σ V := by |
| 225 | intro y hy |
| 226 | apply (contMDiffAt_unique_time_root isOpen_Ioo hVo |
| 227 | ((hF.mono (prod_mono_right hVW)).sub contMDiffOn_const) |
| 228 | (F := fun q => F q - t) (v := F' (σ y,y)) ?_ ?_ hy ?_ ?_).contMDiffWithinAt |
| 229 | · intro z hz |
| 230 | exact ⟨(hσroot z hz).1, sub_eq_zero.mpr (hσroot z hz).2⟩ |
| 231 | · intro z hz s hs u hu heq |
| 232 | apply (hanti z (hVW hz)).injOn hs hu |
| 233 | exact sub_left_injective heq |
| 234 | · exact (lt_of_le_of_lt (hbound y (hVW hy) _ (hσroot y hy).1) (by linarith : -c < 0)).ne |
| 235 | · exact (hder y (hVW hy) _ (hσroot y hy).1).sub_const t |
| 236 | have hcontrol (y : M) (hy : y ∈ V) : |
| 237 | |σ y| ≤ |F (0,y)-t| / c ∧ (0 ≤ σ y ↔ t ≤ F (0,y)) := by |
| 238 | have hd := Poincare.Manifold.time_control_of_derivative_le_neg |
| 239 | (by linarith : -δ < 0) (by linarith : 0 < T+δ) hc (hσroot y hy).1 |
| 240 | (hder y (hVW hy)) (hbound y (hVW hy)) |
| 241 | simpa only [(hσroot y hy).2] using hd |
| 242 | refine ⟨V, σ, hVo, hVW, hK, hσsmooth, ?_, ?_⟩ |
| 243 | · intro y hy |
| 244 | refine ⟨(hσroot y hy).1, (hσroot y hy).2, (hcontrol y hy).1, (hcontrol y hy).2, ?_⟩ |
| 245 | intro heq |
| 246 | apply abs_eq_zero.mp |
| 247 | apply le_antisymm _ (abs_nonneg _) |
| 248 | simpa only [heq, sub_self, abs_zero, zero_div] using (hcontrol y hy).1 |
| 249 | · intro y hy hlow hupp |
| 250 | have hs0 := (hcontrol y hy).2.mpr hlow |
| 251 | refine ⟨hs0, ?_⟩ |
| 252 | have hle : σ y ≤ (F (0,y)-t)/c := by |
| 253 | simpa only [abs_of_nonneg hs0, abs_of_nonneg (sub_nonneg.mpr hlow)] using (hcontrol y hy).1 |
| 254 | exact hle.trans ((div_le_iff₀ hc).mpr (by linarith)) |
| 255 | end Poincare.Manifold |
| 256 |