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.Generalized.ReducedGeometry.Regularity.Formulas.HarnackIntegral |
| 2 | |
| 3 | /-! |
| 4 | # Shifted Harnack weights |
| 5 | |
| 6 | The positive-start weight has the same integrability as the already |
| 7 | controlled zero-start weight, with a continuous bounded multiplier. |
| 8 | Morgan-Tian Section 6.5, pp. 129-133. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | |
| 13 | open Set |
| 14 | open scoped intervalIntegral |
| 15 | |
| 16 | namespace PoincareMT.M14 |
| 17 | |
| 18 | /-- Integrability of the actual shifted Harnack weight follows from |
| 19 | the ordinary weighted density, including initial time zero, |
| 20 | Section 6.5, pp. 129-133. -/ |
| 21 | theorem shiftedHarnack_intervalIntegrable {a b : ℝ} (ha : 0 ≤ a) (hab : a < b) |
| 22 | (H : ℝ → ℝ) |
| 23 | (hH : IntervalIntegrable (fun t => t * Real.sqrt t * H t) MeasureTheory.volume a b) : |
| 24 | IntervalIntegrable (fun t => Real.sqrt t * (Real.sqrt t - Real.sqrt a) ^ 2 * H t) |
| 25 | MeasureTheory.volume a b := by |
| 26 | by_cases ha0 : a = 0 |
| 27 | · apply hH.congr_uIoo |
| 28 | intro t ht |
| 29 | rw [uIoo_of_le hab.le] at ht |
| 30 | have ht0 : 0 ≤ t := ha.trans ht.1.le |
| 31 | simp only [ha0, Real.sqrt_zero, sub_zero, Real.sq_sqrt ht0] |
| 32 | ring |
| 33 | · have ha' : 0 < a := lt_of_le_of_ne ha (Ne.symm ha0) |
| 34 | have hc : ContinuousOn (fun t => (1 - Real.sqrt a / Real.sqrt t) ^ 2) (uIcc a b) := by |
| 35 | rw [uIcc_of_le hab.le] |
| 36 | exact (continuousOn_const.sub (continuousOn_const.div Real.continuous_sqrt.continuousOn |
| 37 | (fun t ht => (Real.sqrt_pos.mpr (ha'.trans_le ht.1)).ne'))).pow 2 |
| 38 | apply (hH.mul_continuousOn hc).congr_uIoo |
| 39 | intro t ht |
| 40 | rw [uIoo_of_le hab.le] at ht |
| 41 | have ht0 : 0 < t := ha'.trans ht.1 |
| 42 | have hs : Real.sqrt t ≠ 0 := (Real.sqrt_pos.mpr ht0).ne' |
| 43 | have hquot : 1 - Real.sqrt a / Real.sqrt t = |
| 44 | (Real.sqrt t - Real.sqrt a) / Real.sqrt t := by |
| 45 | field_simp [hs] |
| 46 | dsimp only |
| 47 | rw [hquot, div_pow, Real.sq_sqrt ht0.le] |
| 48 | field_simp |
| 49 | |
| 50 | /-- Square-time substitution for the exact shifted Harnack weight, |
| 51 | Section 6.5, pp. 129-133. -/ |
| 52 | theorem shiftedHarnack_integral_square {a b : ℝ} (ha : 0 ≤ a) (hab : a < b) |
| 53 | (H : ℝ → ℝ) : |
| 54 | (∫ t in a..b, Real.sqrt t * (Real.sqrt t - Real.sqrt a) ^ 2 * H t) = |
| 55 | ∫ s in Real.sqrt a..Real.sqrt b, |
| 56 | 2 * s ^ 2 * (s - Real.sqrt a) ^ 2 * H (s ^ 2) := by |
| 57 | have hle := Real.sqrt_le_sqrt hab.le |
| 58 | have hchange := intervalIntegral.integral_comp_mul_deriv_of_deriv_nonneg |
| 59 | (a := Real.sqrt a) (b := Real.sqrt b) |
| 60 | (f := fun s : ℝ => s ^ 2) (f' := fun s => 2 * s) |
| 61 | (g := fun t => Real.sqrt t * (Real.sqrt t - Real.sqrt a) ^ 2 * H t) |
| 62 | (continuous_pow 2).continuousOn |
| 63 | (fun s _ => by simpa using hasDerivAt_pow 2 s) |
| 64 | (fun s hs => by |
| 65 | rw [min_eq_left hle, max_eq_right hle] at hs |
| 66 | exact mul_nonneg (by norm_num) ((Real.sqrt_nonneg a).trans hs.1.le)) |
| 67 | rw [Real.sq_sqrt ha, Real.sq_sqrt (ha.trans hab.le)] at hchange |
| 68 | rw [← hchange] |
| 69 | apply intervalIntegral.integral_congr_Ioo_of_le hle |
| 70 | intro s hs |
| 71 | dsimp only [Function.comp_apply] |
| 72 | rw [Real.sqrt_sq ((Real.sqrt_nonneg a).trans hs.1.le)] |
| 73 | ring |
| 74 | |
| 75 | /-- The square-time shifted density is genuinely interval integrable, |
| 76 | including the zero endpoint, Section 6.5, pp. 129-133. -/ |
| 77 | theorem shiftedHarnack_square_intervalIntegrable {a b : ℝ} (ha : 0 ≤ a) (hab : a < b) |
| 78 | (H : ℝ → ℝ) |
| 79 | (hH : IntervalIntegrable (fun t => t * Real.sqrt t * H t) MeasureTheory.volume a b) : |
| 80 | IntervalIntegrable (fun s => 2 * s ^ 2 * (s - Real.sqrt a) ^ 2 * H (s ^ 2)) |
| 81 | MeasureTheory.volume (Real.sqrt a) (Real.sqrt b) := by |
| 82 | have hle := Real.sqrt_le_sqrt hab.le |
| 83 | have hchange := intervalIntegral.integrable_comp_mul_deriv_iff_of_deriv_nonneg |
| 84 | (a := Real.sqrt a) (b := Real.sqrt b) |
| 85 | (f := fun s : ℝ => s ^ 2) (f' := fun s => 2 * s) |
| 86 | (g := fun t => Real.sqrt t * (Real.sqrt t - Real.sqrt a) ^ 2 * H t) |
| 87 | (continuous_pow 2).continuousOn |
| 88 | (fun s _ => by simpa using hasDerivAt_pow 2 s) |
| 89 | (fun s hs => by |
| 90 | rw [min_eq_left hle, max_eq_right hle] at hs |
| 91 | exact mul_nonneg (by norm_num) ((Real.sqrt_nonneg a).trans hs.1.le)) |
| 92 | rw [Real.sq_sqrt ha, Real.sq_sqrt (ha.trans hab.le)] at hchange |
| 93 | apply (hchange.mpr (shiftedHarnack_intervalIntegrable ha hab H hH)).congr_uIoo |
| 94 | intro s hs |
| 95 | rw [uIoo_of_le hle] at hs |
| 96 | dsimp only [Function.comp_apply] |
| 97 | rw [Real.sqrt_sq ((Real.sqrt_nonneg a).trans hs.1.le)] |
| 98 | ring |
| 99 | |
| 100 | end PoincareMT.M14 |