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.RicciFlow.Pinching.ReactionInvariance |
| 2 | |
| 3 | /-! |
| 4 | # Ordered scalar equations for the operator reaction |
| 5 | |
| 6 | The eigenvalue gaps satisfy homogeneous linear equations. This gives preservation |
| 7 | of their initial order, including repeated eigenvalues. Doubling elapsed time |
| 8 | then reduces the normalized operator reaction to `reaction_invariance`. |
| 9 | |
| 10 | Reference: Morgan--Tian, Claims 4.30--4.31, pp. 78--79. |
| 11 | -/ |
| 12 | |
| 13 | namespace Poincare.HamiltonIvey |
| 14 | |
| 15 | open Set |
| 16 | |
| 17 | private theorem linear_ode_nonneg |
| 18 | {a b : ℝ} (hab : a ≤ b) {f c : ℝ → ℝ} |
| 19 | (hf : ContinuousOn f (Icc a b)) (hc : ContinuousOn c (Icc a b)) |
| 20 | (hd : ∀ t ∈ Ioo a b, HasDerivAt f (c t * f t) t) |
| 21 | (ha : 0 ≤ f a) : ∀ t ∈ Icc a b, 0 ≤ f t := by |
| 22 | obtain ⟨u, hu, hmax⟩ := isCompact_Icc.exists_isMaxOn (nonempty_Icc.mpr hab) hc |
| 23 | let K := c u + 1 |
| 24 | let g : ℝ → ℝ := fun t => Real.exp (-K * t) * f t |
| 25 | have hgc : ContinuousOn g (Icc a b) := by |
| 26 | exact (Real.continuous_exp.comp (continuous_const.mul continuous_id)).continuousOn.mul hf |
| 27 | have hga : 0 ≤ g a := mul_nonneg (Real.exp_pos _).le ha |
| 28 | have hg := Poincare.nonneg_of_deriv_pos_on_neg hab hgc hga (by |
| 29 | intro t ht hneg |
| 30 | have hft : f t < 0 := by |
| 31 | by_contra hn |
| 32 | exact (not_lt_of_ge (mul_nonneg (Real.exp_pos _).le (le_of_not_gt hn))) hneg |
| 33 | have hct : c t - K < 0 := by |
| 34 | have : c t ≤ c u := hmax (Ioo_subset_Icc_self ht) |
| 35 | dsimp [K] |
| 36 | linarith |
| 37 | refine ⟨Real.exp (-K * t) * ((c t - K) * f t), ?_, |
| 38 | mul_pos (Real.exp_pos _) (mul_pos_of_neg_of_neg hct hft)⟩ |
| 39 | convert! ((((hasDerivAt_id t).const_mul (-K)).exp).mul (hd t ht)) using 1 |
| 40 | simp only [id_eq] |
| 41 | ring) |
| 42 | intro t ht |
| 43 | exact (mul_nonneg_iff_of_pos_left (Real.exp_pos _)).mp (hg t ht) |
| 44 | |
| 45 | /-- Initial ordering is preserved by the rate-two scalar reaction. -/ |
| 46 | theorem reaction_two_order |
| 47 | {a b : ℝ} (hab : a ≤ b) {lam mu nu : ℝ → ℝ} |
| 48 | (hlam : ContinuousOn lam (Icc a b)) |
| 49 | (hmu : ContinuousOn mu (Icc a b)) |
| 50 | (hnu : ContinuousOn nu (Icc a b)) |
| 51 | (hdlam : ∀ t ∈ Ioo a b, |
| 52 | HasDerivAt lam (2 * (lam t ^ 2 + mu t * nu t)) t) |
| 53 | (hdmu : ∀ t ∈ Ioo a b, |
| 54 | HasDerivAt mu (2 * (mu t ^ 2 + lam t * nu t)) t) |
| 55 | (hdnu : ∀ t ∈ Ioo a b, |
| 56 | HasDerivAt nu (2 * (nu t ^ 2 + lam t * mu t)) t) |
| 57 | (hinit : mu a ≤ lam a ∧ nu a ≤ mu a) : |
| 58 | ∀ t ∈ Icc a b, mu t ≤ lam t ∧ nu t ≤ mu t := by |
| 59 | have hfirst := linear_ode_nonneg hab (hlam.sub hmu) |
| 60 | (continuousOn_const.mul ((hlam.add hmu).sub hnu)) |
| 61 | (c := fun t => 2 * (lam t + mu t - nu t)) |
| 62 | (by |
| 63 | intro t ht |
| 64 | convert! (hdlam t ht).sub (hdmu t ht) using 1 |
| 65 | simp only [Pi.sub_apply] |
| 66 | ring) |
| 67 | (sub_nonneg.mpr hinit.1) |
| 68 | have hsecond := linear_ode_nonneg hab (hmu.sub hnu) |
| 69 | (continuousOn_const.mul ((hmu.add hnu).sub hlam)) |
| 70 | (c := fun t => 2 * (mu t + nu t - lam t)) |
| 71 | (by |
| 72 | intro t ht |
| 73 | convert! (hdmu t ht).sub (hdnu t ht) using 1 |
| 74 | simp only [Pi.sub_apply] |
| 75 | ring) |
| 76 | (sub_nonneg.mpr hinit.2) |
| 77 | exact fun t ht => ⟨sub_nonneg.mp (hfirst t ht), sub_nonneg.mp (hsecond t ht)⟩ |
| 78 | |
| 79 | /-- Advancing absolute time shrinks the Hamilton--Ivey scalar carrier. -/ |
| 80 | theorem scalarRegion_antitone_time {s t : ℝ} (ht : 0 ≤ t) (hts : t ≤ s) : |
| 81 | scalarRegion s ⊆ scalarRegion t := by |
| 82 | intro p hp |
| 83 | have htt : 0 < 1 + t := by linarith |
| 84 | have hss : 0 < 1 + s := by linarith |
| 85 | have hden : 1 + t ≤ 1 + s := by linarith |
| 86 | have hcut : cutoff s ≤ cutoff t := |
| 87 | div_le_div_of_nonneg_left baseCutoff_pos.le htt hden |
| 88 | refine ⟨?_, ?_⟩ |
| 89 | · have hh : -3 / (1 + t) ≤ -3 / (1 + s) := by |
| 90 | have hdiv := div_le_div_of_nonneg_left (by norm_num : (0 : ℝ) ≤ 3) htt hden |
| 91 | simpa only [neg_div] using neg_le_neg hdiv |
| 92 | exact hh.trans hp.1 |
| 93 | · intro hx |
| 94 | have hpos : 0 ≤ p.2 := (cutoff_pos ht).le.trans hx |
| 95 | have hlog := Real.log_le_log htt hden |
| 96 | have hbar : logBarrier t p.2 ≤ logBarrier s p.2 := by |
| 97 | unfold logBarrier |
| 98 | exact mul_le_mul_of_nonneg_left (by linarith) hpos |
| 99 | exact hbar.trans (hp.2 (hcut.trans hx)) |
| 100 | |
| 101 | /-- The rate-two scalar reaction preserves the absolute-time carrier, from |
| 102 | initial ordering alone and without endpoint derivative assumptions. -/ |
| 103 | theorem reaction_two_invariance |
| 104 | {a b : ℝ} (ha : 0 ≤ a) (hab : a ≤ b) |
| 105 | {lam mu nu : ℝ → ℝ} |
| 106 | (hlam : ContinuousOn lam (Icc a b)) |
| 107 | (hmu : ContinuousOn mu (Icc a b)) |
| 108 | (hnu : ContinuousOn nu (Icc a b)) |
| 109 | (hdlam : ∀ t ∈ Ioo a b, |
| 110 | HasDerivAt lam (2 * (lam t ^ 2 + mu t * nu t)) t) |
| 111 | (hdmu : ∀ t ∈ Ioo a b, |
| 112 | HasDerivAt mu (2 * (mu t ^ 2 + lam t * nu t)) t) |
| 113 | (hdnu : ∀ t ∈ Ioo a b, |
| 114 | HasDerivAt nu (2 * (nu t ^ 2 + lam t * mu t)) t) |
| 115 | (horder : mu a ≤ lam a ∧ nu a ≤ mu a) |
| 116 | (hinit : (lam a + mu a + nu a, max (-nu a) 0) ∈ scalarRegion a) : |
| 117 | ∀ t ∈ Icc a b, |
| 118 | (lam t + mu t + nu t, max (-nu t) 0) ∈ scalarRegion t := by |
| 119 | let B : ℝ := a + 2 * (b - a) |
| 120 | let τ : ℝ → ℝ := fun s => a + (s - a) / 2 |
| 121 | have hab' : a ≤ B := by dsimp [B]; linarith |
| 122 | have hτa : τ a = a := by dsimp [τ]; ring |
| 123 | have hτcc : MapsTo τ (Icc a B) (Icc a b) := by |
| 124 | intro s hs |
| 125 | dsimp [τ, B] at * |
| 126 | constructor <;> linarith [hs.1, hs.2] |
| 127 | have hτoo : MapsTo τ (Ioo a B) (Ioo a b) := by |
| 128 | intro s hs |
| 129 | dsimp [τ, B] at * |
| 130 | constructor <;> linarith [hs.1, hs.2] |
| 131 | have hτc : Continuous τ := by fun_prop |
| 132 | have hτd : ∀ s : ℝ, HasDerivAt τ (1 / 2) s := by |
| 133 | intro s |
| 134 | simpa [τ] using (((hasDerivAt_id s).sub_const a).div_const 2).const_add a |
| 135 | have hord := reaction_two_order hab hlam hmu hnu hdlam hdmu hdnu horder |
| 136 | have hscaled := reaction_invariance ha hab' |
| 137 | (hlam.comp hτc.continuousOn hτcc) |
| 138 | (hmu.comp hτc.continuousOn hτcc) |
| 139 | (hnu.comp hτc.continuousOn hτcc) |
| 140 | (fun s hs => hord (τ s) (hτcc hs)) |
| 141 | (by |
| 142 | intro s hs |
| 143 | convert! (hdlam (τ s) (hτoo hs)).comp s (hτd s) using 1 |
| 144 | simp only [Function.comp_apply] |
| 145 | ring) |
| 146 | (by |
| 147 | intro s hs |
| 148 | convert! (hdmu (τ s) (hτoo hs)).comp s (hτd s) using 1 |
| 149 | simp only [Function.comp_apply] |
| 150 | ring) |
| 151 | (by |
| 152 | intro s hs |
| 153 | convert! (hdnu (τ s) (hτoo hs)).comp s (hτd s) using 1 |
| 154 | simp only [Function.comp_apply] |
| 155 | ring) |
| 156 | (by simpa only [Function.comp_apply, hτa] using hinit) |
| 157 | intro t ht |
| 158 | have hst : a + 2 * (t - a) ∈ Icc a B := by |
| 159 | dsimp [B] |
| 160 | constructor <;> linarith [ht.1, ht.2] |
| 161 | have hback : τ (a + 2 * (t - a)) = t := by dsimp [τ]; ring |
| 162 | have hmem := hscaled (a + 2 * (t - a)) hst |
| 163 | simp only [Function.comp_apply, hback] at hmem |
| 164 | exact scalarRegion_antitone_time (ha.trans ht.1) (by linarith [ht.1]) hmem |
| 165 | |
| 166 | end Poincare.HamiltonIvey |