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.SpecificLimits.Basic |
| 2 | import Mathlib.MeasureTheory.Integral.IntervalIntegral.Basic |
| 3 | import Mathlib.MeasureTheory.Integral.DominatedConvergence |
| 4 | import Mathlib.Topology.Order.OrderClosed |
| 5 | import Mathlib.Tactic.FieldSimp |
| 6 | import Mathlib.Tactic.Ring |
| 7 | |
| 8 | /-! |
| 9 | # Time-origin limits for integrated Harnack inequalities |
| 10 | |
| 11 | The finite-start scalar comparison carries the factors `a - T` and `b - T`. |
| 12 | As the time origin `T` tends to `-∞`, their ratio tends to one. This file |
| 13 | contains the order-theoretic limit step, separated from the geometric |
| 14 | construction of the finite estimates. The application is Morgan--Tian, |
| 15 | Theorem 4.37 and Corollary 4.39, p. 81, and Theorem 4.40, p. 82. |
| 16 | -/ |
| 17 | |
| 18 | set_option autoImplicit false |
| 19 | |
| 20 | open Set Filter MeasureTheory |
| 21 | open scoped intervalIntegral |
| 22 | open scoped Topology |
| 23 | |
| 24 | namespace Poincare.Asymptotics |
| 25 | |
| 26 | /-- The two elapsed-time factors have the same time-origin asymptotic. -/ |
| 27 | theorem tendsto_elapsed_time_ratio_atBot (a b : ℝ) : |
| 28 | Tendsto (fun T : ℝ ↦ (a - T) / (b - T)) atBot (𝓝 1) := by |
| 29 | have hden : Tendsto (fun T : ℝ ↦ b - T) atBot atTop := by |
| 30 | refine tendsto_atTop.2 (fun C ↦ ?_) |
| 31 | exact eventually_atBot.2 ⟨b - C, fun T hT ↦ by linarith⟩ |
| 32 | have hsmall : Tendsto (fun T : ℝ ↦ (a - b) / (b - T)) atBot (𝓝 0) := |
| 33 | hden.const_div_atTop (a - b) |
| 34 | have hsum : Tendsto (fun T : ℝ ↦ 1 + (a - b) / (b - T)) atBot (𝓝 1) := by |
| 35 | simpa using tendsto_const_nhds.add hsmall |
| 36 | apply hsum.congr' |
| 37 | filter_upwards [eventually_lt_atBot b] with T hT |
| 38 | have hne : b - T ≠ 0 := ne_of_gt (sub_pos.mpr hT) |
| 39 | field_simp |
| 40 | ring |
| 41 | |
| 42 | /-- The finite-start reciprocal-time correction vanishes in the ancient limit. -/ |
| 43 | theorem tendsto_div_elapsed_time_atBot (t R : ℝ) : |
| 44 | Tendsto (fun T : ℝ ↦ R / (t - T)) atBot (𝓝 0) := by |
| 45 | apply Filter.Tendsto.const_div_atTop |
| 46 | refine tendsto_atTop.2 (fun C ↦ ?_) |
| 47 | exact eventually_atBot.2 ⟨t - C, fun T hT ↦ by linarith⟩ |
| 48 | |
| 49 | /-- A differential inequality with a reciprocal-time correction has a nonnegative limit. -/ |
| 50 | theorem nonneg_of_eventually_add_div_nonneg {Q R t : ℝ} |
| 51 | (hfinite : ∀ᶠ T : ℝ in atBot, 0 ≤ Q + R / (t - T)) : |
| 52 | 0 ≤ Q := by |
| 53 | have hlim : Tendsto (fun T : ℝ ↦ Q + R / (t - T)) atBot (𝓝 Q) := by |
| 54 | simpa using (tendsto_div_elapsed_time_atBot t R).const_add Q |
| 55 | exact ge_of_tendsto hlim hfinite |
| 56 | |
| 57 | /-- The finite-start elapsed-time factor disappears without any sign assumption on curvature. -/ |
| 58 | theorem ancient_limit_of_scaled_inequality |
| 59 | {a b A B E : ℝ} |
| 60 | (hfinite : ∀ᶠ T : ℝ in atBot, |
| 61 | A * (a - T) * E ≤ B * (b - T)) : |
| 62 | A * E ≤ B := by |
| 63 | let r : ℝ → ℝ := fun T ↦ (a - T) / (b - T) |
| 64 | have hr : Tendsto r atBot (𝓝 1) := tendsto_elapsed_time_ratio_atBot a b |
| 65 | have hleft : Tendsto (fun T ↦ A * r T * E) atBot (𝓝 (A * E)) := by |
| 66 | simpa [r] using (tendsto_const_nhds.mul hr).mul tendsto_const_nhds |
| 67 | have hright : Tendsto (fun _ : ℝ ↦ B) atBot (𝓝 B) := tendsto_const_nhds |
| 68 | have hnorm : ∀ᶠ T : ℝ in atBot, A * r T * E ≤ B := by |
| 69 | filter_upwards [hfinite, eventually_lt_atBot b] with T hT hTb |
| 70 | have hpos : 0 < b - T := sub_pos.mpr hTb |
| 71 | apply (mul_le_mul_iff_left₀ hpos).mp |
| 72 | have heq : (A * r T * E) * (b - T) = A * (a - T) * E := by |
| 73 | dsimp [r] |
| 74 | field_simp |
| 75 | rwa [heq] |
| 76 | exact le_of_tendsto_of_tendsto hleft hright hnorm |
| 77 | |
| 78 | /-- An interior inequality extends to the terminal time by one-sided continuity. -/ |
| 79 | theorem le_at_right_endpoint {f g : ℝ → ℝ} {a b : ℝ} (hab : a < b) |
| 80 | (hf : ContinuousWithinAt f (Icc a b) b) |
| 81 | (hg : ContinuousWithinAt g (Icc a b) b) |
| 82 | (hfg : ∀ t ∈ Ioo a b, f t ≤ g t) : |
| 83 | f b ≤ g b := by |
| 84 | have : NeBot (𝓝[Ioo a b] b) := right_nhdsWithin_Ioo_neBot hab |
| 85 | exact le_of_tendsto_of_tendsto (hf.mono Ioo_subset_Icc_self) |
| 86 | (hg.mono Ioo_subset_Icc_self) |
| 87 | ((show ∀ᶠ t : ℝ in 𝓝[Ioo a b] b, t ∈ Ioo a b from |
| 88 | self_mem_nhdsWithin).mono fun t ht ↦ hfg t ht) |
| 89 | |
| 90 | /-- Nonnegativity on negative times extends to time zero by left continuity. -/ |
| 91 | theorem nonneg_at_zero_of_nonneg_neg {f : ℝ → ℝ} |
| 92 | (hf : ContinuousWithinAt f (Iic 0) 0) |
| 93 | (hnonneg : ∀ t < 0, 0 ≤ f t) : |
| 94 | 0 ≤ f 0 := by |
| 95 | exact ge_of_tendsto (hf.mono Iio_subset_Iic_self) |
| 96 | ((show ∀ᶠ t : ℝ in 𝓝[Iio (0 : ℝ)] 0, t ∈ Iio (0 : ℝ) from |
| 97 | self_mem_nhdsWithin).mono fun t ht ↦ hnonneg t ht) |
| 98 | |
| 99 | /-- |
| 100 | Finite-origin integrated estimates on every interior endpoint extend to the |
| 101 | terminal endpoint. The finite-origin producer remains separate from this |
| 102 | real-analysis consumer. |
| 103 | -/ |
| 104 | theorem le_at_right_endpoint_of_finite_origins |
| 105 | {f q : ℝ → ℝ} {a b : ℝ} (hab : a < b) |
| 106 | (hf : ContinuousOn f (Icc a b)) |
| 107 | (hqInt : IntervalIntegrable q volume a b) |
| 108 | (hfinite : ∀ t ∈ Ioo a b, ∀ᶠ T : ℝ in atBot, |
| 109 | f a * (a - T) * Real.exp (-(∫ s in a..t, q s) / 2) ≤ |
| 110 | f t * (t - T)) : |
| 111 | f a * Real.exp (-(∫ s in a..b, q s) / 2) ≤ f b := by |
| 112 | have hprimitive : ContinuousOn (fun t ↦ ∫ s in a..t, q s) (Icc a b) := by |
| 113 | simpa only [uIcc_of_le (le_of_lt hab)] using |
| 114 | (intervalIntegral.continuousOn_primitive_interval' hqInt left_mem_uIcc) |
| 115 | let g : ℝ → ℝ := fun t ↦ |
| 116 | f a * Real.exp (-(∫ s in a..t, q s) / 2) |
| 117 | have hg : ContinuousOn g (Icc a b) := by |
| 118 | change ContinuousOn (fun t ↦ f a * Real.exp (-(∫ s in a..t, q s) / 2)) (Icc a b) |
| 119 | exact continuousOn_const.mul |
| 120 | (Real.continuous_exp.comp_continuousOn |
| 121 | (hprimitive.neg.div_const 2)) |
| 122 | exact le_at_right_endpoint hab |
| 123 | (hg b (right_mem_Icc.mpr (le_of_lt hab))) |
| 124 | (hf b (right_mem_Icc.mpr (le_of_lt hab))) (by |
| 125 | intro t ht |
| 126 | exact ancient_limit_of_scaled_inequality (hfinite t ht)) |
| 127 | |
| 128 | /-- Interior finite-origin differential inequalities reach time zero. -/ |
| 129 | theorem nonneg_at_zero_of_finite_origins {q r : ℝ → ℝ} |
| 130 | (hq : ContinuousWithinAt q (Iic 0) 0) |
| 131 | (hfinite : ∀ t < 0, ∀ᶠ T : ℝ in atBot, |
| 132 | 0 ≤ q t + r t / (t - T)) : |
| 133 | 0 ≤ q 0 := by |
| 134 | apply nonneg_at_zero_of_nonneg_neg hq |
| 135 | intro t ht |
| 136 | exact nonneg_of_eventually_add_div_nonneg (hfinite t ht) |
| 137 | |
| 138 | end Poincare.Asymptotics |