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.Calculus.Deriv.Mul |
| 2 | import Mathlib.Analysis.Calculus.Deriv.Pow |
| 3 | import Mathlib.MeasureTheory.Integral.IntervalIntegral.FundThmCalculus |
| 4 | import Mathlib.Tactic.Linarith |
| 5 | import Mathlib.Tactic.Ring |
| 6 | |
| 7 | /-! |
| 8 | # Scalar integration of the surface index trace |
| 9 | |
| 10 | The scalar and velocity evolution identities turn the traced index density |
| 11 | into a total derivative minus half the action. This file only integrates |
| 12 | those explicit identities; it does not construct a minimizing curve or its |
| 13 | variations. See `references/ricci-flow/mapher/reduced-length-minimum-variation.md`. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | |
| 18 | open Set MeasureTheory |
| 19 | open scoped intervalIntegral |
| 20 | |
| 21 | namespace PoincareMT.ReducedLengthMinimum.Variation |
| 22 | |
| 23 | /-- Integrate the trace using `Q(s) = -s^3 R(s) + s V(s) / 4`. |
| 24 | Here `V` is squared speed, `S` is the scalar reaction-diffusion term, |
| 25 | `G` is the spatial scalar differential along the velocity, and `C` is |
| 26 | the Ricci pairing with the velocity. -/ |
| 27 | theorem sq_mul_integral_trace_eq {c : ℝ} (hc : 0 < c) |
| 28 | (R V S G C D : ℝ → ℝ) |
| 29 | (hRc : ContinuousOn R (Icc 0 c)) (hVc : ContinuousOn V (Icc 0 c)) |
| 30 | (hR : ∀ s ∈ Ioo 0 c, HasDerivAt R (-2 * s * S s + G s) s) |
| 31 | (hV : ∀ s ∈ Ioo 0 c, HasDerivAt V (-4 * s * C s + 4 * s ^ 2 * G s) s) |
| 32 | (hD : IntervalIntegrable D volume 0 c) |
| 33 | (htrace : ∀ s ∈ Ioo 0 c, |
| 34 | c ^ 2 * D s = 2 - 4 * s ^ 2 * R s + 2 * s ^ 4 * S s - s ^ 2 * C s) : |
| 35 | c ^ 2 * (∫ s in 0..c, D s) = |
| 36 | 2 * c - c ^ 3 * R c + c * V c / 4 - |
| 37 | (∫ s in 0..c, V s / 2 + 2 * s ^ 2 * R s) / 2 := by |
| 38 | let A : ℝ → ℝ := fun s => V s / 2 + 2 * s ^ 2 * R s |
| 39 | let Q : ℝ → ℝ := fun s => -(s ^ 3 * R s) + s * V s / 4 |
| 40 | have hAc : ContinuousOn A (Icc 0 c) := |
| 41 | (hVc.div_const 2).add ((continuousOn_const.mul (continuousOn_id.pow 2)).mul hRc) |
| 42 | have hQc : ContinuousOn Q (Icc 0 c) := |
| 43 | ((continuousOn_id.pow 3).mul hRc).neg.add ((continuousOn_id.mul hVc).div_const 4) |
| 44 | have hAi : IntervalIntegrable A volume 0 c := hAc.intervalIntegrable_of_Icc hc.le |
| 45 | have hQi : IntervalIntegrable (fun s => c ^ 2 * D s - 2 + A s / 2) volume 0 c := |
| 46 | ((hD.const_mul _).sub intervalIntegrable_const).add (hAi.div_const 2) |
| 47 | have hQd (s : ℝ) (hs : s ∈ Ioo 0 c) : |
| 48 | HasDerivAt Q (c ^ 2 * D s - 2 + A s / 2) s := by |
| 49 | have h := (((hasDerivAt_pow 3 s).mul (hR s hs)).neg).add |
| 50 | (((hasDerivAt_id s).mul (hV s hs)).div_const 4) |
| 51 | apply h.congr_deriv |
| 52 | rw [htrace s hs] |
| 53 | dsimp only [A] |
| 54 | norm_num only [Nat.cast_ofNat, Nat.reduceSub, one_mul, id_eq] |
| 55 | ring |
| 56 | have hFTC : (∫ s in 0..c, c ^ 2 * D s - 2 + A s / 2) = Q c - Q 0 := |
| 57 | intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le hc.le hQc hQd hQi |
| 58 | rw [intervalIntegral.integral_add ((hD.const_mul _).sub intervalIntegrable_const) |
| 59 | (hAi.div_const 2), |
| 60 | intervalIntegral.integral_sub (hD.const_mul _) intervalIntegrable_const, |
| 61 | intervalIntegral.integral_const_mul, intervalIntegral.integral_const, |
| 62 | intervalIntegral.integral_div] at hFTC |
| 63 | simp only [Q, zero_pow (by norm_num : (3 : ℕ) ≠ 0), zero_mul, zero_div, |
| 64 | neg_zero, add_zero, sub_zero, smul_eq_mul] at hFTC |
| 65 | change c ^ 2 * (∫ s in 0..c, D s) = |
| 66 | 2 * c - c ^ 3 * R c + c * V c / 4 - (∫ s in 0..c, A s) / 2 |
| 67 | linarith |
| 68 | |
| 69 | /-- A nonnegative traced index and a free terminal endpoint give the surface |
| 70 | bound `tau * R + m <= 2`. All geometric inputs remain explicit hypotheses. -/ |
| 71 | theorem curvature_add_minimum_le_two {c τ m : ℝ} (hc : 0 < c) (hτ : τ = c ^ 2) |
| 72 | (R V S G C D : ℝ → ℝ) |
| 73 | (hRc : ContinuousOn R (Icc 0 c)) (hVc : ContinuousOn V (Icc 0 c)) |
| 74 | (hR : ∀ s ∈ Ioo 0 c, HasDerivAt R (-2 * s * S s + G s) s) |
| 75 | (hV : ∀ s ∈ Ioo 0 c, HasDerivAt V (-4 * s * C s + 4 * s ^ 2 * G s) s) |
| 76 | (hD : IntervalIntegrable D volume 0 c) |
| 77 | (htrace : ∀ s ∈ Ioo 0 c, |
| 78 | c ^ 2 * D s = 2 - 4 * s ^ 2 * R s + 2 * s ^ 4 * S s - s ^ 2 * C s) |
| 79 | (hterminal : V c = 0) |
| 80 | (haction : (∫ s in 0..c, V s / 2 + 2 * s ^ 2 * R s) = 2 * c * m) |
| 81 | (hindex : 0 ≤ ∫ s in 0..c, D s) : |
| 82 | τ * R c + m ≤ 2 := by |
| 83 | have hid := sq_mul_integral_trace_eq hc R V S G C D hRc hVc hR hV hD htrace |
| 84 | rw [hterminal, haction] at hid |
| 85 | have hscaled : 0 ≤ c * (2 - c ^ 2 * R c - m) := by |
| 86 | have hnonneg := mul_nonneg (sq_nonneg c) hindex |
| 87 | nlinarith only [hid, hnonneg] |
| 88 | have hbound := nonneg_of_mul_nonneg_right hscaled hc |
| 89 | rw [hτ] |
| 90 | linarith |
| 91 | |
| 92 | end PoincareMT.ReducedLengthMinimum.Variation |