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.MeasureTheory.Integral.IntervalIntegral.Basic |
| 2 | import Mathlib.Tactic.Linarith |
| 3 | |
| 4 | /-! |
| 5 | # Forward quotients from an integral upper bound |
| 6 | |
| 7 | The real-analysis consequence used after the limiting argument in the |
| 8 | 2015 Morgan--Tian correction, Lemma 0.4, pp. 7-8. The upper integrand is |
| 9 | continuous; the bounded function need not have a classical derivative. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | open MeasureTheory Set |
| 15 | open scoped intervalIntegral |
| 16 | |
| 17 | namespace intervalIntegral |
| 18 | |
| 19 | /-- An integral upper bound gives upper forward difference quotients, |
| 20 | including at the left endpoint. This implements the limiting repair of |
| 21 | corrected Lemma 0.4 in `reviews/errata/2026-09-14-m62-curve-evolution.md`. -/ |
| 22 | theorem forward_quotient_le_of_sub_le_integral {u f : ℝ → ℝ} {a b : ℝ} |
| 23 | (hf : ContinuousOn f (Icc a b)) |
| 24 | (hbound : ∀ s t : ℝ, s ∈ Icc a b → t ∈ Icc a b → s ≤ t → |
| 25 | u t - u s ≤ ∫ r in s..t, f r) |
| 26 | {t : ℝ} (ht : t ∈ Ico a b) {ε : ℝ} (hε : 0 < ε) : |
| 27 | ∃ δ : ℝ, 0 < δ ∧ ∀ h : ℝ, 0 < h → h < δ → t + h ∈ Icc a b → |
| 28 | (u (t + h) - u t) / h ≤ f t + ε := by |
| 29 | have ht' : t ∈ Icc a b := ⟨ht.1, ht.2.le⟩ |
| 30 | obtain ⟨δ, hδ, hclose⟩ := Metric.continuousWithinAt_iff.mp (hf t ht') ε hε |
| 31 | refine ⟨δ, hδ, ?_⟩ |
| 32 | intro h hh hhδ hth |
| 33 | have horder : t ≤ t + h := le_add_of_nonneg_right hh.le |
| 34 | have hsub : Icc t (t + h) ⊆ Icc a b := Icc_subset_Icc ht.1 hth.2 |
| 35 | have hfi : IntervalIntegrable f volume t (t + h) := |
| 36 | (hf.mono (by simpa only [uIcc_of_le horder] using hsub)).intervalIntegrable |
| 37 | have hi : (∫ r in t..t + h, f r) ≤ h * (f t + ε) := by |
| 38 | calc |
| 39 | _ ≤ ∫ _r in t..t + h, f t + ε := by |
| 40 | apply integral_mono_on horder hfi intervalIntegrable_const |
| 41 | intro r hr |
| 42 | have hd : dist r t < δ := by |
| 43 | rw [Real.dist_eq, abs_of_nonneg (sub_nonneg.mpr hr.1)] |
| 44 | linarith [hr.2] |
| 45 | have he := hclose (hsub hr) hd |
| 46 | rw [Real.dist_eq] at he |
| 47 | have he' := (abs_lt.mp he).2 |
| 48 | linarith |
| 49 | _ = h * (f t + ε) := by simp [mul_add] |
| 50 | apply (div_le_iff₀ hh).mpr |
| 51 | have hb := hbound t (t + h) ht' hth horder |
| 52 | nlinarith |
| 53 | |
| 54 | end intervalIntegral |