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.Evolution.SpeedEvolution |
| 2 | import PoincareLib.Geometry.RicciFlow.CurveShortening.Integral.Continuity |
| 3 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Minimum.Variation.Geometry.ParameterIntegral |
| 4 | import PoincareLib.Geometry.CurveShortening.Evolution.Theory |
| 5 | |
| 6 | /-! |
| 7 | # Length evolution and ambient upper bounds |
| 8 | |
| 9 | MT2007 Lemma 19.9, p. 444, is retained by the 2015 correction, |
| 10 | Lemma 0.4, pp. 7-8. The actual speed law and smooth parameter integration |
| 11 | give a genuine time derivative before any use of the totalized derivative. |
| 12 | See `references/ricci-flow/mapher/curve-evolution/derivations/2026-09-19-length-evolution.md`. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open scoped Manifold ContDiff Bundle intervalIntegral |
| 18 | |
| 19 | universe u |
| 20 | |
| 21 | namespace PoincareMT.M62 |
| 22 | |
| 23 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 24 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 25 | {a b : ℝ} (F : RicciFlow n M (Set.Icc a b)) (c : ℝ → ℝ → M) |
| 26 | |
| 27 | /-- The length evolution density is continuous on each interior time slice. |
| 28 | MT2007 Lemma 19.9, p. 444; correction Lemma 0.4, pp. 7-8. -/ |
| 29 | theorem length_density_continuous (hc : M62ShrinkingCurve F c) |
| 30 | {t : ℝ} (ht : t ∈ Set.Ioo a b) : |
| 31 | Continuous (fun x ↦ |
| 32 | (m62CurvatureSquared F c t x + m62TangentRicci F c t x) * |
| 33 | curveSpeed F c t x) := by |
| 34 | let V := fun z : ℝ × ℝ ↦ curveSpeed F c z.2 z.1 |
| 35 | have hV := speed_joint_contDiffOn F c hc |
| 36 | have hpartial := ReducedLengthMinimum.Variation.Geometry.variationParameterDeriv_contDiffOn |
| 37 | (uniqueDiffOn_univ : UniqueDiffOn ℝ (Set.univ : Set ℝ)) isOpen_Ioo V hV |
| 38 | have hslice : Continuous (fun x ↦ |
| 39 | ReducedLengthMinimum.Variation.Geometry.variationParameterDeriv Set.univ (Set.Ioo a b) V (x, t)) := |
| 40 | hpartial.continuousOn.comp_continuous |
| 41 | (continuous_id.prodMk continuous_const) (fun _ ↦ ⟨Set.mem_univ _, ht⟩) |
| 42 | have heq (x : ℝ) := (ReducedLengthMinimum.Variation.Geometry.hasDerivAt_variationParameter isOpen_Ioo V hV |
| 43 | (Set.mem_univ x) ht).unique (hasDerivAt_speed F c hc ht x) |
| 44 | convert hslice.neg using 1 |
| 45 | funext x |
| 46 | change (m62CurvatureSquared F c t x + m62TangentRicci F c t x) * |
| 47 | curveSpeed F c t x = -ReducedLengthMinimum.Variation.Geometry.variationParameterDeriv Set.univ (Set.Ioo a b) V (x, t) |
| 48 | rw [heq x] |
| 49 | ring |
| 50 | |
| 51 | /-- The actual length has the derivative in MT2007 Lemma 19.9, p. 444, |
| 52 | retained by correction Lemma 0.4, pp. 7-8. -/ |
| 53 | theorem hasDerivAt_length (hc : M62ShrinkingCurve F c) |
| 54 | {t : ℝ} (ht : t ∈ Set.Ioo a b) : |
| 55 | HasDerivAt (m62Length F c) |
| 56 | (-(∫ x in (0 : ℝ)..curvePeriod, |
| 57 | (m62CurvatureSquared F c t x + m62TangentRicci F c t x) * |
| 58 | curveSpeed F c t x)) t := by |
| 59 | have hperiod : 0 < curvePeriod := by |
| 60 | unfold curvePeriod |
| 61 | positivity |
| 62 | let V := fun z : ℝ × ℝ ↦ curveSpeed F c z.2 z.1 |
| 63 | have hV : ContDiffOn ℝ ∞ V (Set.Icc 0 curvePeriod ×ˢ Set.Ioo a b) := |
| 64 | (speed_joint_contDiffOn F c hc).mono |
| 65 | (Set.prod_mono (Set.subset_univ _) Set.Subset.rfl) |
| 66 | have hd := ReducedLengthMinimum.Variation.Geometry.hasDerivAt_variationIntegral hperiod isOpen_Ioo V hV ht |
| 67 | apply hd.congr_deriv |
| 68 | rw [← intervalIntegral.integral_neg] |
| 69 | apply intervalIntegral.integral_congr |
| 70 | intro x hx |
| 71 | have hx' : x ∈ Set.Icc 0 curvePeriod := by |
| 72 | simpa only [Set.uIcc_of_le hperiod.le] using hx |
| 73 | have heq := (ReducedLengthMinimum.Variation.Geometry.hasDerivAt_variationParameter isOpen_Ioo V hV hx' ht).unique |
| 74 | (hasDerivAt_speed F c hc ht x) |
| 75 | dsimp only |
| 76 | rw [heq] |
| 77 | ring |
| 78 | |
| 79 | /-- The ambient Ricci bound gives the integral upper bound for length. |
| 80 | MT2007 Lemma 19.9, p. 444; correction Lemma 0.4, pp. 7-8. -/ |
| 81 | theorem length_deriv_le_integral (hc : M62ShrinkingCurve F c) |
| 82 | {K0 K1 K2 : ℝ} (hBounds : CurveEvolutionAmbientBounds F K0 K1 K2) |
| 83 | {t : ℝ} (ht : t ∈ Set.Ioo a b) : |
| 84 | deriv (m62Length F c) t ≤ ∫ x in (0 : ℝ)..curvePeriod, |
| 85 | (K2 - m62CurvatureSquared F c t x) * curveSpeed F c t x := by |
| 86 | have hclosed := Set.Ioo_subset_Icc_self ht |
| 87 | have hperiod : 0 ≤ curvePeriod := by |
| 88 | unfold curvePeriod |
| 89 | positivity |
| 90 | have hV : Continuous (curveSpeed F c t) := |
| 91 | (speed_continuousOn F c hc).comp_continuous |
| 92 | (continuous_id.prodMk continuous_const) (fun _ ↦ ⟨Set.mem_univ _, hclosed⟩) |
| 93 | have hK : Continuous (m62CurvatureSquared F c t) := |
| 94 | (curvatureSquared_continuousOn F c hc).comp_continuous |
| 95 | (continuous_id.prodMk continuous_const) (fun _ ↦ ⟨Set.mem_univ _, hclosed⟩) |
| 96 | rw [(hasDerivAt_length F c hc ht).deriv, ← intervalIntegral.integral_neg] |
| 97 | apply intervalIntegral.integral_mono hperiod |
| 98 | ((length_density_continuous F c hc ht).neg.intervalIntegrable _ _) |
| 99 | (((continuous_const.sub hK).mul hV).intervalIntegrable _ _) |
| 100 | intro x |
| 101 | have hunit := (unitTangent_norm F c hc hclosed x).le |
| 102 | have hRic : -K2 ≤ m62TangentRicci F c t x := |
| 103 | (abs_le.mp (hBounds.ricci t hclosed (c x t) |
| 104 | (spatialUnitTangent F c t x) (spatialUnitTangent F c t x) hunit hunit)).1 |
| 105 | calc |
| 106 | -((m62CurvatureSquared F c t x + m62TangentRicci F c t x) * |
| 107 | curveSpeed F c t x) = |
| 108 | (-m62CurvatureSquared F c t x - m62TangentRicci F c t x) * |
| 109 | curveSpeed F c t x := by ring |
| 110 | _ ≤ (K2 - m62CurvatureSquared F c t x) * curveSpeed F c t x := |
| 111 | mul_le_mul_of_nonneg_right (by linarith) (speed_nonneg F c t x) |
| 112 | |
| 113 | /-- Dropping the nonnegative curvature contribution bounds length growth. |
| 114 | MT2007 Lemma 19.9, p. 444; correction Lemma 0.4, pp. 7-8. -/ |
| 115 | theorem length_deriv_le (hc : M62ShrinkingCurve F c) |
| 116 | {K0 K1 K2 : ℝ} (hBounds : CurveEvolutionAmbientBounds F K0 K1 K2) |
| 117 | {t : ℝ} (ht : t ∈ Set.Ioo a b) : |
| 118 | deriv (m62Length F c) t ≤ K2 * m62Length F c t := by |
| 119 | have hclosed := Set.Ioo_subset_Icc_self ht |
| 120 | have hperiod : 0 ≤ curvePeriod := by |
| 121 | unfold curvePeriod |
| 122 | positivity |
| 123 | have hV : Continuous (curveSpeed F c t) := |
| 124 | (speed_continuousOn F c hc).comp_continuous |
| 125 | (continuous_id.prodMk continuous_const) (fun _ ↦ ⟨Set.mem_univ _, hclosed⟩) |
| 126 | have hK : Continuous (m62CurvatureSquared F c t) := |
| 127 | (curvatureSquared_continuousOn F c hc).comp_continuous |
| 128 | (continuous_id.prodMk continuous_const) (fun _ ↦ ⟨Set.mem_univ _, hclosed⟩) |
| 129 | calc |
| 130 | deriv (m62Length F c) t ≤ ∫ x in (0 : ℝ)..curvePeriod, |
| 131 | (K2 - m62CurvatureSquared F c t x) * curveSpeed F c t x := |
| 132 | length_deriv_le_integral F c hc hBounds ht |
| 133 | _ ≤ ∫ x in (0 : ℝ)..curvePeriod, K2 * curveSpeed F c t x := by |
| 134 | apply intervalIntegral.integral_mono hperiod |
| 135 | (((continuous_const.sub hK).mul hV).intervalIntegrable _ _) |
| 136 | ((hV.const_mul K2).intervalIntegrable _ _) |
| 137 | intro x |
| 138 | exact mul_le_mul_of_nonneg_right |
| 139 | (sub_le_self _ (curvatureSquared_nonneg F c t x)) (speed_nonneg F c t x) |
| 140 | _ = K2 * m62Length F c t := intervalIntegral.integral_const_mul _ _ |
| 141 | |
| 142 | end PoincareMT.M62 |