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.MeanValue |
| 2 | import Mathlib.Topology.Semicontinuity.Basic |
| 3 | |
| 4 | /-! |
| 5 | # Global lower bounds from stationary descent |
| 6 | |
| 7 | A compact minimum of a linearly perturbed lower-semicontinuous function |
| 8 | cannot admit a stationary upper support while a proper nonnegative exhaustion |
| 9 | decreases linearly. This form of the one-sided comparison argument avoids |
| 10 | requiring continuity of the minima over an entire family of compact sets. |
| 11 | |
| 12 | The application is the injectivity argument of Maeder--Baumdicker--Seidel, |
| 13 | Lemma 5.1 and Theorem 1, pp. 35--38. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | |
| 18 | open Set Filter |
| 19 | open scoped Topology |
| 20 | |
| 21 | namespace Poincare |
| 22 | |
| 23 | /-- Compact sublevels and stationary descent away from the zero set propagate |
| 24 | a lower bound on the zero set to a global lower bound, up to the cutoff. -/ |
| 25 | theorem lower_bound_of_stationary_descent |
| 26 | {X : Type*} [TopologicalSpace X] {f b : X → ℝ} {m C : ℝ} |
| 27 | (hf : LowerSemicontinuous f) (hb : Continuous b) (hbnonneg : ∀ x, 0 ≤ b x) |
| 28 | (hcompact : ∀ t : ℝ, IsCompact {x | b x ≤ t}) |
| 29 | (hzero : ∀ x, b x = 0 → m ≤ f x) |
| 30 | (hdescent : ∀ x, f x < min m C → 0 < b x → |
| 31 | ∃ y : X, b y ≤ b x ∧ |
| 32 | ∃ H δ : ℝ, 0 < H ∧ 0 < δ ∧ |
| 33 | ∃ F : ℝ → ℝ, ∃ c : ℝ → X, |
| 34 | F 0 = f x ∧ HasDerivAt F 0 0 ∧ |
| 35 | ∀ s ∈ Ioo 0 δ, f (c s) ≤ F s ∧ b (c s) ≤ b y - H * s) : |
| 36 | ∀ x, min m C ≤ f x := by |
| 37 | intro q |
| 38 | by_contra hnot |
| 39 | have hgap : 0 < min m C - f q := sub_pos.mpr (lt_of_not_ge hnot) |
| 40 | let ε := (min m C - f q) / (2 * (b q + 1)) |
| 41 | have hε : 0 < ε := div_pos hgap (by linarith [hbnonneg q]) |
| 42 | have hεeq : ε * (b q + 1) = (min m C - f q) / 2 := by |
| 43 | dsimp [ε] |
| 44 | field_simp [ne_of_gt (show 0 < b q + 1 by linarith [hbnonneg q])] |
| 45 | let G : X → ℝ := fun x => f x + ε * b x |
| 46 | have hG : LowerSemicontinuous G := |
| 47 | hf.add ((continuous_const.mul hb).lowerSemicontinuous) |
| 48 | have hGq : G q < min m C := by dsimp [G]; nlinarith |
| 49 | obtain ⟨x, hx, hmin⟩ := (hG.lowerSemicontinuousOn _).exists_isMinOn |
| 50 | (show ({x | b x ≤ b q} : Set X).Nonempty from ⟨q, show b q ≤ b q from le_rfl⟩) |
| 51 | (hcompact (b q)) |
| 52 | have hGx : G x < min m C := (hmin (show b q ≤ b q from le_rfl)).trans_lt hGq |
| 53 | have hfx : f x < min m C := by |
| 54 | exact (le_add_of_nonneg_right (mul_nonneg hε.le (hbnonneg x))).trans_lt hGx |
| 55 | have hbx : 0 < b x := by |
| 56 | apply lt_of_le_of_ne (hbnonneg x) |
| 57 | intro hzero' |
| 58 | have h := hzero x hzero'.symm |
| 59 | exact (not_lt_of_ge h) (hfx.trans_le (min_le_left _ _)) |
| 60 | obtain ⟨y, hby, H, δ, hH, hδ, F, c, hF0, hFd, hbound⟩ := |
| 61 | hdescent x hfx hbx |
| 62 | have hslope : ∀ᶠ s in 𝓝[>] (0 : ℝ), slope F 0 s < ε * H := |
| 63 | (hasDerivAt_iff_tendsto_slope_left_right.mp hFd).2 |
| 64 | (Iio_mem_nhds (mul_pos hε hH)) |
| 65 | have hnear : ∀ᶠ s in 𝓝[>] (0 : ℝ), s ∈ Ioo 0 δ := Ioo_mem_nhdsGT hδ |
| 66 | obtain ⟨s, hslope, hs⟩ := (hslope.and hnear).exists |
| 67 | obtain ⟨hfs, hbs⟩ := hbound s hs |
| 68 | have hcs : b (c s) ≤ b q := hbs.trans |
| 69 | ((sub_le_self _ (mul_pos hH hs.1).le).trans (hby.trans hx)) |
| 70 | have hminimal := hmin hcs |
| 71 | have hchange : F s - f x < ε * H * s := by |
| 72 | rw [slope_def_field, sub_zero, hF0, div_lt_iff₀ hs.1] at hslope |
| 73 | exact hslope |
| 74 | have hbs' := mul_le_mul_of_nonneg_left hbs hε.le |
| 75 | have hby' := mul_le_mul_of_nonneg_left hby hε.le |
| 76 | dsimp [G] at hminimal |
| 77 | nlinarith |
| 78 | |
| 79 | end Poincare |