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.CurveShortening.Comparison.Compatibility.SourceNames |
| 2 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.C1.NormalVelocityCommutation |
| 3 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.C2.GaugeWitnesses |
| 4 | import PoincareLib.Geometry.CurveShortening.Ramp.Data |
| 5 | import PoincareLib.Geometry.RicciFlow.CurveShortening.Evolution.Speed |
| 6 | import PoincareLib.Geometry.RicciFlow.CurveShortening.Connection.MetricVariation |
| 7 | import PoincareLib.Geometry.RicciFlow.Curvature.Calculus.Tensors.RicciRegularity |
| 8 | |
| 9 | /-! |
| 10 | # Actual speed evolution with C2 labels and C1 curvature |
| 11 | |
| 12 | Finite-regularity torsion cancellation provides the actual time |
| 13 | derivative of the spatial velocity. The evolving metric rule then |
| 14 | gives the speed equation used in fixed-label smoothing. |
| 15 | MT2007 Claim 19.1, p. 437, and Lemma 19.6, pp. 441-442; |
| 16 | MT2015Correction Lemma 0.1, p. 3; |
| 17 | `2026-09-22-fixed-label-c2-speed-evolution.md`, statement 3. |
| 18 | -/ |
| 19 | |
| 20 | set_option autoImplicit false |
| 21 | set_option backward.isDefEq.respectTransparency false |
| 22 | |
| 23 | open Set Filter |
| 24 | open scoped Manifold ContDiff Bundle Topology |
| 25 | |
| 26 | universe u |
| 27 | |
| 28 | namespace PoincareMT.M63 |
| 29 | |
| 30 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 31 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 32 | {a b : ℝ} |
| 33 | |
| 34 | /-- A C2-label solution whose actual curvature bundle is C1 satisfies |
| 35 | the witnessed speed equation at interior times. No smooth solution |
| 36 | record or raw mixed derivative is assumed. MT2015Correction Lemma 0.1, |
| 37 | p. 3; fixed-label C2 speed evolution, statement 3. -/ |
| 38 | theorem c2ShrinkingCurve_speed_hasDerivAt_of_curvature_c1 |
| 39 | (F : RicciFlow n M (Icc a b)) {c : ℝ → ℝ → M} {J : Set ℝ} |
| 40 | (hc : M63C2ShrinkingCurveOn F c J) |
| 41 | (hH : ContMDiffOn 𝓘(ℝ, ℝ × ℝ) ((𝓡 n).prod (𝓡 n)) 1 |
| 42 | (fun z : ℝ × ℝ => (⟨c z.1 z.2, m62CurvatureVector F c z.2 z.1⟩ : |
| 43 | TangentBundle (𝓡 n) M)) (univ ×ˢ interior J)) |
| 44 | {t : ℝ} (ht : t ∈ interior J) (x : ℝ) : |
| 45 | HasDerivAt (fun s => curveSpeed F c s x) |
| 46 | (-(m62TangentRicci F c t x + m62CurvatureSquared F c t x) * |
| 47 | curveSpeed F c t x) t := by |
| 48 | have htJ : t ∈ J := interior_subset ht |
| 49 | have htF : t ∈ Ioo a b := by |
| 50 | simpa only [interior_Icc] using interior_mono hc.domain_subset ht |
| 51 | have hopen : IsOpen (univ ×ˢ interior J : Set (ℝ × ℝ)) := |
| 52 | isOpen_univ.prod isOpen_interior |
| 53 | have hmem : (x, t) ∈ (univ ×ˢ interior J : Set (ℝ × ℝ)) := ⟨mem_univ _, ht⟩ |
| 54 | have htime : MDifferentiableAt 𝓘(ℝ, ℝ) 𝓘(ℝ, ℝ × ℝ) |
| 55 | (fun s : ℝ => (x, s)) t := |
| 56 | ((differentiableAt_const x).prodMk differentiableAt_id).mdifferentiableAt |
| 57 | have hspace (y : ℝ) : MDifferentiableAt 𝓘(ℝ, ℝ) 𝓘(ℝ, ℝ × ℝ) |
| 58 | (fun z : ℝ => (z, t)) y := |
| 59 | (differentiableAt_id.prodMk (differentiableAt_const t)).mdifferentiableAt |
| 60 | have hgammaTime := ((hc.joint_c1.contMDiffAt (hopen.mem_nhds hmem)).mdifferentiableAt |
| 61 | (by norm_num)).comp t htime |
| 62 | have hgammaSpace (y : ℝ) := |
| 63 | (hc.spatial_regular t htJ y).mdifferentiableAt (by norm_num) |
| 64 | have hS (y : ℝ) := |
| 65 | (unitTangent_contMDiff_of_c2 F c (hc.spatial_regular t htJ) |
| 66 | (hc.immersed t htJ) y).mdifferentiableAt (by norm_num) |
| 67 | have hHspace := ((hH.contMDiffAt (hopen.mem_nhds hmem)).mdifferentiableAt |
| 68 | (by norm_num)).comp x (hspace x) |
| 69 | have hT : ContMDiffOn 𝓘(ℝ, ℝ × ℝ) ((𝓡 n).prod (𝓡 n)) 1 |
| 70 | (fun z : ℝ × ℝ => (⟨c z.1 z.2, curveVelocity (fun s => c z.1 s) z.2⟩ : |
| 71 | TangentBundle (𝓡 n) M)) (univ ×ˢ interior J) := by |
| 72 | apply hH.congr |
| 73 | intro z hz |
| 74 | exact congrArg (Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) (c z.1 z.2)) |
| 75 | (hc.equation z.2 hz.2 z.1) |
| 76 | let D := F.connection t |
| 77 | obtain ⟨hXtime, hcommute⟩ := |
| 78 | pullback_velocity_commute_of_time_velocity_c1 D c hopen hc.joint_c1 hT hmem |
| 79 | let X := fun y => curveVelocity (n := n) (fun z => c z t) y |
| 80 | let S := spatialUnitTangent F c t |
| 81 | let H := m62CurvatureVector F c t |
| 82 | let v := curveSpeed F c t x |
| 83 | have hspeed (y : ℝ) : 0 < curveSpeed F c t y := |
| 84 | Real.sqrt_pos.mpr ((F.metric t).pos _ _ (hc.immersed t htJ y)) |
| 85 | have hv : v ≠ 0 := (hspeed x).ne' |
| 86 | have hunit (y : ℝ) : (F.metric t).inner (c y t) (S y) (S y) = 1 := by |
| 87 | have hne := (hspeed y).ne' |
| 88 | simp only [S, spatialUnitTangent, map_smul, smul_apply, smul_eq_mul] |
| 89 | rw [← M62.speed_sq F c t y] |
| 90 | field_simp |
| 91 | have horth (y : ℝ) : (F.metric t).inner (c y t) (H y) (S y) = 0 := by |
| 92 | have hpair := M62.hasDerivAt_metric_pairing D (hgammaSpace y) (hS y) (hS y) |
| 93 | have hconst : (fun z => (F.metric t).inner (c z t) (S z) (S z)) = |
| 94 | fun _ : ℝ => (1 : ℝ) := funext hunit |
| 95 | rw [hconst] at hpair |
| 96 | have heq := hpair.unique (hasDerivAt_const y (1 : ℝ)) |
| 97 | have hz : (F.metric t).inner (c y t) |
| 98 | (rampHorizontalCovariantDerivative D (fun z => c z t) S y) (S y) = 0 := by |
| 99 | rw [(F.metric t).symm (c y t) (S y)] at heq |
| 100 | linarith |
| 101 | dsimp only [D, S] at hz |
| 102 | simp only [H, S, m62CurvatureVector, m62SpatialDerivative, map_smul, smul_apply, |
| 103 | smul_eq_mul, hz, mul_zero] |
| 104 | have hX : X x = v • S x := by |
| 105 | symm |
| 106 | change v • (v⁻¹ • X x) = X x |
| 107 | rw [smul_smul, mul_inv_cancel₀ hv, one_smul] |
| 108 | have hDS : rampHorizontalCovariantDerivative D (fun y => c y t) S x = v • H x := by |
| 109 | symm |
| 110 | change v • (v⁻¹ • rampHorizontalCovariantDerivative D (fun y => c y t) S x) = _ |
| 111 | rw [smul_smul, mul_inv_cancel₀ hv, one_smul] |
| 112 | have hpair : HasDerivAt (fun y => (F.metric t).inner (c y t) (S y) (H y)) |
| 113 | ((F.metric t).inner (c x t) |
| 114 | (rampHorizontalCovariantDerivative D (fun y => c y t) S x) (H x) + |
| 115 | (F.metric t).inner (c x t) (S x) |
| 116 | (rampHorizontalCovariantDerivative D (fun y => c y t) H x)) x := |
| 117 | M62.hasDerivAt_metric_pairing D (hgammaSpace x) (hS x) hHspace |
| 118 | have hzero : (fun y => (F.metric t).inner (c y t) (S y) (H y)) = |
| 119 | fun _ : ℝ => 0 := by |
| 120 | funext y |
| 121 | rw [(F.metric t).symm (c y t) (S y) (H y)] |
| 122 | exact horth y |
| 123 | rw [hzero] at hpair |
| 124 | have hvalue := hpair.unique (hasDerivAt_const x (0 : ℝ)) |
| 125 | rw [hDS] at hvalue |
| 126 | simp only [map_smul, smul_apply, smul_eq_mul] at hvalue |
| 127 | have hcrossS : (F.metric t).inner (c x t) (S x) |
| 128 | (rampHorizontalCovariantDerivative D (fun y => c y t) H x) = |
| 129 | -v * m62CurvatureSquared F c t x := by |
| 130 | change v * m62CurvatureSquared F c t x + _ = 0 at hvalue |
| 131 | linarith |
| 132 | have hcross : (F.metric t).inner (c x t) (X x) |
| 133 | (rampHorizontalCovariantDerivative D (fun y => c y t) H x) = |
| 134 | -v ^ 2 * m62CurvatureSquared F c t x := by |
| 135 | rw [hX] |
| 136 | simp only [map_smul, smul_apply, smul_eq_mul, hcrossS] |
| 137 | ring |
| 138 | have hcross' := (F.metric t).symm (c x t) |
| 139 | (rampHorizontalCovariantDerivative D (fun y => c y t) H x) (X x) |
| 140 | rw [hcross] at hcross' |
| 141 | obtain ⟨A, hA⟩ := (M04.isSmoothCovariantTensor_ricciEvaluation D).1 (c x t) |
| 142 | have hscale := A.map_smul_univ (fun _ : Fin 2 => v) (fun _ : Fin 2 => S x) |
| 143 | rw [← hA, ← hA] at hscale |
| 144 | have hRic : D.ricci (c x t) (X x) (X x) = v ^ 2 * m62TangentRicci F c t x := by |
| 145 | rw [hX] |
| 146 | simpa only [LeviCivitaData.ricciEvaluation, Finset.prod_const, Finset.card_univ, |
| 147 | Fintype.card_fin, smul_eq_mul, m62TangentRicci, D, S] using hscale |
| 148 | have heq : (fun y => curveVelocity (fun s => c y s) t) = H := |
| 149 | funext (hc.equation t ht) |
| 150 | rw [heq] at hcommute |
| 151 | have hflow := M62.hasDerivAt_flow_metric_pairing F (γ := fun s => c x s) |
| 152 | (Y := fun s => curveVelocity (fun y => c y s) x) |
| 153 | (Z := fun s => curveVelocity (fun y => c y s) x) htF hgammaTime hXtime hXtime |
| 154 | have hsq : HasDerivAt (fun s => (curveSpeed F c s x) ^ 2) |
| 155 | (-2 * (m62TangentRicci F c t x + m62CurvatureSquared F c t x) * v ^ 2) t := by |
| 156 | apply (hflow.congr_of_eventuallyEq |
| 157 | (Eventually.of_forall (fun s => M62.speed_sq F c s x))).congr_deriv |
| 158 | rw [hcommute] |
| 159 | change -2 * D.ricci (c x t) (X x) (X x) + |
| 160 | (F.metric t).inner (c x t) |
| 161 | (rampHorizontalCovariantDerivative D (fun y => c y t) H x) (X x) + |
| 162 | (F.metric t).inner (c x t) (X x) |
| 163 | (rampHorizontalCovariantDerivative D (fun y => c y t) H x) = _ |
| 164 | rw [hcross, hcross', hRic] |
| 165 | ring |
| 166 | have h := hsq.sqrt (pow_ne_zero 2 hv) |
| 167 | have hsqrt : (fun s => curveSpeed F c s x) =ᶠ[𝓝 t] |
| 168 | (fun s => Real.sqrt (curveSpeed F c s x ^ 2)) := |
| 169 | Eventually.of_forall fun s => (Real.sqrt_sq (M62.speed_nonneg F c s x)).symm |
| 170 | apply (h.congr_of_eventuallyEq hsqrt).congr_deriv |
| 171 | rw [Real.sqrt_sq (M62.speed_nonneg F c t x)] |
| 172 | change -2 * _ * v ^ 2 / (2 * v) = -_ * v |
| 173 | field_simp |
| 174 | |
| 175 | end PoincareMT.M63 |