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.Ramp.Analysis.Continuous.ArclengthFamily |
| 2 | import PoincareLib.Geometry.CurveShortening.Ramp.Analysis.Periodic.SmoothApproximation |
| 3 | import PoincareLib.Geometry.CurveShortening.Ramp.Analysis.Smooth.RetractionDifferentials |
| 4 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.Pullback.MetricHessian |
| 5 | import PoincareLib.Geometry.CurveShortening.Ramp.CurveEstimates.Relabeling.Geometry |
| 6 | import Mathlib.Analysis.SpecialFunctions.Sqrt |
| 7 | |
| 8 | /-! |
| 9 | # Actual geometric arclength families on one fixed period |
| 10 | |
| 11 | The actual metric speed and its witnessed spatial derivative feed the |
| 12 | canonical scalar arclength family. The same inverse labels preserve all |
| 13 | three jointly continuous embedded jets. MT2007 Claim 19.1, p. 437, |
| 14 | Lemma 19.6, pp. 441-442, and Lemma 19.17, pp. 449-450; |
| 15 | `2026-09-23-geometric-arclength-family.md`. |
| 16 | -/ |
| 17 | |
| 18 | set_option autoImplicit false |
| 19 | set_option backward.isDefEq.respectTransparency false |
| 20 | |
| 21 | open Set Filter |
| 22 | open scoped Manifold ContDiff Bundle Topology |
| 23 | |
| 24 | universe u v w |
| 25 | |
| 26 | namespace PoincareMT.M63 |
| 27 | |
| 28 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 29 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 30 | {ι : Type v} [Fintype ι] {Z : Type w} [TopologicalSpace Z] {a b : ℝ} |
| 31 | |
| 32 | local notation "W" => EuclideanSpace ℝ ι |
| 33 | |
| 34 | /-- Actual continuous C2 initial jets determine one canonical family of |
| 35 | positive C2 arclength labels on the prescribed fixed period. MT2007 |
| 36 | Claim 19.1, p. 437; geometric arclength-family derivation. -/ |
| 37 | theorem exists_continuous_geometric_arclength_family |
| 38 | (F : RicciFlow n M (Icc a b)) {tau : ℝ} (htau : tau ∈ Icc a b) |
| 39 | {L0 : ℝ} (hL0 : 0 < L0) |
| 40 | {e : M → W} (he : ContMDiff (𝓡 n) 𝓘(ℝ, W) ∞ e) |
| 41 | {U : Set W} (hU : IsOpen U) (heU : range e ⊆ U) {ρ : W → M} |
| 42 | (hρ : ContMDiffOn 𝓘(ℝ, W) (𝓡 n) ∞ ρ U) (hρe : ∀ p, ρ (e p) = p) |
| 43 | (gamma : Z → ℝ → M) |
| 44 | (hperiod : ∀ z, Function.Periodic (gamma z) L0) |
| 45 | (hC2 : ∀ z, ContMDiff 𝓘(ℝ, ℝ) (𝓡 n) 2 (gamma z)) |
| 46 | (himm : ∀ z x, curveVelocity (n := n) (gamma z) x ≠ 0) |
| 47 | (hzero : Continuous (fun p : Z × ℝ => e (gamma p.1 p.2))) |
| 48 | (hfirst : Continuous (fun p : Z × ℝ => |
| 49 | deriv (fun y => e (gamma p.1 y)) p.2)) |
| 50 | (hsecond : Continuous (fun p : Z × ℝ => |
| 51 | deriv (deriv (fun y => e (gamma p.1 y))) p.2)) : |
| 52 | let v := fun (z : Z) (x : ℝ) => curveSpeed F (fun y _ => gamma z y) tau x |
| 53 | let m := fun z => (∫ x in (0 : ℝ)..L0, v z x) / L0 |
| 54 | (∀ z, 0 < m z) ∧ Continuous m ∧ |
| 55 | ∃ phi : Z → (ℝ ≃o ℝ), |
| 56 | let q := fun (z : Z) (x : ℝ) => e (gamma z ((phi z).symm x)) |
| 57 | (∀ z, |
| 58 | (∀ x, phi z x = (m z)⁻¹ * ∫ y in (0 : ℝ)..x, v z y) ∧ |
| 59 | ContDiff ℝ 2 (phi z : ℝ → ℝ) ∧ |
| 60 | ContDiff ℝ 2 ((phi z).symm : ℝ → ℝ) ∧ |
| 61 | phi z 0 = 0 ∧ |
| 62 | (∀ x, phi z (x + L0) = phi z x + L0) ∧ |
| 63 | (∀ x, (phi z).symm (x + L0) = (phi z).symm x + L0) ∧ |
| 64 | (∀ x, 0 < deriv (phi z : ℝ → ℝ) x ∧ |
| 65 | 0 < deriv ((phi z).symm : ℝ → ℝ) x)) ∧ |
| 66 | Continuous (fun p : Z × ℝ => phi p.1 p.2) ∧ |
| 67 | Continuous (fun p : Z × ℝ => deriv (phi p.1 : ℝ → ℝ) p.2) ∧ |
| 68 | Continuous (fun p : Z × ℝ => deriv (deriv (phi p.1 : ℝ → ℝ)) p.2) ∧ |
| 69 | Continuous (fun p : Z × ℝ => (phi p.1).symm p.2) ∧ |
| 70 | Continuous (fun p : Z × ℝ => deriv ((phi p.1).symm : ℝ → ℝ) p.2) ∧ |
| 71 | Continuous (fun p : Z × ℝ => |
| 72 | deriv (deriv ((phi p.1).symm : ℝ → ℝ)) p.2) ∧ |
| 73 | (∀ z, |
| 74 | Function.Periodic (fun x => gamma z ((phi z).symm x)) L0 ∧ |
| 75 | ContMDiff 𝓘(ℝ, ℝ) (𝓡 n) 2 (fun x => gamma z ((phi z).symm x)) ∧ |
| 76 | (∀ x, curveVelocity (n := n) (fun y => gamma z ((phi z).symm y)) x ≠ 0) ∧ |
| 77 | (∀ x, curveSpeed F (fun y _ => gamma z ((phi z).symm y)) tau x = m z) ∧ |
| 78 | (∀ x, gamma z ((phi z).symm (phi z x)) = gamma z x)) ∧ |
| 79 | Continuous (fun p : Z × ℝ => q p.1 p.2) ∧ |
| 80 | Continuous (fun p : Z × ℝ => deriv (q p.1) p.2) ∧ |
| 81 | Continuous (fun p : Z × ℝ => deriv (deriv (q p.1)) p.2) := by |
| 82 | classical |
| 83 | let : Fact (0 < L0) := ⟨hL0⟩ |
| 84 | let f : Z → ℝ → W := fun z x => e (gamma z x) |
| 85 | let p : Z → ℝ → W := fun z => deriv (f z) |
| 86 | let r : Z → ℝ → W := fun z => deriv (p z) |
| 87 | let v : Z → ℝ → ℝ := fun z x => curveSpeed F (fun y _ => gamma z y) tau x |
| 88 | let m : Z → ℝ := fun z => (∫ x in (0 : ℝ)..L0, v z x) / L0 |
| 89 | have hf (z : Z) : ContDiff ℝ 2 (f z) := |
| 90 | ((he.of_le (ENat.natCast_le_of_coe_top_le_withTop le_rfl 2)).comp (hC2 z)).contDiff |
| 91 | have hfd (z : Z) (x : ℝ) : HasDerivAt (f z) (p z x) x := |
| 92 | ((hf z).differentiable (by norm_num) x).hasDerivAt |
| 93 | have hpd (z : Z) (x : ℝ) : HasDerivAt (p z) (r z x) x := |
| 94 | (((hf z).deriv' (n := 1)).differentiable (by norm_num) x).hasDerivAt |
| 95 | have hpush (z : Z) (x : ℝ) : p z x = |
| 96 | (mfderiv (𝓡 n) 𝓘(ℝ, W) e (gamma z x) |
| 97 | (curveVelocity (n := n) (gamma z) x) : W) := by |
| 98 | have hchain : fderiv ℝ (f z) x = |
| 99 | (mfderiv (𝓡 n) 𝓘(ℝ, W) e (gamma z x)).comp |
| 100 | (mfderiv 𝓘(ℝ, ℝ) (𝓡 n) (gamma z) x) := by |
| 101 | rw [← mfderiv_eq_fderiv] |
| 102 | exact mfderiv_comp x (he.mdifferentiable (by simp)).mdifferentiableAt |
| 103 | ((hC2 z x).mdifferentiableAt (by norm_num)) |
| 104 | exact congrArg (fun L : ℝ →L[ℝ] W => L 1) hchain |
| 105 | let O : Set (W × W) := U ×ˢ univ |
| 106 | have hO : IsOpen O := hU.prod isOpen_univ |
| 107 | let G : W × W → ℝ := fun z => (F.metric tau).inner (ρ z.1) |
| 108 | (mfderiv 𝓘(ℝ, W) (𝓡 n) ρ z.1 z.2) (mfderiv 𝓘(ℝ, W) (𝓡 n) ρ z.1 z.2) |
| 109 | have hG0 := (flow_pullback_metric_hessian_contDiffOn F hU hρ |
| 110 | (contMDiff_const (c := (0 : ℝ)))).1 |
| 111 | have hG : ContDiffOn ℝ ∞ G O := |
| 112 | hG0.comp (s := O) |
| 113 | ((contDiff_const.prodMk contDiff_fst).prodMk contDiff_snd).contDiffOn |
| 114 | (fun z hz => ⟨⟨htau, hz.1⟩, hz.2⟩) |
| 115 | have hleft := (smooth_retraction_differentials he hU heU hρ hρe).2.2 |
| 116 | have hGvalue (z : Z) (x : ℝ) : G (f z x, p z x) = |
| 117 | (F.metric tau).inner (gamma z x) |
| 118 | (curveVelocity (n := n) (gamma z) x) (curveVelocity (n := n) (gamma z) x) := by |
| 119 | dsimp only [G, f] |
| 120 | rw [hpush] |
| 121 | erw [hleft (gamma z x) (curveVelocity (n := n) (gamma z) x), hρe (gamma z x)] |
| 122 | have hGpos (z : Z) (x : ℝ) : 0 < G (f z x, p z x) := by |
| 123 | rw [hGvalue] |
| 124 | exact (F.metric tau).pos _ _ (himm z x) |
| 125 | have hvvalue (z : Z) (x : ℝ) : v z x = Real.sqrt (G (f z x, p z x)) := by |
| 126 | rw [hGvalue] |
| 127 | rfl |
| 128 | have hvpos (z : Z) (x : ℝ) : 0 < v z x := by |
| 129 | rw [hvvalue] |
| 130 | exact Real.sqrt_pos.mpr (hGpos z x) |
| 131 | let input : Z × ℝ → W × W := fun z => (f z.1 z.2, p z.1 z.2) |
| 132 | have hinput : Continuous input := hzero.prodMk hfirst |
| 133 | have hmem (z : Z × ℝ) : input z ∈ O := ⟨heU (mem_range_self _), mem_univ _⟩ |
| 134 | have hvc : Continuous (fun z : Z × ℝ => v z.1 z.2) := |
| 135 | (Real.continuous_sqrt.comp (hG.continuousOn.comp_continuous |
| 136 | (f := input) hinput hmem)).congr (fun z => (hvvalue z.1 z.2).symm) |
| 137 | have hDG : ContinuousOn (fderiv ℝ G) O := |
| 138 | hG.continuousOn_fderiv_of_isOpen hO (by simp) |
| 139 | let direction : Z × ℝ → W × W := fun z => (p z.1 z.2, r z.1 z.2) |
| 140 | have hdir : Continuous direction := hfirst.prodMk hsecond |
| 141 | let v1 : Z → ℝ → ℝ := fun z x => |
| 142 | fderiv ℝ G (f z x, p z x) (p z x, r z x) / (2 * v z x) |
| 143 | have hv1c : Continuous (fun z : Z × ℝ => v1 z.1 z.2) := |
| 144 | ((hDG.comp_continuous (f := input) hinput hmem).clm_apply hdir).div |
| 145 | (continuous_const.mul hvc) (fun z => mul_ne_zero (by norm_num) (hvpos z.1 z.2).ne') |
| 146 | have hvder (z : Z) (x : ℝ) : HasDerivAt (v z) (v1 z x) x := by |
| 147 | have hd := ((hG.contDiffAt (hO.mem_nhds (hmem (z, x)))).differentiableAt |
| 148 | (by simp)).hasFDerivAt.comp_hasDerivAt x ((hfd z x).prodMk (hpd z x)) |
| 149 | have hs : HasDerivAt (v z) |
| 150 | (fderiv ℝ G (f z x, p z x) (p z x, r z x) / |
| 151 | (2 * Real.sqrt (G (f z x, p z x)))) x := |
| 152 | (hd.sqrt (hGpos z x).ne').congr_of_eventuallyEq |
| 153 | (Eventually.of_forall (hvvalue z)) |
| 154 | simpa only [v1, hvvalue z x] using hs |
| 155 | have hfper (z : Z) : Function.Periodic (f z) L0 := |
| 156 | fun x => congrArg e (hperiod z x) |
| 157 | have hpper (z : Z) : Function.Periodic (p z) L0 := |
| 158 | (hfper z).deriv_of_differentiable ((hf z).differentiable (by norm_num)) |
| 159 | have hvper (z : Z) : Function.Periodic (v z) L0 := by |
| 160 | intro x |
| 161 | rw [hvvalue z (x + L0), hvvalue z x, hfper z x, hpper z x] |
| 162 | have hv1per (z : Z) : Function.Periodic (v1 z) L0 := by |
| 163 | have hd := (hvper z).deriv_of_differentiable (fun x => (hvder z x).differentiableAt) |
| 164 | have heq : deriv (v z) = v1 z := funext fun x => (hvder z x).deriv |
| 165 | rwa [heq] at hd |
| 166 | have descend (w : Z → ℝ → ℝ) (hw : Continuous (fun z : Z × ℝ => w z.1 z.2)) |
| 167 | (hp : ∀ z, Function.Periodic (w z) L0) : |
| 168 | ∃ V : Z → C(AddCircle L0, ℝ), Continuous V ∧ |
| 169 | ∀ z (x : ℝ), V z (x : AddCircle L0) = w z x := by |
| 170 | let V : Z → C(AddCircle L0, ℝ) := fun z => ⟨(hp z).lift, |
| 171 | (QuotientAddGroup.isQuotientMap_mk (AddSubgroup.zmultiples L0)).continuous_iff.mpr |
| 172 | (hw.comp (continuous_const.prodMk continuous_id))⟩ |
| 173 | have hrep (z : Z) (x : ℝ) : V z (x : AddCircle L0) = w z x := by |
| 174 | change (hp z).lift (x : AddCircle L0) = w z x |
| 175 | exact Function.Periodic.lift_coe _ x |
| 176 | refine ⟨V, ?_, hrep⟩ |
| 177 | apply ContinuousMap.continuous_of_continuous_uncurry |
| 178 | have hquot : IsOpenQuotientMap (fun z : Z × ℝ => (z.1, (z.2 : AddCircle L0))) := |
| 179 | IsOpenQuotientMap.id.prodMap QuotientAddGroup.isOpenQuotientMap_mk |
| 180 | apply hquot.continuous_comp_iff.mp |
| 181 | simpa only [Function.comp_def, Function.uncurry, hrep] using hw |
| 182 | obtain ⟨V, hV, hVrep⟩ := descend v hvc hvper |
| 183 | obtain ⟨V1, hV1, hV1rep⟩ := descend v1 hv1c hv1per |
| 184 | have hVder (z : Z) (x : ℝ) : HasDerivAt |
| 185 | (fun y : ℝ => V z (y : AddCircle L0)) (V1 z (x : AddCircle L0)) x := by |
| 186 | simpa only [hVrep, hV1rep] using hvder z x |
| 187 | have hVpos (z : Z) (x : ℝ) : 0 < V z (x : AddCircle L0) := by |
| 188 | rw [hVrep] |
| 189 | exact hvpos z x |
| 190 | have harclength := exists_continuous_C2_arclength_family V V1 hV hV1 hVder hVpos |
| 191 | dsimp only at harclength |
| 192 | simp only [hVrep, hV1rep] at harclength |
| 193 | obtain ⟨hmpos, hmc, phi, hphi, hphic, hphidc, hphiddc, hpsic, hpsidc, hpsiddc⟩ := harclength |
| 194 | let psi : Z → ℝ → ℝ := fun z => (phi z).symm |
| 195 | let q : Z → ℝ → W := fun z x => f z (psi z x) |
| 196 | have hpsi (z : Z) : ContDiff ℝ 2 (psi z) := (hphi z).2.2.1 |
| 197 | have hpsipos (z : Z) (x : ℝ) : 0 < deriv (psi z) x := by |
| 198 | obtain ⟨_, _, _, _, _, _, _, _, _, _, hp⟩ := hphi z |
| 199 | exact (hp x).2 |
| 200 | have hpsider (z : Z) (x : ℝ) : HasDerivAt (psi z) (deriv (psi z) x) x := |
| 201 | ((hpsi z).differentiable (by norm_num) x).hasDerivAt |
| 202 | have hpsiSecond (z : Z) (x : ℝ) : |
| 203 | HasDerivAt (deriv (psi z)) (deriv (deriv (psi z)) x) x := |
| 204 | (((hpsi z).deriv' (n := 1)).differentiable (by norm_num) x).hasDerivAt |
| 205 | have hqfirst (z : Z) (x : ℝ) : deriv (q z) x = deriv (psi z) x • p z (psi z x) := by |
| 206 | exact ((hfd z (psi z x)).scomp x (hpsider z x)).deriv |
| 207 | have hqsecond (z : Z) (x : ℝ) : deriv (deriv (q z)) x = |
| 208 | deriv (psi z) x ^ 2 • r z (psi z x) + |
| 209 | deriv (deriv (psi z)) x • p z (psi z x) := by |
| 210 | have heq : deriv (q z) = fun y => deriv (psi z) y • p z (psi z y) := |
| 211 | funext (hqfirst z) |
| 212 | rw [heq] |
| 213 | have hd := (hpsiSecond z x).fun_smul ((hpd z (psi z x)).scomp x (hpsider z x)) |
| 214 | simpa only [Function.comp_def, smul_smul, ← pow_two] using hd.deriv |
| 215 | have hmap : Continuous (fun z : Z × ℝ => (z.1, psi z.1 z.2)) := |
| 216 | continuous_fst.prodMk hpsic |
| 217 | have hq0 : Continuous (fun z : Z × ℝ => q z.1 z.2) := hzero.comp hmap |
| 218 | have hq1 : Continuous (fun z : Z × ℝ => deriv (q z.1) z.2) := |
| 219 | (hpsidc.smul (hfirst.comp hmap)).congr (fun z => (hqfirst z.1 z.2).symm) |
| 220 | have hq2 : Continuous (fun z : Z × ℝ => deriv (deriv (q z.1)) z.2) := |
| 221 | (((hpsidc.pow 2).smul (hsecond.comp hmap)).add |
| 222 | (hpsiddc.smul (hfirst.comp hmap))).congr (fun z => (hqsecond z.1 z.2).symm) |
| 223 | refine ⟨hmpos, hmc, phi, ?_, hphic, hphidc, hphiddc, hpsic, hpsidc, hpsiddc, |
| 224 | ?_, hq0, hq1, hq2⟩ |
| 225 | · intro z |
| 226 | obtain ⟨hform, hpc, hpic, hpzero, hshift, hishift, _, _, _, _, hpos⟩ := hphi z |
| 227 | exact ⟨hform, hpc, hpic, hpzero, hshift, hishift, hpos⟩ |
| 228 | · intro z |
| 229 | obtain ⟨_, _, _, _, _, hshift, _, _, hinvd, _, _⟩ := hphi z |
| 230 | refine ⟨?_, (hC2 z).comp (hpsi z).contMDiff, ?_, ?_, ?_⟩ |
| 231 | · intro x |
| 232 | change gamma z ((phi z).symm (x + L0)) = gamma z ((phi z).symm x) |
| 233 | rw [hshift, hperiod z] |
| 234 | · intro x |
| 235 | rw [curveVelocity_comp ((hC2 z).mdifferentiable (by norm_num) (psi z x)) |
| 236 | (hpsider z x)] |
| 237 | exact smul_ne_zero (hpsipos z x).ne' (himm z (psi z x)) |
| 238 | · intro x |
| 239 | have hd : HasDerivAt (psi z) (m z / v z (psi z x)) x := hinvd x |
| 240 | have hpos : 0 < m z / v z (psi z x) := div_pos (hmpos z) (hvpos z _) |
| 241 | have hs := curveSpeed_comp F (fun y _ => gamma z y) (t := tau) |
| 242 | ((hC2 z).mdifferentiable (by norm_num) (psi z x)) hd hpos.le |
| 243 | change curveSpeed F (fun y _ => gamma z (psi z y)) tau x = _ |
| 244 | rw [hs] |
| 245 | change m z / v z (psi z x) * v z (psi z x) = m z |
| 246 | exact div_mul_cancel₀ _ (hvpos z _).ne' |
| 247 | · intro x |
| 248 | rw [(phi z).symm_apply_apply] |
| 249 | |
| 250 | end PoincareMT.M63 |