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.SpecialFunctions.Log.Deriv |
| 2 | import Mathlib.Tactic.FieldSimp |
| 3 | import Mathlib.Tactic.Linarith |
| 4 | import Mathlib.Tactic.Positivity |
| 5 | import Mathlib.Tactic.Ring |
| 6 | |
| 7 | /-! |
| 8 | # Algebraic Hamilton-Ivey pinching estimates |
| 9 | |
| 10 | These lemmas isolate the finite-dimensional inequalities used by the |
| 11 | three-dimensional Hamilton-Ivey maximum-principle argument. They are |
| 12 | independent of the geometric tensor interface, so the analytic producer can |
| 13 | consume them without duplicating the sign algebra. |
| 14 | |
| 15 | The auxiliary polynomial and the initial barrier are the algebraic parts of |
| 16 | Morgan--Tian, Claims 4.28--4.31, pp. 77--79. |
| 17 | |
| 18 | Adapted from the earlier Axel workspace's |
| 19 | `MorganTianLib/Ch04/PinchingAlgebra.lean` at commit |
| 20 | `38e87ce7a`: the proofs use only mathlib and retain the source inequalities. |
| 21 | -/ |
| 22 | |
| 23 | namespace Poincare |
| 24 | |
| 25 | theorem pinchingAuxiliaryEqCompletedSquare (lam X Y : ℝ) : |
| 26 | X * Y ^ 2 + lam * Y * (Y - X) + lam ^ 2 * (X - Y) = |
| 27 | Y ^ 3 + (X - Y) * ((lam - Y / 2) ^ 2 + 3 * Y ^ 2 / 4) := by |
| 28 | ring |
| 29 | |
| 30 | theorem pinchingAuxiliaryNonneg {lam X Y : ℝ} |
| 31 | (hX : 0 ≤ X) (hYX : Y ≤ X) (hlam : -Y ≤ lam) : |
| 32 | 0 ≤ X * Y ^ 2 + lam * Y * (Y - X) + lam ^ 2 * (X - Y) := by |
| 33 | have hXY : 0 ≤ X - Y := sub_nonneg.mpr hYX |
| 34 | by_cases hY : Y ≤ 0 |
| 35 | · have hlam0 : 0 ≤ lam := (neg_nonneg.mpr hY).trans hlam |
| 36 | have hnegY : 0 ≤ -Y := neg_nonneg.mpr hY |
| 37 | calc |
| 38 | 0 ≤ X * Y ^ 2 + lam * (-Y) * (X - Y) + lam ^ 2 * (X - Y) := by |
| 39 | positivity |
| 40 | _ = X * Y ^ 2 + lam * Y * (Y - X) + lam ^ 2 * (X - Y) := by ring |
| 41 | · rw [pinchingAuxiliaryEqCompletedSquare] |
| 42 | have hY0 : 0 < Y := lt_of_not_ge hY |
| 43 | positivity |
| 44 | |
| 45 | theorem pinchingAuxiliaryNonnegOfOrderedEigenvalues {lam mu nu : ℝ} |
| 46 | (hmu : mu ≤ lam) (hnu : nu ≤ mu) (hnu0 : nu ≤ 0) : |
| 47 | 0 ≤ (-nu) * (-mu) ^ 2 + lam * (-mu) * ((-mu) - (-nu)) + |
| 48 | lam ^ 2 * ((-nu) - (-mu)) := by |
| 49 | apply pinchingAuxiliaryNonneg |
| 50 | · exact neg_nonneg.mpr hnu0 |
| 51 | · exact neg_le_neg hnu |
| 52 | · simpa only [neg_neg] using hmu |
| 53 | |
| 54 | theorem pinchingInitialTraceLowerBound {lam mu nu : ℝ} |
| 55 | (hmu : mu ≤ lam) (hnu : nu ≤ mu) (hnuLower : -1 ≤ nu) : |
| 56 | -3 ≤ lam + mu + nu := by |
| 57 | linarith |
| 58 | |
| 59 | theorem pinchingInitialTraceLowerBoundOfMaxNegLeOne |
| 60 | {lam mu nu : ℝ} (hmu : mu ≤ lam) (hnu : nu ≤ mu) |
| 61 | {X : ℝ} (hX : X = max (-nu) 0) (hXpos : 0 < X) (hXle : X ≤ 1) : |
| 62 | X * (Real.log X - 3) ≤ lam + mu + nu := by |
| 63 | have hneg : 0 < -nu := by |
| 64 | by_contra h |
| 65 | have hnonpos : -nu ≤ 0 := le_of_not_gt h |
| 66 | rw [max_eq_right hnonpos] at hX |
| 67 | linarith |
| 68 | have hnuNonpos : -nu ≥ 0 := le_of_lt hneg |
| 69 | have hXeq : X = -nu := by |
| 70 | rw [hX, max_eq_left hnuNonpos] |
| 71 | have hlog : Real.log X ≤ 0 := Real.log_nonpos hXpos.le hXle |
| 72 | have htrace : -3 * X ≤ lam + mu + nu := by |
| 73 | rw [hXeq] |
| 74 | linarith |
| 75 | have hbarrier : X * (Real.log X - 3) ≤ -3 * X := by |
| 76 | nlinarith [mul_nonpos_of_nonneg_of_nonpos (le_of_lt hXpos) hlog] |
| 77 | exact hbarrier.trans htrace |
| 78 | |
| 79 | theorem pinchingReactionIdentity (lam X Y : ℝ) : |
| 80 | X * (X ^ 2 + Y ^ 2 + lam ^ 2 + X * Y - lam * (X + Y)) - |
| 81 | ((lam - X - Y) + X) * (-X ^ 2 + Y * lam) = |
| 82 | X ^ 3 + (X * Y ^ 2 + lam * Y * (Y - X) + lam ^ 2 * (X - Y)) := by |
| 83 | ring |
| 84 | |
| 85 | theorem pinchingReactionInequality {lam X Y : ℝ} |
| 86 | (hX : 0 ≤ X) (hYX : Y ≤ X) (hlam : -Y ≤ lam) : |
| 87 | X ^ 3 ≤ |
| 88 | X * (X ^ 2 + Y ^ 2 + lam ^ 2 + X * Y - lam * (X + Y)) - |
| 89 | ((lam - X - Y) + X) * (-X ^ 2 + Y * lam) := by |
| 90 | rw [pinchingReactionIdentity] |
| 91 | exact le_add_of_nonneg_right (pinchingAuxiliaryNonneg hX hYX hlam) |
| 92 | |
| 93 | theorem derivPinchingLogQuantityGe {S X : ℝ → ℝ} {t dS dX : ℝ} |
| 94 | (hS : HasDerivAt S dS t) (hX : HasDerivAt X dX t) |
| 95 | (hXpos : 0 < X t) |
| 96 | (hineq : X t ^ 3 ≤ X t * dS - (S t + X t) * dX) : |
| 97 | X t ≤ deriv (fun s => S s / X s - Real.log (X s)) t := by |
| 98 | have hXne : X t ≠ 0 := ne_of_gt hXpos |
| 99 | have hderiv := (hS.div hX hXne).sub (hX.log hXne) |
| 100 | change HasDerivAt (fun s => S s / X s - Real.log (X s)) |
| 101 | ((dS * X t - S t * dX) / X t ^ 2 - dX / X t) t at hderiv |
| 102 | rw [hderiv.deriv] |
| 103 | have hid : (dS * X t - S t * dX) / X t ^ 2 - dX / X t = |
| 104 | (X t * dS - (S t + X t) * dX) / X t ^ 2 := by |
| 105 | field_simp |
| 106 | ring |
| 107 | rw [hid] |
| 108 | apply (le_div_iff₀ (sq_pos_of_pos hXpos)).mpr |
| 109 | convert hineq using 1 <;> first | rfl | ring |
| 110 | |
| 111 | end Poincare |