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.Tensor.HessianTime |
| 2 | import PoincareLib.Geometry.RicciFlow.Tensor.TimeDerivative.Trace |
| 3 | import PoincareLib.Geometry.Riemannian.Curvature.ContractedBianchi |
| 4 | import PoincareLib.Geometry.Riemannian.Curvature.IntrinsicCalculus |
| 5 | |
| 6 | /-! |
| 7 | # Laplacian variation under Ricci flow |
| 8 | |
| 9 | Contracted Bianchi cancels the trace of the connection variation. Tracing the |
| 10 | moving Hessian then gives the Laplacian of the time derivative plus twice the |
| 11 | Ricci-Hessian contraction. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | set_option backward.isDefEq.respectTransparency false |
| 16 | |
| 17 | open Set Filter |
| 18 | open scoped Manifold ContDiff Bundle Topology BigOperators |
| 19 | |
| 20 | universe u |
| 21 | |
| 22 | namespace PoincareMT.RicciFlow |
| 23 | |
| 24 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 25 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 26 | {J : Set ℝ} |
| 27 | |
| 28 | /-- Contracted Bianchi annihilates the trace of the actual connection variation. -/ |
| 29 | theorem sum_deriv_connection_extend_eq_zero |
| 30 | (F : RicciFlow n M J) {t : ℝ} (ht : t ∈ interior J) (x : M) : |
| 31 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 32 | ⟨(F.metric t).toRiemannianMetric⟩ |
| 33 | let b := (F.metric t).orthonormalBasis x |
| 34 | ∑ i, (deriv (fun s => (F.connection s).connection |
| 35 | (FiberBundle.extend (EuclideanSpace ℝ (Fin n)) (b i)) x) t) (b i) = 0 := by |
| 36 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 37 | ⟨(F.metric t).toRiemannianMetric⟩ |
| 38 | let D := F.connection t |
| 39 | let b := (F.metric t).orthonormalBasis x |
| 40 | let A (i) := (deriv (fun s => (F.connection s).connection |
| 41 | (FiberBundle.extend (EuclideanSpace ℝ (Fin n)) (b i)) x) t) (b i) |
| 42 | have hD := D.intrinsicCurvatureTensorCalculus |
| 43 | have hcoef (i j) : inner ℝ (b j) (A i) = |
| 44 | -D.frameRicciDerivative x i j i - D.frameRicciDerivative x i j i + |
| 45 | D.frameRicciDerivative x j i i := by |
| 46 | rw [real_inner_comm] |
| 47 | change (F.metric t).inner x (A i) (b j) = _ |
| 48 | rw [F.inner_deriv_connection_extend_of_equation ht] |
| 49 | change -D.covariantTensorDerivative D.ricciEvaluation x ![b i, b i, b j] - |
| 50 | D.covariantTensorDerivative D.ricciEvaluation x ![b i, b i, b j] + |
| 51 | D.covariantTensorDerivative D.ricciEvaluation x ![b j, b i, b i] = _ |
| 52 | rw [D.covariantTensorDerivative_ricciEvaluation_symm hD x (b i) (b i) (b j)] |
| 53 | rfl |
| 54 | have hzero (j) : inner ℝ (b j) (∑ i, A i) = 0 := by |
| 55 | simp only [inner_sum, hcoef, Finset.sum_add_distrib, Finset.sum_sub_distrib, |
| 56 | Finset.sum_neg_distrib, D.frameRicciDerivative_trace hD, |
| 57 | D.frameRicciDerivative_scalar_trace hD] |
| 58 | ring |
| 59 | have h := b.sum_repr' (∑ i, A i) |
| 60 | simp only [hzero, zero_smul, Finset.sum_const_zero] at h |
| 61 | exact h.symm |
| 62 | |
| 63 | /-- The moving Laplacian of a smooth scalar with specified time derivative. -/ |
| 64 | theorem hasDerivAt_laplacian_of_time_derivative |
| 65 | (F : RicciFlow n M J) {f : ℝ × M → ℝ} {df : M → ℝ} |
| 66 | {t : ℝ} (ht : t ∈ interior J) |
| 67 | (hspace : ∀ s, ContMDiff (𝓡 n) 𝓘(ℝ, ℝ) ∞ (fun y => f (s, y))) |
| 68 | (hreg : ∀ y, ContMDiffAt (𝓘(ℝ, ℝ).prod (𝓡 n)) 𝓘(ℝ, ℝ) ∞ f (t, y)) |
| 69 | (hdf : ∀ y, HasDerivAt (fun s => f (s, y)) (df y) t) (x : M) : |
| 70 | let D := F.connection t |
| 71 | let b := (F.metric t).orthonormalBasis x |
| 72 | HasDerivAt (fun s => (F.connection s).laplacian (fun y => f (s, y)) x) |
| 73 | (D.laplacian df x + 2 * ∑ i, ∑ j, |
| 74 | D.ricci x (b i) (b j) * D.hessian (fun y => f (t, y)) x (b i) (b j)) t := by |
| 75 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 76 | ⟨(F.metric t).toRiemannianMetric⟩ |
| 77 | let T : ℝ → CovariantTensorEvaluation n M 2 := fun s y v => |
| 78 | (F.connection s).hessian (fun z => f (s, z)) y (v 0) (v 1) |
| 79 | let W : ℝ → CovariantTensorEvaluation n M 2 := fun _ y v => |
| 80 | (F.connection t).hessian df y (v 0) (v 1) - |
| 81 | mvfderiv (𝓡 n) (fun z => f (t, z)) y |
| 82 | ((deriv (fun s => (F.connection s).connection |
| 83 | (FiberBundle.extend (EuclideanSpace ℝ (Fin n)) (v 1)) y) t) (v 0)) |
| 84 | have hW (v : Fin 2 → TangentSpace (𝓡 n) x) : |
| 85 | HasDerivAt (fun s => T s x v) (W t x v) t := |
| 86 | F.hasDerivAt_hessian_time ht hspace hreg hdf x (v 0) (v 1) |
| 87 | have h := F.hasDerivAt_tensorTrace (T := T) (W := W) ht x |
| 88 | (fun s => (F.connection s).hessian_isSmoothCovariantTensor (hspace s)) hW Fin.elim0 |
| 89 | change HasDerivAt (fun s => (F.connection s).laplacian (fun y => f (s, y)) x) _ t at h |
| 90 | apply h.congr_deriv |
| 91 | simp only [RiemannianMetric.tensorTrace, W, T, Fin.cons_zero, Fin.cons_one, |
| 92 | Finset.sum_sub_distrib, ← map_sum, F.sum_deriv_connection_extend_eq_zero ht, map_zero, |
| 93 | sub_zero, LeviCivitaData.laplacian] |
| 94 | |
| 95 | /-- A jointly smooth scalar on the flow's time strip satisfies the moving |
| 96 | Laplacian identity, with no regularity required outside that strip. -/ |
| 97 | theorem hasDerivAt_laplacian |
| 98 | (F : RicciFlow n M J) {f : M × ℝ → ℝ} {t : ℝ} |
| 99 | (ht : t ∈ interior J) |
| 100 | (hf : ContMDiffOn ((𝓡 n).prod 𝓘(ℝ, ℝ)) 𝓘(ℝ, ℝ) ∞ f (univ ×ˢ J)) |
| 101 | (x : M) : |
| 102 | let D := F.connection t |
| 103 | let b := (F.metric t).orthonormalBasis x |
| 104 | HasDerivAt (fun s => (F.connection s).laplacian (fun y => f (y, s)) x) |
| 105 | (D.laplacian (fun y => deriv (fun s => f (y, s)) t) x + |
| 106 | 2 * ∑ i, ∑ j, D.ricci x (b i) (b j) * |
| 107 | D.hessian (fun y => f (y, t)) x (b i) (b j)) t := by |
| 108 | classical |
| 109 | let f' : ℝ × M → ℝ := fun p => if p.1 ∈ J then f (p.2, p.1) else 0 |
| 110 | have hnear : J ∈ 𝓝 t := mem_interior_iff_mem_nhds.mp ht |
| 111 | have hsmooth (y : M) : ContMDiffAt ((𝓡 n).prod 𝓘(ℝ, ℝ)) 𝓘(ℝ, ℝ) ∞ f (y, t) := |
| 112 | hf.contMDiffAt (prod_mem_nhds Filter.univ_mem hnear) |
| 113 | have hspace (s : ℝ) : ContMDiff (𝓡 n) 𝓘(ℝ, ℝ) ∞ (fun y => f' (s, y)) := by |
| 114 | by_cases hs : s ∈ J |
| 115 | · have hslice : ContMDiff (𝓡 n) 𝓘(ℝ, ℝ) ∞ (fun y => f (y, s)) := |
| 116 | contMDiffOn_univ.mp (hf.comp |
| 117 | (contMDiffOn_id.prodMk contMDiffOn_const) (fun y _ => ⟨mem_univ y, hs⟩)) |
| 118 | simpa only [f', if_pos hs] using hslice |
| 119 | · simpa only [f', if_neg hs] using |
| 120 | (contMDiff_const : ContMDiff (𝓡 n) 𝓘(ℝ, ℝ) ∞ (fun _ : M => (0 : ℝ))) |
| 121 | have hreg (y : M) : ContMDiffAt (𝓘(ℝ, ℝ).prod (𝓡 n)) 𝓘(ℝ, ℝ) ∞ f' (t, y) := by |
| 122 | have hswap : ContMDiffAt (𝓘(ℝ, ℝ).prod (𝓡 n)) 𝓘(ℝ, ℝ) ∞ |
| 123 | (fun p : ℝ × M => f (p.2, p.1)) (t, y) := |
| 124 | (hsmooth y).comp_of_eq (contMDiffAt_snd.prodMk contMDiffAt_fst) rfl |
| 125 | apply hswap.congr_of_eventuallyEq |
| 126 | filter_upwards [continuousAt_fst.tendsto.eventually hnear] with p hp |
| 127 | exact if_pos hp |
| 128 | have hdf (y : M) : HasDerivAt (fun s => f' (s, y)) |
| 129 | (deriv (fun s => f (y, s)) t) t := by |
| 130 | have hs : ContMDiffAt 𝓘(ℝ, ℝ) 𝓘(ℝ, ℝ) ∞ (fun s => f (y, s)) t := |
| 131 | (hsmooth y).comp t (contMDiffAt_const.prodMk contMDiffAt_id) |
| 132 | apply (hs.contDiffAt.differentiableAt (by simp)).hasDerivAt.congr_of_eventuallyEq |
| 133 | filter_upwards [hnear] with s hs |
| 134 | exact if_pos hs |
| 135 | have h := F.hasDerivAt_laplacian_of_time_derivative ht hspace hreg hdf x |
| 136 | have hft : (fun y => f' (t, y)) = (fun y => f (y, t)) := by |
| 137 | funext y |
| 138 | exact if_pos (interior_subset ht) |
| 139 | dsimp only at h ⊢ |
| 140 | rw [hft] at h |
| 141 | apply h.congr_of_eventuallyEq |
| 142 | filter_upwards [hnear] with s hs |
| 143 | simp only [f', if_pos hs] |
| 144 | |
| 145 | end PoincareMT.RicciFlow |