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.CurveShortening.Integral.Periodicity |
| 2 | import PoincareLib.Geometry.RicciFlow.CurveShortening.Integral.Length |
| 3 | |
| 4 | /-! |
| 5 | # Differential bound for regularized total curvature |
| 6 | |
| 7 | Differentiate the genuine smooth density under the fixed parameter |
| 8 | integral, apply the pointwise estimate, then cancel the periodic second |
| 9 | arc derivative. Source: MT2015Correction Lemma 0.4, pp. 7-8; |
| 10 | see `references/ricci-flow/mapher/curve-evolution/derivations/2026-09-20-regularized-integral.md`. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | set_option backward.isDefEq.respectTransparency false |
| 15 | |
| 16 | open scoped Manifold ContDiff Bundle intervalIntegral |
| 17 | |
| 18 | namespace PoincareMT.M62 |
| 19 | |
| 20 | variable {n : ℕ} {M : Type*} [TopologicalSpace M] |
| 21 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 22 | {a b : ℝ} |
| 23 | |
| 24 | /-- The actual regularized total curvature has the derivative obtained |
| 25 | from its smooth density; correction Lemma 0.4, pp. 7-8. -/ |
| 26 | theorem hasDerivAt_regularizedTotal |
| 27 | (F : RicciFlow n M (Set.Icc a b)) (c : ℝ → ℝ → M) |
| 28 | (hc : M62ShrinkingCurve F c) {ε t : ℝ} |
| 29 | (hε : 0 < ε) (ht : t ∈ Set.Ioo a b) : |
| 30 | HasDerivAt (m62RegularizedTotalCurvature F c ε) |
| 31 | (∫ x in (0 : ℝ)..curvePeriod, |
| 32 | deriv (fun s => m62RegularizedCurvature F c ε s x * curveSpeed F c s x) t) t := by |
| 33 | have hperiod : 0 < curvePeriod := by unfold curvePeriod; positivity |
| 34 | let V := fun z : ℝ × ℝ => m62RegularizedCurvature F c ε z.2 z.1 * curveSpeed F c z.2 z.1 |
| 35 | have hV : ContDiffOn ℝ ∞ V (Set.Icc 0 curvePeriod ×ˢ Set.Ioo a b) := |
| 36 | ((regularized_smooth F c hε (curvatureSquared_contDiffOn F c hc)).mul |
| 37 | (speed_joint_contDiffOn F c hc)).mono |
| 38 | (Set.prod_mono (Set.subset_univ _) Set.Subset.rfl) |
| 39 | apply (ReducedLengthMinimum.Variation.Geometry.hasDerivAt_variationIntegral hperiod isOpen_Ioo V hV ht).congr_deriv |
| 40 | apply intervalIntegral.integral_congr |
| 41 | intro x hx |
| 42 | have hx' : x ∈ Set.Icc 0 curvePeriod := by |
| 43 | simpa only [Set.uIcc_of_le hperiod.le] using hx |
| 44 | exact (ReducedLengthMinimum.Variation.Geometry.hasDerivAt_variationParameter isOpen_Ioo V hV hx' ht).deriv.symm |
| 45 | |
| 46 | set_option maxHeartbeats 800000 in |
| 47 | -- Smooth density transport and integral linearity elaborate the same dependent flow. |
| 48 | /-- Integrating the positive-regularized bound retains the length forcing |
| 49 | term with the frozen constants; correction Lemma 0.4, pp. 7-8. -/ |
| 50 | theorem regularized_total_deriv_le [T2Space M] |
| 51 | (F : RicciFlow n M (Set.Icc a b)) (c : ℝ → ℝ → M) |
| 52 | (hc : M62ShrinkingCurve F c) {K0 K1 K2 : ℝ} |
| 53 | (h0 : 0 ≤ K0) (h1 : 0 ≤ K1) (h2 : 0 ≤ K2) |
| 54 | (hBounds : CurveEvolutionAmbientBounds F K0 K1 K2) |
| 55 | {ε t : ℝ} (hε : 0 < ε) (ht : t ∈ Set.Ioo a b) : |
| 56 | deriv (m62RegularizedTotalCurvature F c ε) t ≤ |
| 57 | (m62C1 K0 K1 K2 + K2) * m62RegularizedTotalCurvature F c ε t + |
| 58 | m62C1 K0 K1 K2 * m62Length F c t := by |
| 59 | let h := m62RegularizedCurvature F c ε t |
| 60 | let v := curveSpeed F c t |
| 61 | let Lh := m62ArcSecondDerivative F c t h |
| 62 | let A := m62C1 K0 K1 K2 + K2 |
| 63 | let B := m62C1 K0 K1 K2 |
| 64 | have hclosed := Set.Ioo_subset_Icc_self ht |
| 65 | have hperiod : 0 ≤ curvePeriod := by unfold curvePeriod; positivity |
| 66 | have hh : ContDiff ℝ ∞ h := |
| 67 | (regularized_smooth F c hε (curvatureSquared_contDiffOn F c hc)).comp_contDiff |
| 68 | (contDiff_id.prodMk contDiff_const) (fun _ => ⟨Set.mem_univ _, ht⟩) |
| 69 | have hv : ContDiff ℝ ∞ v := |
| 70 | (speed_joint_contDiffOn F c hc).comp_contDiff |
| 71 | (contDiff_id.prodMk contDiff_const) (fun _ => ⟨Set.mem_univ _, ht⟩) |
| 72 | have hvi := hv.inv (fun x => (speed_pos F c hc hclosed x).ne') |
| 73 | have hfirst : ContDiff ℝ ∞ (m62ArcDerivative F c t h) := |
| 74 | hvi.mul (contDiff_infty_iff_deriv.mp hh).2 |
| 75 | have hsecond : ContDiff ℝ ∞ Lh := |
| 76 | hvi.mul (contDiff_infty_iff_deriv.mp hfirst).2 |
| 77 | let V := fun z : ℝ × ℝ => m62RegularizedCurvature F c ε z.2 z.1 * curveSpeed F c z.2 z.1 |
| 78 | have hV : ContDiffOn ℝ ∞ V (Set.univ ×ˢ Set.Ioo a b) := |
| 79 | (regularized_smooth F c hε (curvatureSquared_contDiffOn F c hc)).mul |
| 80 | (speed_joint_contDiffOn F c hc) |
| 81 | have hpartial := ReducedLengthMinimum.Variation.Geometry.variationParameterDeriv_contDiffOn |
| 82 | (uniqueDiffOn_univ : UniqueDiffOn ℝ (Set.univ : Set ℝ)) isOpen_Ioo V hV |
| 83 | have hdensity : Continuous (fun x => deriv (fun s => V (x, s)) t) := by |
| 84 | convert hpartial.continuousOn.comp_continuous |
| 85 | (continuous_id.prodMk continuous_const) (fun _ => ⟨Set.mem_univ _, ht⟩) using 1 |
| 86 | funext x |
| 87 | exact (ReducedLengthMinimum.Variation.Geometry.hasDerivAt_variationParameter isOpen_Ioo V hV (Set.mem_univ x) ht).deriv |
| 88 | have hLhi : IntervalIntegrable (fun x => Lh x * v x) MeasureTheory.volume 0 curvePeriod := |
| 89 | (hsecond.continuous.mul hv.continuous).intervalIntegrable 0 curvePeriod |
| 90 | have hhi : IntervalIntegrable (fun x => h x * v x) MeasureTheory.volume 0 curvePeriod := |
| 91 | (hh.continuous.mul hv.continuous).intervalIntegrable 0 curvePeriod |
| 92 | have hvi' := hv.continuous.intervalIntegrable (μ := MeasureTheory.volume) 0 curvePeriod |
| 93 | calc |
| 94 | _ = ∫ x in (0 : ℝ)..curvePeriod, deriv (fun s => V (x, s)) t := |
| 95 | (hasDerivAt_regularizedTotal F c hc hε ht).deriv |
| 96 | _ ≤ ∫ x in (0 : ℝ)..curvePeriod, (Lh x + A * h x + B) * v x := by |
| 97 | apply intervalIntegral.integral_mono hperiod (hdensity.intervalIntegrable _ _) |
| 98 | ((((hsecond.continuous.add (hh.continuous.const_mul A)).add continuous_const).mul |
| 99 | hv.continuous).intervalIntegrable _ _) |
| 100 | intro x |
| 101 | have hRt := regularized_hasDerivAt_time F c hε |
| 102 | (hasDerivAt_curvatureSquared F c hc ht x) |
| 103 | have hd := hRt.differentiableAt.hasDerivAt.mul (hasDerivAt_speed F c hc ht x) |
| 104 | have hderiv : deriv (fun s => m62RegularizedCurvature F c ε s x * |
| 105 | curveSpeed F c s x) t = |
| 106 | deriv (fun s => m62RegularizedCurvature F c ε s x) t * curveSpeed F c t x + |
| 107 | m62RegularizedCurvature F c ε t x * |
| 108 | (-(m62TangentRicci F c t x + m62CurvatureSquared F c t x) * |
| 109 | curveSpeed F c t x) := hd.deriv |
| 110 | have hb := regularized_deriv_le F c hc h0 h1 h2 hBounds hε ht x |
| 111 | have hunit := (unitTangent_norm F c hc hclosed x).le |
| 112 | have hRic : -K2 ≤ m62TangentRicci F c t x := |
| 113 | (abs_le.mp (hBounds.ricci t hclosed (c x t) |
| 114 | (spatialUnitTangent F c t x) (spatialUnitTangent F c t x) hunit hunit)).1 |
| 115 | have hRicmul := mul_le_mul_of_nonneg_left hRic (regularized_pos F c hε t x).le |
| 116 | have hcubic : (m62Curvature F c t x) ^ 3 ≤ h x * m62CurvatureSquared F c t x := by |
| 117 | calc |
| 118 | _ = m62Curvature F c t x * (m62Curvature F c t x) ^ 2 := by ring |
| 119 | _ ≤ h x * (m62Curvature F c t x) ^ 2 := |
| 120 | mul_le_mul_of_nonneg_right (curvature_le_regularized F c ε t x) (sq_nonneg _) |
| 121 | _ = _ := by rw [curvature_sq F c t x] |
| 122 | have hscalar : deriv (fun s => m62RegularizedCurvature F c ε s x) t - |
| 123 | h x * (m62CurvatureSquared F c t x + m62TangentRicci F c t x) ≤ |
| 124 | Lh x + A * h x + B := by |
| 125 | dsimp only [Lh, A, B, h] at * |
| 126 | nlinarith only [hb, hcubic, hRicmul] |
| 127 | change deriv (fun s => m62RegularizedCurvature F c ε s x * curveSpeed F c s x) t ≤ _ |
| 128 | rw [hderiv] |
| 129 | convert! mul_le_mul_of_nonneg_right hscalar (speed_nonneg F c t x) using 1 |
| 130 | ring |
| 131 | _ = (∫ x in (0 : ℝ)..curvePeriod, Lh x * v x) + |
| 132 | A * (∫ x in (0 : ℝ)..curvePeriod, h x * v x) + |
| 133 | B * (∫ x in (0 : ℝ)..curvePeriod, v x) := by |
| 134 | simp_rw [add_mul, mul_assoc] |
| 135 | rw [intervalIntegral.integral_add (hLhi.add (hhi.const_mul A)) (hvi'.const_mul B), |
| 136 | intervalIntegral.integral_add hLhi (hhi.const_mul A), |
| 137 | intervalIntegral.integral_const_mul, intervalIntegral.integral_const_mul] |
| 138 | _ = _ := by |
| 139 | rw [integral_regularized_arcSecond_eq_zero F c hc hε ht, zero_add] |
| 140 | rfl |
| 141 | |
| 142 | end PoincareMT.M62 |