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.Geometry.CurveShortening.Comparison.AnnularEvolution.Modulus.ForwardEndpoint |
| 2 | import Mathlib.Analysis.ODE.Gronwall |
| 3 | |
| 4 | /-! |
| 5 | # Forward evolution through zero-area times |
| 6 | |
| 7 | Positive cutoffs satisfy the continuous Dini comparison, so a |
| 8 | nonnegative continuous infimum cannot leave zero when the multiplicative |
| 9 | bound is known at every positive point. This handles zero-area times in |
| 10 | MT2007 Lemma 19.15, pp. 447-449, without a degenerate minimizing annulus. |
| 11 | |
| 12 | Morgan--Tian context: Lemma 19.15 and its annular area-to-energy construction, printed pp. |
| 13 | 447-449. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | |
| 18 | open Set Filter |
| 19 | open scoped Topology |
| 20 | |
| 21 | namespace PoincareMT |
| 22 | |
| 23 | /-- A positive cutoff has a nonnegative multiplicative upper forward bound, requiring the |
| 24 | original bound only at positive values. Source: Morgan--Tian (2007), Lemma 19.15 and |
| 25 | Corollary 19.16, pp. 447-449; project derivation |
| 26 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 27 | theorem m64AnnulusForwardDerivativeBound.max_positive |
| 28 | {f : ℝ → ℝ} {t K epsilon : ℝ} (hepsilon : 0 < epsilon) (hK : 0 ≤ K) |
| 29 | (hf : ContinuousAt f t) |
| 30 | (hforward : 0 < f t → AnnulusForwardDerivativeBound f (K * f t) t) : |
| 31 | AnnulusForwardDerivativeBound (fun x => max (f x) epsilon) |
| 32 | (K * max (f t) epsilon) t := by |
| 33 | by_cases hft : 0 < f t |
| 34 | · intro eta heta |
| 35 | filter_upwards [hforward hft eta heta, self_mem_nhdsWithin] with h hh hpos |
| 36 | have hpos : 0 < h := hpos |
| 37 | have hmax : 0 ≤ K * max (f t) epsilon := |
| 38 | mul_nonneg hK (hepsilon.le.trans (le_max_right _ _)) |
| 39 | have hmul : 0 ≤ (K * max (f t) epsilon + eta) * h := |
| 40 | mul_nonneg (by linarith) hpos.le |
| 41 | have hcoefficient : K * f t ≤ K * max (f t) epsilon := |
| 42 | mul_le_mul_of_nonneg_left (le_max_left _ _) hK |
| 43 | have hstep := (div_le_iff₀ hpos).mp hh |
| 44 | have hfbound : f (t + h) ≤ max (f t) epsilon + |
| 45 | (K * max (f t) epsilon + eta) * h := by |
| 46 | nlinarith [le_max_left (f t) epsilon] |
| 47 | have hepsbound : epsilon ≤ max (f t) epsilon + |
| 48 | (K * max (f t) epsilon + eta) * h := |
| 49 | (le_max_right _ _).trans (le_add_of_nonneg_right hmul) |
| 50 | apply (div_le_iff₀ hpos).mpr |
| 51 | linarith [max_le hfbound hepsbound] |
| 52 | · intro eta heta |
| 53 | have hft_eps : f t < epsilon := (le_of_not_gt hft).trans_lt hepsilon |
| 54 | have hsmall : ∀ᶠ z in 𝓝 t, f z < epsilon := hf (Iio_mem_nhds hft_eps) |
| 55 | have hshift : Tendsto (fun h : ℝ => t + h) (𝓝[>] 0) (𝓝 t) := by |
| 56 | simpa using (tendsto_const_nhds.add |
| 57 | (tendsto_id.mono_left nhdsWithin_le_nhds) : |
| 58 | Tendsto (fun h : ℝ => t + h) (𝓝[>] 0) (𝓝 (t + 0))) |
| 59 | filter_upwards [hshift.eventually hsmall] with h hh |
| 60 | rw [max_eq_right hh.le, max_eq_right hft_eps.le, sub_self, zero_div] |
| 61 | exact (mul_nonneg hK hepsilon.le).trans (le_add_of_nonneg_right heta.le) |
| 62 | |
| 63 | /-- Continuous upper forward bounds imply the usual exponential comparison even when the |
| 64 | hypothesis is only imposed at interior times. Source: Morgan--Tian (2007), Lemma 19.15 and |
| 65 | Corollary 19.16, pp. 447-449; project derivation |
| 66 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 67 | theorem m64AnnulusForwardDerivativeBound.exponential_of_on_Ioo |
| 68 | {f : ℝ → ℝ} {a b K : ℝ} |
| 69 | (hf : ContinuousOn f (Icc a b)) |
| 70 | (hforward : ∀ x ∈ Ioo a b, AnnulusForwardDerivativeBound f (K * f x) x) : |
| 71 | ∀ x ∈ Icc a b, f x ≤ Real.exp (K * (x - a)) * f a := by |
| 72 | have hall := m64AnnulusForwardDerivativeBound.on_Ico_of_on_Ioo hf |
| 73 | (continuousOn_const.mul hf) hforward |
| 74 | have hcomparison := le_gronwallBound_of_liminf_deriv_right_le |
| 75 | (δ := f a) (K := K) (ε := 0) (f' := fun x => K * f x) hf |
| 76 | (fun x hx R hR => by |
| 77 | simpa only [slope_def_field, div_eq_mul_inv, mul_comm] using |
| 78 | m64AnnulusForwardDerivativeBound.frequently_slope_lt (hall x hx) hR) |
| 79 | le_rfl (fun _ _ => le_add_of_nonneg_right le_rfl) |
| 80 | intro x hx |
| 81 | simpa only [gronwallBound_ε0, mul_comm] using hcomparison x hx |
| 82 | |
| 83 | /-- Exponential comparison only needs the differential inequality where the function is |
| 84 | positive; the positive cutoffs supply the missing points. Source: Morgan--Tian (2007), Lemma |
| 85 | 19.15 and Corollary 19.16, pp. 447-449; project derivation |
| 86 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 87 | theorem m64AnnulusForwardDerivativeBound.exponential_of_positive_on_Ioo |
| 88 | {f : ℝ → ℝ} {a b K : ℝ} (hK : 0 ≤ K) |
| 89 | (hf : ContinuousOn f (Icc a b)) (ha : 0 ≤ f a) |
| 90 | (hforward : ∀ x ∈ Ioo a b, 0 < f x → |
| 91 | AnnulusForwardDerivativeBound f (K * f x) x) : |
| 92 | ∀ x ∈ Icc a b, f x ≤ Real.exp (K * (x - a)) * f a := by |
| 93 | intro x hx |
| 94 | have hcomparison (epsilon : ℝ) (hepsilon : 0 < epsilon) : |
| 95 | f x ≤ Real.exp (K * (x - a)) * max (f a) epsilon := by |
| 96 | have hcutoff := m64AnnulusForwardDerivativeBound.exponential_of_on_Ioo |
| 97 | (continuous_max.comp_continuousOn (hf.prodMk continuousOn_const)) (fun t ht => |
| 98 | m64AnnulusForwardDerivativeBound.max_positive hepsilon hK |
| 99 | (hf.continuousAt (Icc_mem_nhds ht.1 ht.2)) (hforward t ht)) x hx |
| 100 | exact (le_max_left _ _).trans hcutoff |
| 101 | have hlimit := ContinuousWithinAt.closure_le |
| 102 | (show (0 : ℝ) ∈ closure (Ioi (0 : ℝ)) by simp) |
| 103 | (f := fun _ : ℝ => f x) |
| 104 | (g := fun epsilon => Real.exp (K * (x - a)) * max (f a) epsilon) |
| 105 | continuousWithinAt_const (by fun_prop) hcomparison |
| 106 | simpa only [max_eq_left ha] using hlimit |
| 107 | |
| 108 | /-- A continuous nonnegative function cannot acquire positive values after a zero when its |
| 109 | multiplicative bound holds at every positive point. The resulting bound keeps the original |
| 110 | continuous coefficient exactly. Source: Morgan--Tian (2007), Lemma 19.15 and Corollary |
| 111 | 19.16, pp. 447-449; project derivation |
| 112 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 113 | theorem m64AnnulusForwardDerivativeBound.on_Ico_of_positive_on_Ioo |
| 114 | {f k : ℝ → ℝ} {a b : ℝ} |
| 115 | (hf : ContinuousOn f (Icc a b)) (hk : ContinuousOn k (Icc a b)) |
| 116 | (hnonneg : ∀ t ∈ Icc a b, 0 ≤ f t) |
| 117 | (hforward : ∀ t ∈ Ioo a b, 0 < f t → |
| 118 | AnnulusForwardDerivativeBound f (k t * f t) t) : |
| 119 | ∀ t ∈ Ico a b, AnnulusForwardDerivativeBound f (k t * f t) t := by |
| 120 | obtain ⟨K0, hK0⟩ := isCompact_Icc.bddAbove_image hk |
| 121 | let K := max K0 0 |
| 122 | have hK : 0 ≤ K := le_max_right _ _ |
| 123 | have hupper (x : ℝ) (hx : x ∈ Icc a b) : k x ≤ K := |
| 124 | (hK0 ⟨x, hx, rfl⟩).trans (le_max_left _ _) |
| 125 | apply m64AnnulusForwardDerivativeBound.on_Ico_of_on_Ioo |
| 126 | (q := fun t => k t * f t) hf (hk.mul hf) |
| 127 | intro t ht |
| 128 | by_cases hft : 0 < f t |
| 129 | · exact hforward t ht hft |
| 130 | · have hzero : f t = 0 := le_antisymm (le_of_not_gt hft) |
| 131 | (hnonneg t (Ioo_subset_Icc_self ht)) |
| 132 | have hvanish (z : ℝ) (hz : z ∈ Icc t b) : f z = 0 := by |
| 133 | have hcomparison := |
| 134 | m64AnnulusForwardDerivativeBound.exponential_of_positive_on_Ioo hK |
| 135 | (hf.mono (Icc_subset_Icc ht.1.le le_rfl)) (by rw [hzero]) |
| 136 | (fun x hx hpositive => by |
| 137 | intro eta heta |
| 138 | filter_upwards [hforward x ⟨ht.1.trans hx.1, hx.2⟩ hpositive eta heta] |
| 139 | with h hh |
| 140 | exact hh.trans (add_le_add |
| 141 | (mul_le_mul_of_nonneg_right |
| 142 | (hupper x ⟨ht.1.le.trans hx.1.le, hx.2.le⟩) hpositive.le) le_rfl)) z hz |
| 143 | rw [hzero, mul_zero] at hcomparison |
| 144 | exact le_antisymm hcomparison |
| 145 | (hnonneg z ⟨ht.1.le.trans hz.1, hz.2⟩) |
| 146 | intro eta heta |
| 147 | have hsmall : ∀ᶠ h : ℝ in 𝓝[>] 0, h ∈ Ioo 0 (b - t) := |
| 148 | Ioo_mem_nhdsGT (sub_pos.mpr ht.2) |
| 149 | filter_upwards [hsmall] with h hh |
| 150 | rw [hvanish (t + h) (by constructor <;> linarith [hh.1, hh.2]), |
| 151 | hzero, sub_self, zero_div, mul_zero, zero_add] |
| 152 | exact heta.le |
| 153 | |
| 154 | end PoincareMT |