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 | # The boundary primitive for the adapted index trace |
| 5 | |
| 6 | The primitive is nonsingular on the full closed square interval and |
| 7 | vanishes at its initial endpoint, for zero or positive starting time. |
| 8 | Morgan-Tian Proposition 6.43 and Claim 6.44, pp. 127-129. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | |
| 13 | open Set |
| 14 | open scoped Manifold ContDiff intervalIntegral |
| 15 | |
| 16 | universe u |
| 17 | |
| 18 | namespace PoincareMT.M14 |
| 19 | |
| 20 | variable {n : ℕ} {X : Type u} [TopologicalSpace X] {time : X → ℝ} |
| 21 | {I : SpacetimeInterval} {G : GeneralizedLGeometryTransport n X time I} |
| 22 | {T a b : ℝ} {x y : G.Point} {p : M14BackwardPath G T a b x y} |
| 23 | |
| 24 | /-- The nonsingular scalar boundary primitive for the normalized |
| 25 | adapted trace, Proposition 6.43, pp. 127-128. -/ |
| 26 | noncomputable def adaptedScalarPrimitive (R : M14SquareRootPath G p) (s : ℝ) : ℝ := |
| 27 | 2 * s * (s - Real.sqrt a) ^ 2 * horizontalScalarCurvature G.leafwise (R.curve s) |
| 28 | |
| 29 | /-- The actual adapted scalar primitive is smooth at both closed |
| 30 | endpoints, Proposition 6.43, pp. 127-128. -/ |
| 31 | theorem adaptedScalarPrimitive_contDiffOn |
| 32 | (hM12 : GeneralizedRicciGaugeTheory.{u} n) (R : M14SquareRootPath G p) : |
| 33 | ContDiffOn ℝ ∞ (adaptedScalarPrimitive R) (M14SqrtParameterInterval a b) := |
| 34 | (((contDiffOn_const.mul contDiffOn_id).mul |
| 35 | ((contDiffOn_id.sub contDiffOn_const).pow 2)).mul (squareRoot_scalar_contDiffOn hM12 R)) |
| 36 | |
| 37 | /-- Differentiating the actual scalar boundary primitive retains the |
| 38 | backward scalar derivative and horizontal scalar differential, |
| 39 | Proposition 6.43, pp. 127-128. -/ |
| 40 | theorem adaptedScalarPrimitive_derivWithin |
| 41 | (hM12 : GeneralizedRicciGaugeTheory.{u} n) (R : M14SquareRootPath G p) |
| 42 | {s : ℝ} (hs : s ∈ M14SqrtParameterInterval a b) : |
| 43 | derivWithin (adaptedScalarPrimitive R) (M14SqrtParameterInterval a b) s = |
| 44 | (2 * (s - Real.sqrt a) ^ 2 + 4 * s * (s - Real.sqrt a)) * |
| 45 | horizontalScalarCurvature G.leafwise (R.curve s) + |
| 46 | 2 * s * (s - Real.sqrt a) ^ 2 * |
| 47 | (2 * s * M14BackwardTimeDerivative G (horizontalScalarCurvature G.leafwise) (R.curve s) + |
| 48 | M14HorizontalScalarDifferential G (R.curve s) (R.horizontal_velocity s).val) := by |
| 49 | have hC := uniqueDiffOn_Icc (Real.sqrt_lt_sqrt p.tau_nonneg p.tau_lt) |
| 50 | have hpoly : HasDerivAt (fun r : ℝ => 2 * r * (r - Real.sqrt a) ^ 2) |
| 51 | (2 * (s - Real.sqrt a) ^ 2 + 4 * s * (s - Real.sqrt a)) s := by |
| 52 | exact (((hasDerivAt_id s).const_mul 2).mul |
| 53 | (((hasDerivAt_id s).sub_const (Real.sqrt a)).pow 2)).congr_deriv |
| 54 | (by simp only [id_eq, Pi.pow_apply]; ring) |
| 55 | exact (hpoly.hasDerivWithinAt.mul (squareRoot_scalar_hasDerivWithinAt hM12 R hs)).derivWithin |
| 56 | (hC s hs) |
| 57 | |
| 58 | /-- The integral of the actual primitive derivative is exactly the |
| 59 | terminal scalar term, with the initial boundary zero, Proposition 6.43, |
| 60 | pp. 127-128. -/ |
| 61 | theorem integral_adaptedScalarPrimitive_derivWithin |
| 62 | (hM12 : GeneralizedRicciGaugeTheory.{u} n) (R : M14SquareRootPath G p) : |
| 63 | (∫ s in Real.sqrt a..Real.sqrt b, |
| 64 | derivWithin (adaptedScalarPrimitive R) (M14SqrtParameterInterval a b) s) = |
| 65 | 2 * Real.sqrt b * (Real.sqrt b - Real.sqrt a) ^ 2 * |
| 66 | horizontalScalarCurvature G.leafwise (R.curve (Real.sqrt b)) := by |
| 67 | have hle := Real.sqrt_le_sqrt p.tau_lt.le |
| 68 | have hC := uniqueDiffOn_Icc (Real.sqrt_lt_sqrt p.tau_nonneg p.tau_lt) |
| 69 | have hP := adaptedScalarPrimitive_contDiffOn hM12 R |
| 70 | have hPi : IntervalIntegrable |
| 71 | (derivWithin (adaptedScalarPrimitive R) (M14SqrtParameterInterval a b)) |
| 72 | MeasureTheory.volume (Real.sqrt a) (Real.sqrt b) := |
| 73 | ((hP.derivWithin hC (m := ∞) (by simp)).continuousOn).intervalIntegrable_of_Icc hle |
| 74 | have hFTC : (∫ s in Real.sqrt a..Real.sqrt b, |
| 75 | derivWithin (adaptedScalarPrimitive R) (M14SqrtParameterInterval a b) s) = |
| 76 | adaptedScalarPrimitive R (Real.sqrt b) - adaptedScalarPrimitive R (Real.sqrt a) := by |
| 77 | apply intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le hle hP.continuousOn _ hPi |
| 78 | intro s hs |
| 79 | have hd := (hP.differentiableOn (by simp) s (Ioo_subset_Icc_self hs)).hasDerivWithinAt |
| 80 | exact hd.hasDerivAt (Icc_mem_nhds hs.1 hs.2) |
| 81 | simpa only [adaptedScalarPrimitive, sub_self, zero_pow (by norm_num : 2 ≠ 0), |
| 82 | mul_zero, zero_mul, sub_zero] using hFTC |
| 83 | |
| 84 | end PoincareMT.M14 |