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.H2SecondDerivative |
| 2 | import PoincareLib.Geometry.CurveShortening.Ramp.LocalFlow.Vector.SpectralTranslation |
| 3 | import Mathlib.Analysis.InnerProductSpace.PiL2 |
| 4 | import Mathlib.Analysis.Calculus.ContDiff.Deriv |
| 5 | |
| 6 | /-! |
| 7 | # Actual L2 second derivatives of finite-vector spectral traces |
| 8 | |
| 9 | The literal bounded decoder retains every complex coordinate until |
| 10 | the actual derivative is identified. A differentiable phase orbit |
| 11 | gives the genuine continuous second jet. MT2007 Claim 19.1, p. 437; |
| 12 | `2026-09-22-c2-spectral-second-derivative.md`, statements 2-3. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open AddCircle MeasureTheory PoincareMT.SpectralHeatNative |
| 18 | open scoped BigOperators Topology ContDiff |
| 19 | |
| 20 | namespace PoincareMT.M63 |
| 21 | |
| 22 | variable {L : ℝ} [Fact (0 < L)] {ι : Type*} [Fintype ι] |
| 23 | |
| 24 | local notation "V" => State ((ℤ × Fin 2) × ι) |
| 25 | local notation "W" => EuclideanSpace ℝ ι |
| 26 | |
| 27 | /-- The actual second-derivative decoder is a finite sum of existing |
| 28 | bounded coordinate and L2 maps. MT2007 Claim 19.1, p. 437; |
| 29 | second-derivative decoder derivation, statement 2. -/ |
| 30 | noncomputable def vectorPeriodicSecondDerivativeLp : |
| 31 | V →L[ℝ] Lp W 2 (@haarAddCircle L _) := by |
| 32 | classical |
| 33 | let C (i : ι) : V →L[ℝ] lp (fun _ : ℤ => ℂ) 2 := |
| 34 | complexLpRealEquiv.symm.toContinuousLinearEquiv.toContinuousLinearMap.comp |
| 35 | ((ContinuousLinearMap.proj i).comp (lpFinitePiEquiv ℝ).toContinuousLinearMap) |
| 36 | let B (i : ι) : ℝ →L[ℝ] W := |
| 37 | ContinuousLinearMap.toSpanSingleton ℝ (EuclideanSpace.single i 1) |
| 38 | let D := (periodicH1DerivativeLp (L := L)).comp |
| 39 | (periodicH2JetCoordinates (L := L) 1 (by omega)) |
| 40 | exact ∑ i, ((B i |>.comp Complex.reCLM).compLpL 2 haarAddCircle).comp |
| 41 | ((D.restrictScalars ℝ).comp (C i)) |
| 42 | |
| 43 | /-- A genuinely differentiable full phase orbit supplies actual C2 |
| 44 | spatial witnesses and identifies the literal bounded L2 second jet. |
| 45 | MT2007 Claim 19.1, p. 437; decoder derivation, statement 3. -/ |
| 46 | theorem vectorPeriodicSecondDerivativeLp_spec (u : V) |
| 47 | (hu : DifferentiableAt ℝ |
| 48 | (fun s : ℝ => vectorPeriodicSpectralTranslation (L := L) s u) 0) : |
| 49 | let q0 := fun x : AddCircle L => |
| 50 | WithLp.toLp 2 (vectorPeriodicJet (L := L) 1 0 (by omega) u x) |
| 51 | let q1 := fun x : AddCircle L => |
| 52 | WithLp.toLp 2 (vectorPeriodicJet (L := L) 1 1 (by omega) u x) |
| 53 | ∃ q2 : C(AddCircle L, W), |
| 54 | ContDiff ℝ 2 (fun x : ℝ => q0 (x : AddCircle L)) ∧ |
| 55 | (∀ x : ℝ, HasDerivAt (fun y : ℝ => q1 (y : AddCircle L)) |
| 56 | (q2 (x : AddCircle L)) x) ∧ |
| 57 | (∀ x : ℝ, iteratedDeriv 2 (fun y : ℝ => q0 (y : AddCircle L)) x = |
| 58 | q2 (x : AddCircle L)) ∧ |
| 59 | vectorPeriodicSecondDerivativeLp (L := L) u = |
| 60 | ContinuousMap.toLp 2 haarAddCircle ℝ q2 := by |
| 61 | classical |
| 62 | let C (i : ι) : V →L[ℝ] lp (fun _ : ℤ => ℂ) 2 := |
| 63 | complexLpRealEquiv.symm.toContinuousLinearEquiv.toContinuousLinearMap.comp |
| 64 | ((ContinuousLinearMap.proj i).comp (lpFinitePiEquiv ℝ).toContinuousLinearMap) |
| 65 | let B (i : ι) : ℝ →L[ℝ] W := |
| 66 | ContinuousLinearMap.toSpanSingleton ℝ (EuclideanSpace.single i 1) |
| 67 | let A (i : ι) : ℂ →L[ℝ] W := (B i).comp Complex.reCLM |
| 68 | let D := (periodicH1DerivativeLp (L := L)).comp |
| 69 | (periodicH2JetCoordinates (L := L) 1 (by omega)) |
| 70 | let f (i : ι) := periodicSobolevJet (L := L) 1 1 (by omega) (C i u) |
| 71 | let G (i : ι) (s : ℝ) := periodicSobolevJet (L := L) 1 1 (by omega) |
| 72 | (C i (vectorPeriodicSpectralTranslation (L := L) s u)) |
| 73 | have hGdiff (i : ι) : DifferentiableAt ℝ (G i) 0 := |
| 74 | ((periodicSobolevJet (L := L) 1 1 (by omega)).restrictScalars ℝ).differentiableAt.comp 0 |
| 75 | ((C i).differentiableAt.comp 0 hu) |
| 76 | have horbit (i : ι) (s : ℝ) (x : AddCircle L) : G i s x = f i (x - (s : AddCircle L)) := by |
| 77 | have hs : C i (vectorPeriodicSpectralTranslation (L := L) s u) = |
| 78 | periodicSpectralTranslation (L := L) s (C i u) := by |
| 79 | change complexLpRealEquiv.symm |
| 80 | (lpFinitePiEquiv ℝ (vectorPeriodicSpectralTranslation (L := L) s u) i) = _ |
| 81 | rw [(vectorPeriodicSpectralTranslation_spec s u).1 i, |
| 82 | (realPeriodicSpectralTranslation_spec s _).1] |
| 83 | rfl |
| 84 | change periodicSobolevJet (L := L) 1 1 (by omega) |
| 85 | (C i (vectorPeriodicSpectralTranslation (L := L) s u)) x = _ |
| 86 | rw [hs, periodicSobolevJet_periodicSpectralTranslation] |
| 87 | rfl |
| 88 | let g (i : ι) : C(AddCircle L, ℂ) := -deriv (G i) 0 |
| 89 | have hg (i : ι) (x : ℝ) : HasDerivAt |
| 90 | (fun y : ℝ => f i (y : AddCircle L)) (g i (x : AddCircle L)) x := by |
| 91 | have hd := (ContinuousMap.evalCLM ℝ (x : AddCircle L)).hasFDerivAt.comp_hasDerivAt 0 |
| 92 | (hGdiff i).hasDerivAt |
| 93 | have hd' : HasDerivAt (fun s : ℝ => G i s (x : AddCircle L)) |
| 94 | (deriv (G i) 0 (x : AddCircle L)) (x - x) := by |
| 95 | simpa only [sub_self, Function.comp_def] using! hd |
| 96 | have hc := hd'.scomp x ((hasDerivAt_const x x).sub (hasDerivAt_id x)) |
| 97 | change HasDerivAt (fun y : ℝ => G i (x - y) (x : AddCircle L)) |
| 98 | ((0 - 1 : ℝ) • deriv (G i) 0 (x : AddCircle L)) x at hc |
| 99 | have heq : (fun y : ℝ => G i (x - y) (x : AddCircle L)) = |
| 100 | (fun y : ℝ => f i (y : AddCircle L)) := by |
| 101 | funext y |
| 102 | rw [horbit, AddCircle.coe_sub, sub_sub_cancel] |
| 103 | rw [heq] at hc |
| 104 | simpa only [zero_sub, neg_one_smul, g, ContinuousMap.neg_apply] using hc |
| 105 | let E := PiLp.continuousLinearEquiv 2 ℝ (fun _ : ι => ℝ) |
| 106 | let q0 : C(AddCircle L, W) := E.symm.toContinuousLinearMap.compLeftContinuous ℝ _ |
| 107 | (vectorPeriodicJet (L := L) 1 0 (by omega) u) |
| 108 | let q1 : C(AddCircle L, W) := E.symm.toContinuousLinearMap.compLeftContinuous ℝ _ |
| 109 | (vectorPeriodicJet (L := L) 1 1 (by omega) u) |
| 110 | let h (i : ι) : C(AddCircle L, W) := (A i).compLeftContinuous ℝ _ (g i) |
| 111 | let q2 : C(AddCircle L, W) := ∑ i, h i |
| 112 | have hsum (z : AddCircle L) : (∑ i, A i (f i z)) = q1 z := by |
| 113 | apply PiLp.ext |
| 114 | intro i |
| 115 | change WithLp.ofLp (∑ j, (f j z).re • EuclideanSpace.single j (1 : ℝ)) i = (f i z).re |
| 116 | simp only [WithLp.ofLp_sum, Finset.sum_apply, WithLp.ofLp_smul, Pi.smul_apply, |
| 117 | EuclideanSpace.single, PiLp.ofLp_single, Pi.single_apply, smul_eq_mul, |
| 118 | mul_ite, mul_one, mul_zero] |
| 119 | simp |
| 120 | have hq1 (x : ℝ) : HasDerivAt (fun y : ℝ => q1 (y : AddCircle L)) |
| 121 | (q2 (x : AddCircle L)) x := by |
| 122 | have hd := HasDerivAt.fun_sum (u := Finset.univ) |
| 123 | (fun i _ => (A i).hasFDerivAt.comp_hasDerivAt x (hg i x)) |
| 124 | simp only [q2, ContinuousMap.sum_apply] |
| 125 | change HasDerivAt (fun y : ℝ => q1 (y : AddCircle L)) |
| 126 | (∑ i, A i (g i (x : AddCircle L))) x |
| 127 | simpa only [Function.comp_def, hsum] using hd |
| 128 | have hq0 (x : ℝ) : HasDerivAt (fun y : ℝ => q0 (y : AddCircle L)) |
| 129 | (q1 (x : AddCircle L)) x := |
| 130 | E.symm.toContinuousLinearMap.hasFDerivAt.comp_hasDerivAt x |
| 131 | (hasDerivAt_vectorPeriodicJet (L := L) (by omega : 0 < 1) u x) |
| 132 | have hderiv0 : deriv (fun y : ℝ => q0 (y : AddCircle L)) = |
| 133 | fun y : ℝ => q1 (y : AddCircle L) := funext fun x => (hq0 x).deriv |
| 134 | have hderiv1 : deriv (fun y : ℝ => q1 (y : AddCircle L)) = |
| 135 | fun y : ℝ => q2 (y : AddCircle L) := funext fun x => (hq1 x).deriv |
| 136 | have hq1c1 : ContDiff ℝ 1 (fun y : ℝ => q1 (y : AddCircle L)) := by |
| 137 | apply contDiff_one_iff_deriv.mpr |
| 138 | refine ⟨fun x => (hq1 x).differentiableAt, ?_⟩ |
| 139 | rw [hderiv1] |
| 140 | exact q2.continuous.comp (AddCircle.continuous_mk' L) |
| 141 | have hq0c2 : ContDiff ℝ 2 (fun y : ℝ => q0 (y : AddCircle L)) := by |
| 142 | rw [show (2 : ℕ∞ω) = 1 + 1 from rfl, contDiff_succ_iff_deriv] |
| 143 | refine ⟨fun x => (hq0 x).differentiableAt, by simp, ?_⟩ |
| 144 | rw [hderiv0] |
| 145 | exact hq1c1 |
| 146 | change ∃ q2 : C(AddCircle L, W), |
| 147 | ContDiff ℝ 2 (fun x : ℝ => q0 (x : AddCircle L)) ∧ |
| 148 | (∀ x : ℝ, HasDerivAt (fun y : ℝ => q1 (y : AddCircle L)) (q2 (x : AddCircle L)) x) ∧ |
| 149 | (∀ x : ℝ, iteratedDeriv 2 (fun y : ℝ => q0 (y : AddCircle L)) x = |
| 150 | q2 (x : AddCircle L)) ∧ |
| 151 | vectorPeriodicSecondDerivativeLp (L := L) u = ContinuousMap.toLp 2 haarAddCircle ℝ q2 |
| 152 | refine ⟨q2, hq0c2, hq1, ?_, ?_⟩ |
| 153 | · intro x |
| 154 | simpa only [iteratedDeriv_succ, iteratedDeriv_zero, hderiv0] using (hq1 x).deriv |
| 155 | · have hcoord (i : ι) : (A i).compLpL 2 haarAddCircle (D (C i u)) = |
| 156 | ContinuousMap.toLp 2 haarAddCircle ℝ (h i) := by |
| 157 | change (A i).compLpL 2 haarAddCircle |
| 158 | (periodicH1DerivativeLp (periodicH2JetCoordinates (L := L) 1 (by omega) (C i u))) = _ |
| 159 | rw [periodicH2_secondDerivativeLp_eq (C i u) (g i) (hg i)] |
| 160 | apply Lp.ext |
| 161 | filter_upwards [(A i).coeFn_compLpL (ContinuousMap.toLp 2 haarAddCircle ℂ (g i)), |
| 162 | ContinuousMap.coeFn_toLp (p := 2) haarAddCircle (𝕜 := ℂ) (g i), |
| 163 | ContinuousMap.coeFn_toLp (p := 2) haarAddCircle (𝕜 := ℝ) (h i)] with x hA hgx hhx |
| 164 | rw [hA, hgx, hhx] |
| 165 | rfl |
| 166 | change (∑ i, ((A i).compLpL 2 haarAddCircle).comp |
| 167 | ((D.restrictScalars ℝ).comp (C i))) u = ContinuousMap.toLp 2 haarAddCircle ℝ (∑ i, h i) |
| 168 | rw [map_sum] |
| 169 | simp only [sum_apply, ContinuousLinearMap.comp_apply, |
| 170 | ContinuousLinearMap.coe_restrictScalars', hcoord] |
| 171 | |
| 172 | end PoincareMT.M63 |