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.Comparison.AnnularEvolution.Moving.MetricEnergy |
| 2 | import PoincareLib.Geometry.CurveShortening.Comparison.AnnularEvolution.Modulus.EnergyDensity |
| 3 | |
| 4 | /-! |
| 5 | # The actual weighted moving-metric derivative |
| 6 | |
| 7 | Independent metric and map times give smooth Gram coefficients. The |
| 8 | diagonal derivative of the weighted energy is its frozen-metric map |
| 9 | derivative minus the two weighted Ricci pairings. Neither positive rank |
| 10 | nor conformality is required. |
| 11 | |
| 12 | Morgan--Tian context: Lemma 19.15 and its annular area-to-energy construction, printed pp. |
| 13 | 447-449. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | set_option backward.isDefEq.respectTransparency false |
| 18 | |
| 19 | open Set Filter Bundle |
| 20 | open scoped Manifold ContDiff Topology |
| 21 | |
| 22 | universe u |
| 23 | |
| 24 | namespace PoincareMT |
| 25 | |
| 26 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 27 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 28 | {a b : ℝ} |
| 29 | |
| 30 | /-- The genuine spatial Gram coefficient is smooth in independent metric and map time |
| 31 | variables. Source: Morgan--Tian (2007), Lemma 19.15 and Corollary 19.16, pp. 447-449; |
| 32 | project derivation |
| 33 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 34 | theorem m64MixedAnnulusGram_contDiffAt |
| 35 | (F : RicciFlow n M (Icc a b)) {v : ℝ × LoopPlane → M} |
| 36 | {q : ℝ × (ℝ × LoopPlane)} (ht : q.1 ∈ Ioo a b) |
| 37 | (hv : ContMDiffAt 𝓘(ℝ, ℝ × LoopPlane) (𝓡 n) ∞ v q.2) |
| 38 | (i j : Fin 2) : |
| 39 | ContDiffAt ℝ ∞ (fun w : ℝ × (ℝ × LoopPlane) => |
| 40 | m60AreaGram (F.metric w.1) (fun z => v (w.2.1, z)) w.2.2 i j) q := by |
| 41 | let u (k : Fin 2) (w : ℝ × LoopPlane) := |
| 42 | mfderiv 𝓘(ℝ, ℝ × LoopPlane) (𝓡 n) v w |
| 43 | (0, EuclideanSpace.basisFun (Fin 2) ℝ k) |
| 44 | have hpush (k : Fin 2) : |
| 45 | ContMDiffAt 𝓘(ℝ, ℝ × LoopPlane) ((𝓡 n).prod (𝓡 n)) ∞ |
| 46 | (fun w => (⟨v w, u k w⟩ : TangentBundle (𝓡 n) M)) q.2 := by |
| 47 | have hd : ContMDiffAt 𝓘(ℝ, ℝ × LoopPlane) |
| 48 | ((𝓘(ℝ, ℝ × LoopPlane)).prod 𝓘(ℝ, ℝ × LoopPlane)) ∞ |
| 49 | (fun w : ℝ × LoopPlane => |
| 50 | (⟨w, (0, EuclideanSpace.basisFun (Fin 2) ℝ k)⟩ : |
| 51 | TangentBundle 𝓘(ℝ, ℝ × LoopPlane) (ℝ × LoopPlane))) q.2 := by |
| 52 | rw [contMDiffAt_totalSpace] |
| 53 | refine ⟨contMDiffAt_id, ?_⟩ |
| 54 | simpa using contMDiffAt_const |
| 55 | (c := ((0 : ℝ), EuclideanSpace.basisFun (Fin 2) ℝ k)) |
| 56 | exact (hv.mfderiv_const (m := ∞) (by simp)).clm_apply_of_inCoordinates hd hv |
| 57 | have hdomain : Icc a b ×ˢ (univ : Set M) ∈ 𝓝 (q.1, v q.2) := |
| 58 | prod_mem_nhds (Icc_mem_nhds ht.1 ht.2) univ_mem |
| 59 | have hmetric := (F.smooth.contMDiffAt hdomain).comp q |
| 60 | (contDiffAt_fst.contMDiffAt.prodMk (hv.comp q contDiffAt_snd.contMDiffAt)) |
| 61 | have h := hmetric.clm_bundle_apply₂ (F₃ := ℝ) (E₃ := Bundle.Trivial M ℝ) |
| 62 | ((hpush i).comp q contDiffAt_snd.contMDiffAt) |
| 63 | ((hpush j).comp q contDiffAt_snd.contMDiffAt) |
| 64 | have hscalar : ContDiffAt ℝ ∞ |
| 65 | (fun w : ℝ × (ℝ × LoopPlane) => |
| 66 | (F.metric w.1).inner (v w.2) (u i w.2) (u j w.2)) q := |
| 67 | contMDiffAt_iff_contDiffAt.mp (Bundle.contMDiffAt_totalSpace.mp h).2 |
| 68 | apply hscalar.congr_of_eventuallyEq |
| 69 | have hnear : ∀ᶠ w in 𝓝 q.2, |
| 70 | ContMDiffAt 𝓘(ℝ, ℝ × LoopPlane) (𝓡 n) 1 v w := |
| 71 | (contMDiffAt_iff_contMDiffAt_nhds (by simp)).mp (hv.of_le (by simp)) |
| 72 | filter_upwards [(continuous_snd.tendsto q).eventually hnear] with w hw |
| 73 | have hmd := hw.mdifferentiableAt one_ne_zero |
| 74 | simp only [m60AreaGram, m64MovingAnnulus_spatial_differential hmd, u] |
| 75 | |
| 76 | /-- The actual weighted energy density is smooth in independent metric and map time |
| 77 | variables. Source: Morgan--Tian (2007), Lemma 19.15 and Corollary 19.16, pp. 447-449; |
| 78 | project derivation |
| 79 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 80 | theorem m64ModulusEnergyDensity_mixed_contDiffAt |
| 81 | (F : RicciFlow n M (Icc a b)) (r : ℝ) {v : ℝ × LoopPlane → M} |
| 82 | {q : ℝ × (ℝ × LoopPlane)} (ht : q.1 ∈ Ioo a b) |
| 83 | (hv : ContMDiffAt 𝓘(ℝ, ℝ × LoopPlane) (𝓡 n) ∞ v q.2) : |
| 84 | ContDiffAt ℝ ∞ (fun w : ℝ × (ℝ × LoopPlane) => |
| 85 | m64ModulusEnergyDensity (F.metric w.1) r |
| 86 | (fun z => v (w.2.1, z)) w.2.2) q := by |
| 87 | exact ((contDiffAt_const.mul (m64MixedAnnulusGram_contDiffAt F ht hv 0 0)).add |
| 88 | (contDiffAt_const.mul (m64MixedAnnulusGram_contDiffAt F ht hv 1 1))).div_const 2 |
| 89 | |
| 90 | /-- The actual weighted energy density is smooth along the diagonal of evolving metric and |
| 91 | map time. Source: Morgan--Tian (2007), Lemma 19.15 and Corollary 19.16, pp. 447-449; project |
| 92 | derivation |
| 93 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 94 | theorem m64ModulusEnergyDensity_moving_metric_contDiffAt |
| 95 | (F : RicciFlow n M (Icc a b)) (r t : ℝ) {v : ℝ × LoopPlane → M} |
| 96 | {q : ℝ × LoopPlane} (ht : t + q.1 ∈ Ioo a b) |
| 97 | (hv : ContMDiffAt 𝓘(ℝ, ℝ × LoopPlane) (𝓡 n) ∞ v q) : |
| 98 | ContDiffAt ℝ ∞ (fun w : ℝ × LoopPlane => |
| 99 | m64ModulusEnergyDensity (F.metric (t + w.1)) r |
| 100 | (fun z => v (w.1, z)) w.2) q := by |
| 101 | exact (m64ModulusEnergyDensity_mixed_contDiffAt F r |
| 102 | (q := (t + q.1, q)) ht hv).comp (f := fun w : ℝ × LoopPlane => (t + w.1, w)) q |
| 103 | (((contDiffAt_const (c := t)).add contDiffAt_fst).prodMk contDiffAt_id) |
| 104 | |
| 105 | /-- The true weighted evolving energy derivative is its frozen-metric map derivative minus |
| 106 | the two weighted Ricci pairings. Source: Morgan--Tian (2007), Lemma 19.15 and Corollary |
| 107 | 19.16, pp. 447-449; project derivation |
| 108 | `proof-work/tasks/M64/reports/2026-09-27-annulus-energy-and-finite-variation-derivation.md`. -/ |
| 109 | theorem m64ModulusAnnulus_moving_metric_energy_hasDerivAt |
| 110 | (F : RicciFlow n M (Icc a b)) (r : ℝ) {v : ℝ × LoopPlane → M} |
| 111 | {t : ℝ} (ht : t ∈ Ioo a b) (p : LoopPlane) |
| 112 | (hv : ContMDiffAt 𝓘(ℝ, ℝ × LoopPlane) (𝓡 n) ∞ v (0, p)) : |
| 113 | let d := mfderiv (𝓡 2) (𝓡 n) (fun z => v (0, z)) p |
| 114 | HasDerivAt (fun s => m64ModulusEnergyDensity (F.metric (t + s)) r |
| 115 | (fun z => v (s, z)) p) |
| 116 | (deriv (fun s => m64ModulusEnergyDensity (F.metric t) r |
| 117 | (fun z => v (s, z)) p) 0 - |
| 118 | r * (F.connection t).ricci (v (0, p)) |
| 119 | (d (EuclideanSpace.basisFun (Fin 2) ℝ 0)) |
| 120 | (d (EuclideanSpace.basisFun (Fin 2) ℝ 0)) - |
| 121 | r⁻¹ * (F.connection t).ricci (v (0, p)) |
| 122 | (d (EuclideanSpace.basisFun (Fin 2) ℝ 1)) |
| 123 | (d (EuclideanSpace.basisFun (Fin 2) ℝ 1))) 0 := by |
| 124 | let E := fun q : ℝ × (ℝ × LoopPlane) => |
| 125 | m64ModulusEnergyDensity (F.metric q.1) r (fun z => v (q.2.1, z)) q.2.2 |
| 126 | let d := mfderiv (𝓡 2) (𝓡 n) (fun z => v (0, z)) p |
| 127 | let u := fun i : Fin 2 => d (EuclideanSpace.basisFun (Fin 2) ℝ i) |
| 128 | let R := fun i : Fin 2 => (F.connection t).ricci (v (0, p)) (u i) (u i) |
| 129 | have hE := (m64ModulusEnergyDensity_mixed_contDiffAt F r |
| 130 | (q := (t, (0, p))) ht hv).differentiableAt (by simp) |
| 131 | have hmetric := hE.hasFDerivAt.comp_hasDerivAt (l := E) |
| 132 | (f := fun s : ℝ => (s, ((0 : ℝ), p))) t |
| 133 | ((hasDerivAt_id t).prodMk (hasDerivAt_const t ((0 : ℝ), p))) |
| 134 | have hmap := hE.hasFDerivAt.comp_hasDerivAt (l := E) |
| 135 | (f := fun s : ℝ => (t, (s, p))) 0 |
| 136 | ((hasDerivAt_const 0 t).prodMk ((hasDerivAt_id 0).prodMk (hasDerivAt_const 0 p))) |
| 137 | have hE0 : HasFDerivAt E (fderiv ℝ E (t, (0, p))) (t + 0, (0, p)) := by |
| 138 | simpa only [add_zero] using hE.hasFDerivAt |
| 139 | have hdiag := hE0.comp_hasDerivAt (l := E) |
| 140 | (f := fun s : ℝ => (t + s, (s, p))) 0 |
| 141 | (((hasDerivAt_id 0).const_add t).prodMk |
| 142 | ((hasDerivAt_id 0).prodMk (hasDerivAt_const 0 p))) |
| 143 | have hric (i : Fin 2) : HasDerivAt |
| 144 | (fun s => (F.metric s).inner (v (0, p)) (u i) (u i)) (-2 * R i) t := |
| 145 | (F.equation t (Ioo_subset_Icc_self ht) (v (0, p)) (u i) (u i)).hasDerivAt |
| 146 | (Icc_mem_nhds ht.1 ht.2) |
| 147 | have hmetric' : HasDerivAt (fun s => E (s, (0, p))) |
| 148 | (-r * R 0 - r⁻¹ * R 1) t := by |
| 149 | have h := (((hric 0).const_mul r).add ((hric 1).const_mul r⁻¹)).div_const 2 |
| 150 | convert! h using 1 |
| 151 | ring |
| 152 | have hmetric_value : fderiv ℝ E (t, (0, p)) (1, (0, 0)) = |
| 153 | -r * R 0 - r⁻¹ * R 1 := hmetric.unique hmetric' |
| 154 | have hmap_value : fderiv ℝ E (t, (0, p)) (0, (1, 0)) = |
| 155 | deriv (fun s => m64ModulusEnergyDensity (F.metric t) r |
| 156 | (fun z => v (s, z)) p) 0 := hmap.deriv.symm |
| 157 | change HasDerivAt (fun s => E (t + s, (s, p))) |
| 158 | (deriv (fun s => m64ModulusEnergyDensity (F.metric t) r |
| 159 | (fun z => v (s, z)) p) 0 - r * R 0 - r⁻¹ * R 1) 0 |
| 160 | apply hdiag.congr_deriv |
| 161 | rw [show ((1 : ℝ), ((1 : ℝ), (0 : LoopPlane))) = |
| 162 | (1, (0, 0)) + (0, (1, 0)) by simp, map_add, hmetric_value, hmap_value] |
| 163 | ring |
| 164 | |
| 165 | end PoincareMT |