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.LocalFlow.Fixed.PeriodInitialApproximation |
| 2 | import PoincareLib.Geometry.CurveShortening.Ramp.CurveEstimates.Relabeling.Geometry |
| 3 | |
| 4 | /-! |
| 5 | # Positive constant-speed C2 approximation |
| 6 | |
| 7 | Rescale to the actual unit-speed parameter, apply smooth approximation, |
| 8 | and restore the original period and all three jets. MT2007 Claim 19.1, |
| 9 | p. 437 and Lemma 19.6, pp. 441-442; |
| 10 | `2026-09-22-constant-speed-c2-approximation.md`. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open Set |
| 16 | open scoped Manifold ContDiff |
| 17 | |
| 18 | universe u v |
| 19 | |
| 20 | namespace PoincareMT.M63 |
| 21 | |
| 22 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 23 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 24 | {ι : Type v} [Fintype ι] {a b : ℝ} |
| 25 | |
| 26 | local notation "W" => EuclideanSpace ℝ ι |
| 27 | |
| 28 | /-- Positive constant-speed C2 data admit smooth constant-speed |
| 29 | approximants on the same period, in all three actual embedded jets. |
| 30 | MT2007 Claim 19.1, p. 437; constant-speed approximation derivation. -/ |
| 31 | theorem exists_smooth_positive_constantSpeed_C2_approximation |
| 32 | (F : RicciFlow n M (Icc a b)) {e : M → W} |
| 33 | (he : ContMDiff (𝓡 n) 𝓘(ℝ, W) ∞ e) {U : Set W} (hU : IsOpen U) |
| 34 | (heU : range e ⊆ U) {ρ : W → M} |
| 35 | (hρ : ContMDiffOn 𝓘(ℝ, W) (𝓡 n) ∞ ρ U) (hρe : ∀ p, ρ (e p) = p) |
| 36 | {t : ℝ} (ht : t ∈ Icc a b) {L0 : ℝ} (hL0 : 0 < L0) |
| 37 | {γ : ℝ → M} (hγp : Function.Periodic γ L0) |
| 38 | (hγ : ContMDiff 𝓘(ℝ, ℝ) (𝓡 n) 2 γ) |
| 39 | (himm : ∀ x, curveVelocity (n := n) γ x ≠ 0) |
| 40 | {v0 : ℝ} (hv0 : 0 < v0) |
| 41 | (hspeed : ∀ x, curveSpeed F (fun y _ => γ y) t x = v0) |
| 42 | {eps : ℝ} (heps : 0 < eps) : |
| 43 | let c := fun x => e (γ x) |
| 44 | ∃ r : ℝ → W, ∃ m : ℝ, 0 < m ∧ |m - v0| < eps ∧ |
| 45 | ContDiff ℝ ∞ r ∧ Function.Periodic r L0 ∧ |
| 46 | (∀ x, r x ∈ U ∧ e (ρ (r x)) = r x) ∧ |
| 47 | (∀ x, mfderiv 𝓘(ℝ, W) (𝓡 n) ρ (r x) (deriv r x) ≠ 0) ∧ |
| 48 | (∀ x, curveSpeed F (fun y _ => ρ (r y)) t x = m) ∧ |
| 49 | ∀ x, ‖r x - c x‖ < eps ∧ ‖deriv r x - deriv c x‖ < eps ∧ |
| 50 | ‖deriv (deriv r) x - deriv (deriv c) x‖ < eps := by |
| 51 | let gamma := fun x : ℝ => γ (x / v0) |
| 52 | have hinv (x : ℝ) : HasDerivAt (fun y : ℝ => y / v0) (1 / v0) x := |
| 53 | (hasDerivAt_id x).div_const v0 |
| 54 | have hinvc : ContDiff ℝ 2 (fun x : ℝ => x / v0) := contDiff_id.div_const v0 |
| 55 | have hgamma : ContMDiff 𝓘(ℝ, ℝ) (𝓡 n) 2 gamma := hγ.comp hinvc.contMDiff |
| 56 | have hgammap : Function.Periodic gamma (v0 * L0) := by |
| 57 | intro x |
| 58 | change γ ((x + v0 * L0) / v0) = γ (x / v0) |
| 59 | have harg : (x + v0 * L0) / v0 = x / v0 + L0 := by |
| 60 | field_simp |
| 61 | rw [harg] |
| 62 | exact hγp (x / v0) |
| 63 | have hgammav (x : ℝ) : curveVelocity (n := n) gamma x = |
| 64 | (1 / v0) • curveVelocity (n := n) γ (x / v0) := |
| 65 | curveVelocity_comp (hγ.mdifferentiable (by norm_num) _) (hinv x) |
| 66 | have hgammaimm (x : ℝ) : curveVelocity (n := n) gamma x ≠ 0 := by |
| 67 | rw [hgammav] |
| 68 | exact smul_ne_zero (one_div_pos.mpr hv0).ne' (himm _) |
| 69 | have hunit (x : ℝ) : curveSpeed F (fun y _ => gamma y) t x = 1 := by |
| 70 | change curveSpeed F (fun y _ => γ (y / v0)) t x = 1 |
| 71 | rw [curveSpeed_comp F (fun y _ => γ y) |
| 72 | (hγ.mdifferentiable (by norm_num) _) (hinv x) (one_div_pos.mpr hv0).le, |
| 73 | hspeed] |
| 74 | exact one_div_mul_cancel hv0.ne' |
| 75 | let D := 1 + v0 + v0 ^ 2 |
| 76 | let delta := eps / D |
| 77 | have hD : 0 < D := by dsimp only [D]; positivity |
| 78 | have hdelta : 0 < delta := div_pos heps hD |
| 79 | have hDdelta : D * delta = eps := mul_div_cancel₀ _ hD.ne' |
| 80 | have hsmall (z : ℝ) (hz : z < D) : z * delta < eps := |
| 81 | (mul_lt_mul_of_pos_right hz hdelta).trans_eq hDdelta |
| 82 | have hsmall0 : delta < eps := by |
| 83 | simpa only [one_mul] using |
| 84 | hsmall 1 (by dsimp only [D]; nlinarith only [hv0, sq_nonneg v0]) |
| 85 | have hsmall1 : v0 * delta < eps := |
| 86 | hsmall v0 (by dsimp only [D]; nlinarith only [sq_nonneg v0]) |
| 87 | have hsmall2 : v0 ^ 2 * delta < eps := |
| 88 | hsmall (v0 ^ 2) (by dsimp only [D]; linarith only [hv0]) |
| 89 | obtain ⟨rhat, mhat, hmhat, hmsmall, hrhat, hrhatp, hrhatfix, |
| 90 | hrhatimm, hrhatspeed, hnear⟩ := |
| 91 | exists_smooth_constantSpeed_fixedPeriod_C2_approximation F he hU heU hρ hρe ht |
| 92 | (mul_pos hv0 hL0) hgammap hgamma hgammaimm hunit hdelta |
| 93 | let chat := fun x => e (gamma x) |
| 94 | let c := fun x => e (γ x) |
| 95 | let r := fun x => rhat (v0 * x) |
| 96 | let m := v0 * mhat |
| 97 | have hchat : ContDiff ℝ 2 chat := |
| 98 | ((he.of_le (ENat.natCast_le_of_coe_top_le_withTop le_rfl 2)).comp hgamma).contDiff |
| 99 | have hlin (x : ℝ) : HasDerivAt (fun y : ℝ => v0 * y) v0 x := by |
| 100 | simpa only [id_eq, mul_one] using (hasDerivAt_id x).const_mul v0 |
| 101 | have hscaled (f : ℝ → W) (hf : ContDiff ℝ 2 f) : |
| 102 | (∀ x, deriv (fun y => f (v0 * y)) x = v0 • deriv f (v0 * x)) ∧ |
| 103 | ∀ x, deriv (deriv (fun y => f (v0 * y))) x = |
| 104 | v0 ^ 2 • deriv (deriv f) (v0 * x) := by |
| 105 | have hfirst (x : ℝ) : deriv (fun y => f (v0 * y)) x = |
| 106 | v0 • deriv f (v0 * x) := |
| 107 | ((hf.differentiable (by norm_num) _).hasDerivAt.scomp x (hlin x)).deriv |
| 108 | refine ⟨hfirst, ?_⟩ |
| 109 | have heq : deriv (fun y => f (v0 * y)) = fun x => v0 • deriv f (v0 * x) := |
| 110 | funext hfirst |
| 111 | intro x |
| 112 | rw [heq] |
| 113 | have hd := ((hf.differentiable_deriv_two _).hasDerivAt.scomp x (hlin x)).fun_const_smul v0 |
| 114 | simpa only [Function.comp_def, smul_smul, pow_two] using hd.deriv |
| 115 | have hcc : c = fun x => chat (v0 * x) := by |
| 116 | funext x |
| 117 | dsimp only [c, chat, gamma] |
| 118 | rw [mul_div_cancel_left₀ x hv0.ne'] |
| 119 | have hrjets := hscaled rhat |
| 120 | (hrhat.of_le (ENat.natCast_le_of_coe_top_le_withTop le_rfl 2)) |
| 121 | have hcjets := hscaled chat hchat |
| 122 | have hr1 (x : ℝ) : deriv r x = v0 • deriv rhat (v0 * x) := hrjets.1 x |
| 123 | have hr2 (x : ℝ) : deriv (deriv r) x = |
| 124 | v0 ^ 2 • deriv (deriv rhat) (v0 * x) := hrjets.2 x |
| 125 | have hc1 (x : ℝ) : deriv c x = v0 • deriv chat (v0 * x) := by |
| 126 | rw [hcc] |
| 127 | exact hcjets.1 x |
| 128 | have hc2 (x : ℝ) : deriv (deriv c) x = |
| 129 | v0 ^ 2 • deriv (deriv chat) (v0 * x) := by |
| 130 | rw [hcc] |
| 131 | exact hcjets.2 x |
| 132 | have hmspeed : |m - v0| < eps := by |
| 133 | have heq : m - v0 = v0 * (mhat - 1) := by dsimp only [m]; ring |
| 134 | rw [heq, abs_mul, abs_of_pos hv0] |
| 135 | exact (mul_lt_mul_of_pos_left hmsmall hv0).trans hsmall1 |
| 136 | have hr : ContDiff ℝ ∞ r := hrhat.comp (contDiff_const.mul contDiff_id) |
| 137 | have hrp : Function.Periodic r L0 := by |
| 138 | intro x |
| 139 | change rhat (v0 * (x + L0)) = rhat (v0 * x) |
| 140 | rw [mul_add] |
| 141 | exact hrhatp (v0 * x) |
| 142 | have hproject : ContMDiff 𝓘(ℝ, ℝ) (𝓡 n) ∞ (fun y => ρ (rhat y)) := |
| 143 | hρ.comp_contMDiff hrhat.contMDiff (fun y => (hrhatfix y).1) |
| 144 | refine ⟨r, m, mul_pos hv0 hmhat, hmspeed, hr, hrp, |
| 145 | fun x => hrhatfix (v0 * x), ?_, ?_, ?_⟩ |
| 146 | · intro x |
| 147 | change mfderiv 𝓘(ℝ, W) (𝓡 n) ρ (rhat (v0 * x)) (deriv r x) ≠ 0 |
| 148 | erw [hr1, map_smul] |
| 149 | exact smul_ne_zero hv0.ne' (hrhatimm _) |
| 150 | · intro x |
| 151 | calc |
| 152 | curveSpeed F (fun y _ => ρ (r y)) t x = |
| 153 | v0 * curveSpeed F (fun y _ => ρ (rhat y)) t (v0 * x) := |
| 154 | curveSpeed_comp F (fun y _ => ρ (rhat y)) |
| 155 | (hproject.mdifferentiable (by simp) _) (hlin x) hv0.le |
| 156 | _ = m := by rw [hrhatspeed] |
| 157 | · intro x |
| 158 | change ‖r x - c x‖ < eps ∧ ‖deriv r x - deriv c x‖ < eps ∧ |
| 159 | ‖deriv (deriv r) x - deriv (deriv c) x‖ < eps |
| 160 | have hn := hnear (v0 * x) |
| 161 | change ‖rhat (v0 * x) - chat (v0 * x)‖ < delta ∧ |
| 162 | ‖deriv rhat (v0 * x) - deriv chat (v0 * x)‖ < delta ∧ |
| 163 | ‖deriv (deriv rhat) (v0 * x) - deriv (deriv chat) (v0 * x)‖ < delta at hn |
| 164 | refine ⟨?_, ?_, ?_⟩ |
| 165 | · change ‖rhat (v0 * x) - c x‖ < eps |
| 166 | rw [hcc] |
| 167 | exact hn.1.trans hsmall0 |
| 168 | · rw [hr1, hc1, ← smul_sub, norm_smul, Real.norm_eq_abs, abs_of_pos hv0] |
| 169 | exact (mul_lt_mul_of_pos_left hn.2.1 hv0).trans hsmall1 |
| 170 | · rw [hr2, hc2, ← smul_sub, norm_smul, Real.norm_eq_abs, |
| 171 | abs_of_nonneg (sq_nonneg v0)] |
| 172 | exact (mul_lt_mul_of_pos_left hn.2.2 (sq_pos_of_pos hv0)).trans hsmall2 |
| 173 | |
| 174 | end PoincareMT.M63 |