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 PoincareLib.Analysis.ODE.ScalarComparison |
| 2 | import Mathlib.MeasureTheory.Integral.IntervalIntegral.MeanValue |
| 3 | |
| 4 | /-! |
| 5 | # Pointwise bounds from integral and differential inequalities |
| 6 | |
| 7 | A nonnegative scalar function with bounded integral and an upper differential |
| 8 | inequality has a uniform bound after a positive initial interval. The integral |
| 9 | mean-value theorem supplies an initial value for the scalar comparison. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | open Set MeasureTheory |
| 15 | open scoped intervalIntegral |
| 16 | |
| 17 | namespace Poincare.ODE |
| 18 | |
| 19 | /-- An integral bound and a one-sided differential inequality bound the function |
| 20 | uniformly on the terminal part of the interval. Only interior derivatives are needed. -/ |
| 21 | theorem le_mul_exp_of_integral_le_of_deriv_le_mul |
| 22 | {A A' : ℝ → ℝ} {a m b K V : ℝ} |
| 23 | (ham : a < m) (hmb : m ≤ b) |
| 24 | (hcont : ContinuousOn A (Icc a b)) |
| 25 | (hnonneg : ∀ x ∈ Icc a b, 0 ≤ A x) |
| 26 | (hderiv : ∀ x ∈ Ioo a b, HasDerivAt A (A' x) x) |
| 27 | (hbound : ∀ x ∈ Ioo a b, A' x ≤ K * A x) |
| 28 | (hmass : (∫ x in a..b, A x) ≤ V) : |
| 29 | ∀ t ∈ Icc m b, |
| 30 | A t ≤ V / (m - a) * Real.exp (max K 0 * (b - a)) := by |
| 31 | have hcont_am : ContinuousOn A (Icc a m) := |
| 32 | hcont.mono (Icc_subset_Icc le_rfl hmb) |
| 33 | obtain ⟨s, hs, hmean⟩ := exists_eq_const_mul_intervalIntegral_of_nonneg |
| 34 | (a := a) (b := m) (f := A) (g := fun _ => (1 : ℝ)) (μ := volume) |
| 35 | (by simpa only [uIcc_of_le ham.le] using hcont_am) |
| 36 | intervalIntegrable_const (fun _ _ => zero_le_one) |
| 37 | have hs_am : s ∈ Icc a m := by simpa only [uIcc_of_le ham.le] using hs |
| 38 | have hs_ab : s ∈ Icc a b := ⟨hs_am.1, hs_am.2.trans hmb⟩ |
| 39 | simp only [mul_one, intervalIntegral.integral_const, smul_eq_mul] at hmean |
| 40 | have hsmall : (∫ x in a..m, A x) ≤ V := by |
| 41 | refine (intervalIntegral.integral_mono_interval le_rfl ham.le hmb ?_ |
| 42 | (hcont.intervalIntegrable_of_Icc (ham.le.trans hmb))).trans hmass |
| 43 | filter_upwards [ae_restrict_mem measurableSet_Ioc] with x hx |
| 44 | exact hnonneg x ⟨hx.1.le, hx.2⟩ |
| 45 | have hs_bound : A s ≤ V / (m - a) := by |
| 46 | apply (le_div_iff₀ (sub_pos.mpr ham)).2 |
| 47 | exact hmean.symm.trans_le hsmall |
| 48 | intro t ht |
| 49 | have hst : s ≤ t := hs_am.2.trans ht.1 |
| 50 | have hsub {x : ℝ} (hx : x ∈ Ioo s t) : x ∈ Ioo a b := |
| 51 | ⟨hs_am.1.trans_lt hx.1, hx.2.trans_le ht.2⟩ |
| 52 | have hcompare : A t ≤ A s * Real.exp (K * (t - s)) := by |
| 53 | have h := mul_exp_neg_integral_le_of_deriv_add_mul_nonneg hst |
| 54 | (f := fun x => -A x) (f' := fun x => -A' x) (q := fun _ => -K) |
| 55 | (hcont.neg.mono (Icc_subset_Icc hs_am.1 ht.2)) |
| 56 | continuousOn_const intervalIntegrable_const |
| 57 | (fun x hx => (hderiv x (hsub hx)).neg) |
| 58 | (by |
| 59 | intro x hx |
| 60 | nlinarith only [hbound x (hsub hx)]) |
| 61 | have hexponent : -(∫ _ in s..t, -K) = K * (t - s) := by |
| 62 | rw [intervalIntegral.integral_const, smul_eq_mul] |
| 63 | ring |
| 64 | rw [hexponent, neg_mul, neg_le_neg_iff] at h |
| 65 | exact h |
| 66 | have hexponent : K * (t - s) ≤ max K 0 * (b - a) := by |
| 67 | calc |
| 68 | K * (t - s) ≤ max K 0 * (t - s) := |
| 69 | mul_le_mul_of_nonneg_right (le_max_left K 0) (sub_nonneg.mpr hst) |
| 70 | _ ≤ max K 0 * (b - a) := |
| 71 | mul_le_mul_of_nonneg_left (by linarith [ht.2, hs_am.1]) (le_max_right K 0) |
| 72 | calc |
| 73 | A t ≤ A s * Real.exp (K * (t - s)) := hcompare |
| 74 | _ ≤ A s * Real.exp (max K 0 * (b - a)) := |
| 75 | mul_le_mul_of_nonneg_left (Real.exp_le_exp.mpr hexponent) (hnonneg s hs_ab) |
| 76 | _ ≤ V / (m - a) * Real.exp (max K 0 * (b - a)) := |
| 77 | mul_le_mul_of_nonneg_right hs_bound (Real.exp_pos _).le |
| 78 | |
| 79 | end Poincare.ODE |