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.Periodic.ArclengthEstimates |
| 2 | import PoincareLib.Geometry.CurveShortening.Ramp.Analysis.Periodic.FirstJetComposition |
| 3 | import PoincareLib.Geometry.CurveShortening.Ramp.Analysis.Periodic.C2RelabelingStability |
| 4 | import PoincareLib.Geometry.CurveShortening.Ramp.Analysis.Smooth.RetractionDifferentials |
| 5 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.Pullback.MetricHessian |
| 6 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.Smooth.UnitSpeedParameter |
| 7 | |
| 8 | /-! |
| 9 | # Smooth constant-speed approximation on one physical period |
| 10 | |
| 11 | Actual retraction approximation and witnessed arclength stability keep |
| 12 | the same period while approximating every C2 jet. MT2007 Claim 19.1, |
| 13 | p. 437 and Lemma 19.6, pp. 441-442; |
| 14 | `2026-09-22-fixed-period-initial-approximation.md`. |
| 15 | -/ |
| 16 | |
| 17 | set_option autoImplicit false |
| 18 | set_option backward.isDefEq.respectTransparency false |
| 19 | |
| 20 | open Set |
| 21 | open scoped Manifold ContDiff |
| 22 | |
| 23 | universe u v |
| 24 | |
| 25 | namespace PoincareMT.M63 |
| 26 | |
| 27 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 28 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 29 | {ι : Type v} [Fintype ι] {a b : ℝ} |
| 30 | |
| 31 | local notation "W" => EuclideanSpace ℝ ι |
| 32 | |
| 33 | /-- An embedded unit-speed C2 curve has smooth immersed constant-speed |
| 34 | approximants in all three actual C2 jets, retaining its physical period. |
| 35 | MT2007 Claim 19.1, p. 437; fixed-period initial approximation derivation. -/ |
| 36 | theorem exists_smooth_constantSpeed_fixedPeriod_C2_approximation |
| 37 | (F : RicciFlow n M (Icc a b)) {e : M → W} |
| 38 | (he : ContMDiff (𝓡 n) 𝓘(ℝ, W) ∞ e) {U : Set W} (hU : IsOpen U) |
| 39 | (heU : range e ⊆ U) {ρ : W → M} |
| 40 | (hρ : ContMDiffOn 𝓘(ℝ, W) (𝓡 n) ∞ ρ U) (hρe : ∀ p, ρ (e p) = p) |
| 41 | {t : ℝ} (ht : t ∈ Icc a b) {L : ℝ} (hL : 0 < L) {γ : ℝ → M} |
| 42 | (hγp : Function.Periodic γ L) (hγ : ContMDiff 𝓘(ℝ, ℝ) (𝓡 n) 2 γ) |
| 43 | (himm : ∀ x, curveVelocity (n := n) γ x ≠ 0) |
| 44 | (hunit : ∀ x, curveSpeed F (fun y _ => γ y) t x = 1) |
| 45 | {eps : ℝ} (heps : 0 < eps) : |
| 46 | let c := fun x => e (γ x) |
| 47 | ∃ r : ℝ → W, ∃ m : ℝ, 0 < m ∧ |m - 1| < eps ∧ |
| 48 | ContDiff ℝ ∞ r ∧ Function.Periodic r L ∧ |
| 49 | (∀ x, r x ∈ U ∧ e (ρ (r x)) = r x) ∧ |
| 50 | (∀ x, mfderiv 𝓘(ℝ, W) (𝓡 n) ρ (r x) (deriv r x) ≠ 0) ∧ |
| 51 | (∀ x, curveSpeed F (fun y _ => ρ (r y)) t x = m) ∧ |
| 52 | ∀ x, ‖r x - c x‖ < eps ∧ ‖deriv r x - deriv c x‖ < eps ∧ |
| 53 | ‖deriv (deriv r) x - deriv (deriv c) x‖ < eps := by |
| 54 | let c := fun x => e (γ x) |
| 55 | have hc : ContDiff ℝ 2 c := |
| 56 | ((he.of_le (ENat.natCast_le_of_coe_top_le_withTop le_rfl 2)).comp hγ).contDiff |
| 57 | have hcp : Function.Periodic c L := hγp.comp e |
| 58 | have hcU (x : ℝ) : c x ∈ U := heU (mem_range_self (γ x)) |
| 59 | have hP : ContDiffOn ℝ ∞ (e ∘ ρ) U := |
| 60 | (smooth_retraction_differentials he hU heU hρ hρe).1 |
| 61 | have hPU : MapsTo (e ∘ ρ) U U := fun z _ => heU (mem_range_self (ρ z)) |
| 62 | have hPP (z : W) (_hz : z ∈ U) : (e ∘ ρ) ((e ∘ ρ) z) = (e ∘ ρ) z := by |
| 63 | simp only [Function.comp_apply, hρe] |
| 64 | have hfix (x : ℝ) : (e ∘ ρ) (c x) = c x := by simp only [Function.comp_apply, c, hρe] |
| 65 | have hvel (d : ℝ → W) (hd : ContDiff ℝ 1 d) (hdU : ∀ x, d x ∈ U) (x : ℝ) : |
| 66 | curveVelocity (n := n) (fun y => ρ (d y)) x = |
| 67 | mfderiv 𝓘(ℝ, W) (𝓡 n) ρ (d x) (deriv d x) := by |
| 68 | change (mfderiv 𝓘(ℝ, ℝ) (𝓡 n) (ρ ∘ d) x) 1 = _ |
| 69 | erw [mfderiv_comp x |
| 70 | ((hρ.contMDiffAt (hU.mem_nhds (hdU x))).mdifferentiableAt (by simp)) |
| 71 | ((hd.contMDiff x).mdifferentiableAt (by norm_num)), |
| 72 | ContinuousLinearMap.comp_apply, mfderiv_eq_fderiv] |
| 73 | rfl |
| 74 | have hcvel (x : ℝ) : mfderiv 𝓘(ℝ, W) (𝓡 n) ρ (c x) (deriv c x) = |
| 75 | curveVelocity (n := n) γ x := by |
| 76 | rw [← hvel c (hc.of_le (by norm_num)) hcU x] |
| 77 | have hid : (fun y => ρ (c y)) = γ := funext fun y => hρe (γ y) |
| 78 | rw [hid] |
| 79 | let Q : W × W → ℝ := fun z => (F.metric t).inner (ρ z.1) |
| 80 | (mfderiv 𝓘(ℝ, W) (𝓡 n) ρ z.1 z.2) (mfderiv 𝓘(ℝ, W) (𝓡 n) ρ z.1 z.2) |
| 81 | have hQ : ContDiffOn ℝ ∞ Q (U ×ˢ univ) := |
| 82 | (flow_pullback_metric_hessian_contDiffOn F hU hρ |
| 83 | (f := fun _ => (0 : ℝ)) contMDiff_const).1.comp |
| 84 | ((contDiffOn_const.prodMk contDiffOn_fst).prodMk contDiffOn_snd) |
| 85 | (fun _ hz => ⟨⟨ht, hz.1⟩, mem_univ _⟩) |
| 86 | let O := (U ×ˢ (univ : Set W)) ∩ Q ⁻¹' Ioi 0 |
| 87 | have hO : IsOpen O := hQ.continuousOn.isOpen_inter_preimage |
| 88 | (hU.prod isOpen_univ) isOpen_Ioi |
| 89 | let σ := fun z => Real.sqrt (Q z) |
| 90 | have hσ : ContDiffOn ℝ ∞ σ O := |
| 91 | (hQ.mono inter_subset_left).sqrt (fun _ hz => hz.2.ne') |
| 92 | have hcO (x : ℝ) : (c x, deriv c x) ∈ O := by |
| 93 | refine ⟨⟨hcU x, mem_univ _⟩, ?_⟩ |
| 94 | change 0 < (F.metric t).inner (ρ (c x)) |
| 95 | (mfderiv 𝓘(ℝ, W) (𝓡 n) ρ (c x) (deriv c x)) |
| 96 | (mfderiv 𝓘(ℝ, W) (𝓡 n) ρ (c x) (deriv c x)) |
| 97 | rw [hcvel x] |
| 98 | change 0 < (F.metric t).inner (ρ (e (γ x))) (curveVelocity γ x) (curveVelocity γ x) |
| 99 | rw [hρe] |
| 100 | exact (F.metric t).pos _ _ (himm x) |
| 101 | have hσc : (fun x => σ (c x, deriv c x)) = fun _ => (1 : ℝ) := by |
| 102 | funext x |
| 103 | change Real.sqrt ((F.metric t).inner (ρ (c x)) |
| 104 | (mfderiv 𝓘(ℝ, W) (𝓡 n) ρ (c x) (deriv c x)) |
| 105 | (mfderiv 𝓘(ℝ, W) (𝓡 n) ρ (c x) (deriv c x))) = 1 |
| 106 | rw [hcvel x] |
| 107 | change Real.sqrt ((F.metric t).inner (ρ (e (γ x))) |
| 108 | (curveVelocity γ x) (curveVelocity γ x)) = 1 |
| 109 | rw [hρe] |
| 110 | exact hunit x |
| 111 | obtain ⟨δ, hδ, hrelabel⟩ := exists_periodic_C2_relabeling_tolerance hL hc hcp heps |
| 112 | have hden : 0 < 4 * L + 23 := by positivity |
| 113 | let η := min (1 / 2) (min eps (δ / (4 * L + 23))) / 2 |
| 114 | have hmin : 0 < min (1 / 2) (min eps (δ / (4 * L + 23))) := |
| 115 | lt_min (by norm_num) (lt_min heps (div_pos hδ hden)) |
| 116 | have hη : 0 < η := half_pos hmin |
| 117 | have hηmin : η < min (1 / 2) (min eps (δ / (4 * L + 23))) := half_lt_self hmin |
| 118 | have hηhalf : η < 1 / 2 := hηmin.trans_le (min_le_left _ _) |
| 119 | have hηeps : η < eps := hηmin.trans_le ((min_le_right _ _).trans (min_le_left _ _)) |
| 120 | have hηprod : η * (4 * L + 23) < δ := (lt_div_iff₀ hden).mp |
| 121 | (hηmin.trans_le ((min_le_right _ _).trans (min_le_right _ _))) |
| 122 | have hηL : 4 * L * η < δ := by nlinarith only [hηprod, hη] |
| 123 | have hη4 : 4 * η < δ := by nlinarith only [hηprod, hη, mul_pos hL hη] |
| 124 | have hη18 : 18 * η < δ := by nlinarith only [hηprod, hη, mul_pos hL hη] |
| 125 | obtain ⟨θ, hθ, hspeednear⟩ := exists_periodic_C2_tolerance_for_firstJet_composition |
| 126 | hO (hσ.of_le (by simp)) hL hc hcp hcO hη |
| 127 | let tol := min (δ / 2) (θ / 2) |
| 128 | have htol : 0 < tol := lt_min (half_pos hδ) (half_pos hθ) |
| 129 | have htδ : tol < δ := (min_le_left _ _).trans_lt (half_lt_self hδ) |
| 130 | have htθ : tol < θ := (min_le_right _ _).trans_lt (half_lt_self hθ) |
| 131 | obtain ⟨h, hh, hhp, hhfix, happ⟩ := exists_periodic_smooth_fixed_C2_approximation |
| 132 | hU hP hPU hPP hL hc hcp (by rintro _ ⟨x, rfl⟩; exact hcU x) hfix htol |
| 133 | have hh2 : ContDiff ℝ 2 h := hh.of_le (ENat.natCast_le_of_coe_top_le_withTop le_rfl 2) |
| 134 | have happδ (x : ℝ) : ‖h x - c x‖ < δ ∧ ‖deriv h x - deriv c x‖ < δ ∧ |
| 135 | ‖deriv (deriv h) x - deriv (deriv c) x‖ < δ := |
| 136 | ⟨(happ x).1.trans htδ, (happ x).2.1.trans htδ, (happ x).2.2.trans htδ⟩ |
| 137 | obtain ⟨hhO, _hσh, hσnear⟩ := hspeednear h hh2 hhp (fun x => |
| 138 | ⟨(happ x).1.trans htθ, (happ x).2.1.trans htθ, (happ x).2.2.trans htθ⟩) |
| 139 | have hhguard (x : ℝ) : mfderiv 𝓘(ℝ, W) (𝓡 n) ρ (h x) (deriv h x) ≠ 0 := by |
| 140 | intro hz |
| 141 | have hqpos := (hhO x).2 |
| 142 | change 0 < (F.metric t).inner (ρ (h x)) |
| 143 | (mfderiv 𝓘(ℝ, W) (𝓡 n) ρ (h x) (deriv h x)) |
| 144 | (mfderiv 𝓘(ℝ, W) (𝓡 n) ρ (h x) (deriv h x)) at hqpos |
| 145 | simp only [hz, map_zero] at hqpos |
| 146 | exact lt_irrefl 0 hqpos |
| 147 | have hγh : ContMDiff 𝓘(ℝ, ℝ) (𝓡 n) ∞ (fun x => ρ (h x)) := |
| 148 | hρ.comp_contMDiff hh.contMDiff (fun x => (hhfix x).1) |
| 149 | have hhv (x : ℝ) : curveVelocity (n := n) (fun y => ρ (h y)) x = |
| 150 | mfderiv 𝓘(ℝ, W) (𝓡 n) ρ (h x) (deriv h x) := |
| 151 | hvel h (hh.of_le (by simp)) (fun y => (hhfix y).1) x |
| 152 | have hγhimm (x : ℝ) : curveVelocity (n := n) (fun y => ρ (h y)) x ≠ 0 := by |
| 153 | rw [hhv] |
| 154 | exact hhguard x |
| 155 | let v := curveSpeed F (fun y _ => ρ (h y)) t |
| 156 | have hv : ContDiff ℝ ∞ v := speed_contDiff_of_smooth F (fun y _ => ρ (h y)) hγh hγhimm |
| 157 | have hvpos (x : ℝ) : 0 < v x := Real.sqrt_pos.mpr ((F.metric t).pos _ _ (hγhimm x)) |
| 158 | have hvσ : v = fun x => σ (h x, deriv h x) := by |
| 159 | funext x |
| 160 | change Real.sqrt ((F.metric t).inner (ρ (h x)) |
| 161 | (curveVelocity (fun y => ρ (h y)) x) (curveVelocity (fun y => ρ (h y)) x)) = _ |
| 162 | rw [hhv] |
| 163 | have hvp : Function.Periodic v L := by |
| 164 | rw [hvσ] |
| 165 | have hdp := hhp.deriv_of_differentiable (hh.differentiable (by simp)) |
| 166 | intro x |
| 167 | change σ (h (x + L), deriv h (x + L)) = σ (h x, deriv h x) |
| 168 | rw [hhp x, hdp x] |
| 169 | have hvnear (x : ℝ) : |v x - 1| < η ∧ |deriv v x| < η := by |
| 170 | have hnear := hσnear x |
| 171 | change |(fun y => σ (h y, deriv h y)) x - (fun y => σ (c y, deriv c y)) x| < η ∧ |
| 172 | |deriv (fun y => σ (h y, deriv h y)) x - |
| 173 | deriv (fun y => σ (c y, deriv c y)) x| < η at hnear |
| 174 | rw [← hvσ, hσc] at hnear |
| 175 | simpa only [deriv_const, sub_zero] using hnear |
| 176 | let m := (∫ x in (0 : ℝ)..L, v x) / L |
| 177 | obtain ⟨hell, hmnear, phi, _hformula, _hphi, hψ, _hzero, _hshift, hψshift, |
| 178 | _hd, _hdd, hψd, _hψdd, _hpositive, _hdispl, _hfirst, _hsecond, |
| 179 | hψdispl, hψfirst, hψsecond⟩ := |
| 180 | exists_smooth_periodic_arclength_homeomorph_estimates hL hv hvp hvpos |
| 181 | hη.le hηhalf.le (fun x => (hvnear x).1.le) (fun x => (hvnear x).2.le) |
| 182 | have hmpos : 0 < m := div_pos hell hL |
| 183 | let r := fun x => h (phi.symm x) |
| 184 | obtain ⟨_hr2, hrp, herrors⟩ := hrelabel h hh2 hhp phi.symm |
| 185 | (hψ.of_le (ENat.natCast_le_of_coe_top_le_withTop le_rfl 2)) hψshift happδ |
| 186 | (fun x => ⟨(hψdispl x).trans_lt hηL, (hψfirst x).trans_lt hη4, |
| 187 | (hψsecond x).trans_lt hη18⟩) |
| 188 | have hrderiv (x : ℝ) : deriv r x = (m / v (phi.symm x)) • deriv h (phi.symm x) := |
| 189 | ((hh.differentiable (by simp) (phi.symm x)).hasDerivAt.scomp x (hψd x)).deriv |
| 190 | refine ⟨r, m, hmpos, hmnear.trans_lt hηeps, hh.comp hψ, hrp, |
| 191 | fun x => hhfix (phi.symm x), ?_, ?_, herrors⟩ |
| 192 | · intro x |
| 193 | change mfderiv 𝓘(ℝ, W) (𝓡 n) ρ (h (phi.symm x)) (deriv r x) ≠ 0 |
| 194 | rw [hrderiv x, map_smul] |
| 195 | exact smul_ne_zero (div_pos hmpos (hvpos _)).ne' (hhguard _) |
| 196 | · intro x |
| 197 | calc |
| 198 | curveSpeed F (fun y _ => ρ (r y)) t x = (m / v (phi.symm x)) * v (phi.symm x) := |
| 199 | curveSpeed_comp F (fun y _ => ρ (h y)) |
| 200 | (hγh.mdifferentiable (by simp) _) (hψd x) (div_pos hmpos (hvpos _)).le |
| 201 | _ = m := div_mul_cancel₀ _ (hvpos _).ne' |
| 202 | |
| 203 | end PoincareMT.M63 |