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.Splitting.MaximumPrinciple.Barrier.MovingBump |
| 2 | |
| 3 | /-! |
| 4 | # Actual first and second derivatives of the moving bump |
| 5 | |
| 6 | All formulas hold across the moving support boundary. The center path needs |
| 7 | only the indicated actual time derivative. Spatial differentiation uses the |
| 8 | same function and the ordinary Frechet derivative in the coordinate space. |
| 9 | -/ |
| 10 | |
| 11 | noncomputable section |
| 12 | open scoped InnerProductSpace ContDiff |
| 13 | |
| 14 | namespace PoincareMT.RicciFlow.Splitting.MaximumPrinciple.Barrier |
| 15 | |
| 16 | variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] |
| 17 | |
| 18 | /-- The actual first time derivative, expressed using the center velocity. -/ |
| 19 | def timeJet (rho C a : ℝ) (gamma : ℝ → E) (t : ℝ) (x velocity : E) : ℝ := |
| 20 | Real.exp (-C * (t - a)) * |
| 21 | (-C * expNegInvGlue (ballGap rho (gamma t) x) + |
| 22 | profileFirst (ballGap rho (gamma t) x) * (2 * ⟪x - gamma t, velocity⟫_ℝ)) |
| 23 | |
| 24 | /-- The first spatial derivative in direction `u`. -/ |
| 25 | def spaceJet (rho C a : ℝ) (gamma : ℝ → E) (t : ℝ) (x u : E) : ℝ := |
| 26 | Real.exp (-C * (t - a)) * |
| 27 | (profileFirst (ballGap rho (gamma t) x) * (-2 * ⟪x - gamma t, u⟫_ℝ)) |
| 28 | |
| 29 | /-- The mixed spatial derivative, with first direction `u` and second `w`. -/ |
| 30 | def secondSpaceJet (rho C a : ℝ) (gamma : ℝ → E) (t : ℝ) (x u w : E) : ℝ := |
| 31 | Real.exp (-C * (t - a)) * |
| 32 | (4 * profileSecond (ballGap rho (gamma t) x) * |
| 33 | ⟪x - gamma t, u⟫_ℝ * ⟪x - gamma t, w⟫_ℝ - |
| 34 | 2 * profileFirst (ballGap rho (gamma t) x) * ⟪w, u⟫_ℝ) |
| 35 | |
| 36 | /-- Differentiating the actual translated squared radius in time. -/ |
| 37 | theorem hasDerivAt_ballGap_time (rho : ℝ) {gamma : ℝ → E} |
| 38 | {t : ℝ} {velocity : E} (hg : HasDerivAt gamma velocity t) (x : E) : |
| 39 | HasDerivAt (fun s => ballGap rho (gamma s) x) |
| 40 | (2 * ⟪x - gamma t, velocity⟫_ℝ) t := by |
| 41 | have h := (hasDerivAt_const t (rho ^ 2)).sub |
| 42 | (((hasDerivAt_const t x).sub hg).norm_sq) |
| 43 | simpa [ballGap] using! h |
| 44 | |
| 45 | /-- The actual time derivative, including at the support boundary. -/ |
| 46 | theorem hasDerivAt_movingBump_time (rho C a : ℝ) {gamma : ℝ → E} |
| 47 | {t : ℝ} {velocity : E} (hg : HasDerivAt gamma velocity t) (x : E) : |
| 48 | HasDerivAt (fun s => movingBump rho C a gamma s x) |
| 49 | (timeJet rho C a gamma t x velocity) t := by |
| 50 | have he : HasDerivAt (fun s : ℝ => Real.exp (-C * (s - a))) |
| 51 | (-C * Real.exp (-C * (t - a))) t := by |
| 52 | simpa [mul_comm] using! (((hasDerivAt_id t).sub_const a).const_mul (-C)).exp |
| 53 | have hp := (hasDerivAt_profile (ballGap rho (gamma t) x)).comp t |
| 54 | (hasDerivAt_ballGap_time rho hg x) |
| 55 | convert! he.mul hp using 1 |
| 56 | dsimp [timeJet] |
| 57 | ring |
| 58 | |
| 59 | /-- First spatial differentiation along an actual differentiable coordinate curve. -/ |
| 60 | theorem hasDerivAt_movingBump_along (rho C a : ℝ) (gamma : ℝ → E) (t : ℝ) |
| 61 | {eta : ℝ → E} {r : ℝ} {u : E} (he : HasDerivAt eta u r) : |
| 62 | HasDerivAt (fun s => movingBump rho C a gamma t (eta s)) |
| 63 | (spaceJet rho C a gamma t (eta r) u) r := by |
| 64 | have hq : HasDerivAt (fun s => ballGap rho (gamma t) (eta s)) |
| 65 | (-2 * ⟪eta r - gamma t, u⟫_ℝ) r := by |
| 66 | simpa [ballGap] using! (hasDerivAt_const r (rho ^ 2)).sub |
| 67 | ((he.sub_const (gamma t)).norm_sq) |
| 68 | have hp := (hasDerivAt_profile (ballGap rho (gamma t) (eta r))).comp r hq |
| 69 | exact hp.const_mul (Real.exp (-C * (t - a))) |
| 70 | |
| 71 | /-- Mixed second spatial differentiation along a differentiable coordinate curve. -/ |
| 72 | theorem hasDerivAt_spaceJet_along (rho C a : ℝ) (gamma : ℝ → E) (t : ℝ) |
| 73 | (u : E) {eta : ℝ → E} {r : ℝ} {w : E} (he : HasDerivAt eta w r) : |
| 74 | HasDerivAt (fun s => spaceJet rho C a gamma t (eta s) u) |
| 75 | (secondSpaceJet rho C a gamma t (eta r) u w) r := by |
| 76 | have hq : HasDerivAt (fun s => ballGap rho (gamma t) (eta s)) |
| 77 | (-2 * ⟪eta r - gamma t, w⟫_ℝ) r := by |
| 78 | simpa [ballGap] using! (hasDerivAt_const r (rho ^ 2)).sub |
| 79 | ((he.sub_const (gamma t)).norm_sq) |
| 80 | have hp := (hasDerivAt_profileFirst (ballGap rho (gamma t) (eta r))).comp r hq |
| 81 | have hi := ((he.sub_const (gamma t)).inner ℝ (hasDerivAt_const r u)).const_mul (-2) |
| 82 | convert! (hp.mul hi).const_mul (Real.exp (-C * (t - a))) using 1 |
| 83 | simp only [secondSpaceJet, inner_zero_right, Function.comp_apply, zero_add] |
| 84 | ring |
| 85 | |
| 86 | /-- The first jet is the actual Frechet derivative in every direction. -/ |
| 87 | theorem fderiv_movingBump (rho C a : ℝ) (gamma : ℝ → E) (t : ℝ) (x u : E) : |
| 88 | fderiv ℝ (movingBump rho C a gamma t) x u = spaceJet rho C a gamma t x u := by |
| 89 | have hl : HasDerivAt (fun s : ℝ => x + s • u) u 0 := by |
| 90 | simpa only [Pi.add_apply, id_eq, zero_add, one_smul] using! |
| 91 | (hasDerivAt_const (0 : ℝ) x).add ((hasDerivAt_id (0 : ℝ)).smul_const u) |
| 92 | have hactual := (contDiff_movingBump_space rho C a gamma t).differentiable |
| 93 | (by simp) |>.differentiableAt (x := x) |>.hasFDerivAt |
| 94 | have hcompose := hactual.comp_hasDerivAt_of_eq (0 : ℝ) hl (by simp) |
| 95 | have hexplicit := hasDerivAt_movingBump_along rho C a gamma t hl |
| 96 | simpa using hcompose.unique hexplicit |
| 97 | |
| 98 | /-- Smoothness of the first jet in its base point. -/ |
| 99 | theorem contDiff_spaceJet (rho C a : ℝ) (gamma : ℝ → E) (t : ℝ) (u : E) : |
| 100 | ContDiff ℝ ∞ (fun x => spaceJet rho C a gamma t x u) := by |
| 101 | have heq : (fun x => spaceJet rho C a gamma t x u) = |
| 102 | fun x => fderiv ℝ (movingBump rho C a gamma t) x u := by |
| 103 | funext x |
| 104 | exact (fderiv_movingBump rho C a gamma t x u).symm |
| 105 | rw [heq] |
| 106 | exact ((contDiff_movingBump_space rho C a gamma t).fderiv_right |
| 107 | (by simp)).clm_apply contDiff_const |
| 108 | |
| 109 | /-- The second jet is the actual derivative of the first directional derivative. -/ |
| 110 | theorem fderiv_spaceJet (rho C a : ℝ) (gamma : ℝ → E) (t : ℝ) (x u w : E) : |
| 111 | fderiv ℝ (fun y => fderiv ℝ (movingBump rho C a gamma t) y u) x w = |
| 112 | secondSpaceJet rho C a gamma t x u w := by |
| 113 | simp_rw [fderiv_movingBump] |
| 114 | have hl : HasDerivAt (fun s : ℝ => x + s • w) w 0 := by |
| 115 | simpa only [Pi.add_apply, id_eq, zero_add, one_smul] using! |
| 116 | (hasDerivAt_const (0 : ℝ) x).add ((hasDerivAt_id (0 : ℝ)).smul_const w) |
| 117 | have hactual := (contDiff_spaceJet rho C a gamma t u).differentiable |
| 118 | (by simp) |>.differentiableAt (x := x) |>.hasFDerivAt |
| 119 | have hcompose := hactual.comp_hasDerivAt_of_eq (0 : ℝ) hl (by simp) |
| 120 | have hexplicit := hasDerivAt_spaceJet_along rho C a gamma t u hl |
| 121 | simpa using hcompose.unique hexplicit |
| 122 | |
| 123 | end PoincareMT.RicciFlow.Splitting.MaximumPrinciple.Barrier |
| 124 |