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.Tactic |
| 3 | |
| 4 | /-! |
| 5 | # A forward comparison with a guarded quadratic derivative bound |
| 6 | |
| 7 | This is the scalar threshold-crossing step in the use of Morgan--Tian, |
| 8 | Lemma 11.2, pp. 268-269, in Lemma 16.8, pp. 372-373. A strict linear |
| 9 | barrier gives a uniform doubling time without a derivative estimate below |
| 10 | the prescribed threshold. See the M44 derivation `02-forward-scalar.md`. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open Set |
| 16 | |
| 17 | /-- A quadratic upper rate above a threshold gives a short forward doubling |
| 18 | bound. The time increment is the one derived for M44's use of Lemma 11.2. -/ |
| 19 | theorem le_two_mul_of_deriv_le_sq_above {f f' : ℝ → ℝ} {a b C M q : ℝ} |
| 20 | (hC : 0 < C) (hM : 0 < M) (hq : q ≤ M) |
| 21 | (hcont : ContinuousOn f (Icc a b)) |
| 22 | (hderiv : ∀ s ∈ Ico a b, HasDerivWithinAt f (f' s) (Ici s) s) |
| 23 | (hinitial : f a ≤ M) |
| 24 | (hrate : ∀ s ∈ Ico a b, q ≤ f s → f' s ≤ C * f s ^ 2) |
| 25 | (htime : 8 * C * M * (b - a) ≤ 1) : |
| 26 | ∀ s ∈ Icc a b, f s ≤ 2 * M := by |
| 27 | let B : ℝ → ℝ := fun s => M + 8 * C * M ^ 2 * (s - a) |
| 28 | have hBbounds (s : ℝ) (hs : s ∈ Icc a b) : M ≤ B s ∧ B s ≤ 2 * M := by |
| 29 | have hlo : 0 ≤ 8 * C * M ^ 2 * (s - a) := |
| 30 | mul_nonneg (by positivity) (sub_nonneg.mpr hs.1) |
| 31 | have htime' : 8 * C * M * (s - a) ≤ 1 := |
| 32 | (mul_le_mul_of_nonneg_left (sub_le_sub_right hs.2 a) (by positivity)).trans htime |
| 33 | have hhi := mul_le_mul_of_nonneg_right htime' hM.le |
| 34 | dsimp [B] |
| 35 | constructor <;> nlinarith |
| 36 | have hBd (s : ℝ) : HasDerivAt B (8 * C * M ^ 2) s := by |
| 37 | simpa only [B, id_eq, mul_one] using |
| 38 | (((hasDerivAt_id s).sub_const a).const_mul (8 * C * M ^ 2)).const_add M |
| 39 | have hle : ∀ s ∈ Icc a b, f s ≤ B s := by |
| 40 | apply image_le_of_deriv_right_lt_deriv_boundary hcont hderiv |
| 41 | · simpa only [B, sub_self, mul_zero, add_zero] using hinitial |
| 42 | · exact hBd |
| 43 | · intro s hs heq |
| 44 | obtain ⟨hlo, hhi⟩ := hBbounds s ⟨hs.1, hs.2.le⟩ |
| 45 | have hflo : M ≤ f s := by rwa [heq] |
| 46 | have hfhi : f s ≤ 2 * M := by rwa [heq] |
| 47 | have hsquare : f s ^ 2 ≤ 4 * M ^ 2 := by nlinarith |
| 48 | have hbound := (hrate s hs (hq.trans hflo)).trans |
| 49 | (mul_le_mul_of_nonneg_left hsquare hC.le) |
| 50 | have hpositive : 0 < C * M ^ 2 := mul_pos hC (sq_pos_of_pos hM) |
| 51 | nlinarith |
| 52 | intro s hs |
| 53 | exact (hle s hs).trans (hBbounds s hs).2 |