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.Curvature.Calculus |
| 2 | import PoincareLib.Geometry.RicciFlow.Harnack.Matrix.Spacetime |
| 3 | import PoincareLib.Geometry.Riemannian.Hessian.Tensor |
| 4 | import PoincareLib.Geometry.Riemannian.Tensor.Product |
| 5 | import PoincareLib.Geometry.Riemannian.Tensor.TraceRegularity |
| 6 | |
| 7 | /-! |
| 8 | # Joint regularity of Hamilton's two-tensor |
| 9 | |
| 10 | The Ricci evolution expresses Hamilton's two-tensor as the time derivative |
| 11 | of Ricci, minus half the scalar Hessian, plus the Ricci square and reciprocal |
| 12 | time term. Every summand is jointly smooth away from the initial time. |
| 13 | This supplies continuity for the first-contact argument in Chow et al., |
| 14 | Part II, Section 15.4.5, printed pp. 282-287. |
| 15 | -/ |
| 16 | |
| 17 | set_option autoImplicit false |
| 18 | set_option backward.isDefEq.respectTransparency false |
| 19 | |
| 20 | open scoped Manifold ContDiff Bundle Topology BigOperators |
| 21 | open Set Filter |
| 22 | |
| 23 | universe u |
| 24 | |
| 25 | namespace Poincare.RicciFlow.Harnack |
| 26 | |
| 27 | open PoincareMT |
| 28 | |
| 29 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 30 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 31 | {J : Set ℝ} |
| 32 | |
| 33 | /-- The scalar Hessian is jointly smooth on locally smooth fixed fields. -/ |
| 34 | lemma contMDiffAt_hessian_scalarCurvature_fields |
| 35 | (hC : RicciFlowCurvatureCalculus.{u}) (F : RicciFlow n M J) |
| 36 | {t : ℝ} (ht : t ∈ interior J) {x : M} |
| 37 | {X : Fin 2 → (y : M) → TangentSpace (𝓡 n) y} |
| 38 | (hX : ∀ i, ContMDiffAt (𝓡 n) ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ |
| 39 | (T% (X i)) x) : |
| 40 | ContMDiffAt (𝓘(ℝ, ℝ).prod (𝓡 n)) 𝓘(ℝ, ℝ) ∞ |
| 41 | (fun p : ℝ × M => (F.connection p.1).hessian |
| 42 | (F.connection p.1).scalarCurvature p.2 (X 0 p.2) (X 1 p.2)) (t, x) := by |
| 43 | have hspace (s : ℝ) : ContMDiff (𝓡 n) 𝓘(ℝ, ℝ) ∞ |
| 44 | (F.connection s).scalarCurvature := by |
| 45 | intro y |
| 46 | have h := ((hC.tensor_calculus n M (F.metric s) (F.connection s)).2.1.tensorTrace |
| 47 | (g := F.metric s)).contMDiffAt_apply (x := y) |
| 48 | (X := fun i : Fin 0 => Fin.elim0 i) (fun i => Fin.elim0 i) |
| 49 | convert h using 1 |
| 50 | funext z |
| 51 | unfold RiemannianMetric.tensorTrace LeviCivitaData.scalarCurvature |
| 52 | apply Finset.sum_congr rfl |
| 53 | intro i _ |
| 54 | rfl |
| 55 | have hscalar : ContMDiffAt (𝓘(ℝ, ℝ).prod (𝓡 n)) 𝓘(ℝ, ℝ) ∞ |
| 56 | (fun p : ℝ × M => (F.connection p.1).scalarCurvature p.2) (t, x) := |
| 57 | (hC.scalar_regular n M J F (t, x) ⟨interior_subset ht, mem_univ x⟩).contMDiffAt |
| 58 | (prod_mem_nhds (mem_interior_iff_mem_nhds.mp ht) Filter.univ_mem) |
| 59 | have hreg (Y : Fin 1 → (y : M) → TangentSpace (𝓡 n) y) |
| 60 | (hY : ∀ i, ContMDiffAt (𝓡 n) |
| 61 | ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ (T% (Y i)) x) : |
| 62 | ContMDiffAt (𝓘(ℝ, ℝ).prod (𝓡 n)) 𝓘(ℝ, ℝ) ∞ |
| 63 | (fun p : ℝ × M => differentialEvaluation (F.connection p.1).scalarCurvature |
| 64 | p.2 (fun i => Y i p.2)) (t, x) := by |
| 65 | change ContMDiffAt (𝓘(ℝ, ℝ).prod (𝓡 n)) 𝓘(ℝ, ℝ) ∞ |
| 66 | (fun p : ℝ × M => mvfderiv (𝓡 n) (F.connection p.1).scalarCurvature |
| 67 | p.2 (Y 0 p.2)) (t, x) |
| 68 | exact Poincare.Manifold.contMDiffAt_mvfderiv_spatial (I := 𝓡 n) |
| 69 | (f := fun p : ℝ × M => (F.connection p.1).scalarCurvature p.2) |
| 70 | (X := Y 0) hscalar (hY 0) |
| 71 | have h := F.contMDiffAt_covariantTensorDerivative_fields (k := 1) (X := X) |
| 72 | (T := fun s => differentialEvaluation (F.connection s).scalarCurvature) ht |
| 73 | (fun s => differentialEvaluation_isSmooth (hspace s)) hreg hX |
| 74 | convert h using 1 |
| 75 | funext p |
| 76 | rw [LeviCivitaData.hessian_eq_covariantTensorDerivative] |
| 77 | congr 1 |
| 78 | ext i |
| 79 | fin_cases i <;> rfl |
| 80 | |
| 81 | /-- The Ricci-square contraction is jointly smooth without choosing a |
| 82 | spacetime-smooth orthonormal basis. -/ |
| 83 | lemma contMDiffAt_ricciSquare_fields |
| 84 | (hC : RicciFlowCurvatureCalculus.{u}) (F : RicciFlow n M J) |
| 85 | {t : ℝ} (ht : t ∈ interior J) {x : M} |
| 86 | {X : Fin 2 → (y : M) → TangentSpace (𝓡 n) y} |
| 87 | (hX : ∀ i, ContMDiffAt (𝓡 n) ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ |
| 88 | (T% (X i)) x) : |
| 89 | ContMDiffAt (𝓘(ℝ, ℝ).prod (𝓡 n)) 𝓘(ℝ, ℝ) ∞ |
| 90 | (fun p : ℝ × M => ∑ i, |
| 91 | (F.connection p.1).ricci p.2 (X 0 p.2) ((F.metric p.1).orthonormalBasis p.2 i) * |
| 92 | (F.connection p.1).ricci p.2 ((F.metric p.1).orthonormalBasis p.2 i) (X 1 p.2)) |
| 93 | (t, x) := by |
| 94 | let σ : Equiv.Perm (Fin 4) := Equiv.ofBijective ![2, 0, 1, 3] (by decide) |
| 95 | let S : ℝ → CovariantTensorEvaluation n M 4 := fun s y z => |
| 96 | tensorProduct (F.connection s).ricciEvaluation (F.connection s).ricciEvaluation |
| 97 | y (z ∘ σ) |
| 98 | have hS (s : ℝ) : IsSmoothCovariantTensor (S s) := |
| 99 | (isSmoothCovariantTensor_tensorProduct |
| 100 | (hC.tensor_calculus n M (F.metric s) (F.connection s)).2.1 |
| 101 | (hC.tensor_calculus n M (F.metric s) (F.connection s)).2.1).perm σ |
| 102 | have h := F.contMDiffAt_tensorTrace_fields (T := S) ht hS |
| 103 | (fun Y hY => (F.contMDiffAt_ricci_fields ht (hY (σ 0)) (hY (σ 1))).mul |
| 104 | (F.contMDiffAt_ricci_fields ht (hY (σ 2)) (hY (σ 3)))) hX |
| 105 | exact h |
| 106 | |
| 107 | /-- Hamilton's two-tensor is jointly smooth on locally smooth fixed fields |
| 108 | at interior times distinct from its reciprocal-time origin. -/ |
| 109 | lemma contMDiffAt_hamiltonM_fields |
| 110 | (hC : RicciFlowCurvatureCalculus.{u}) (F : RicciFlow n M J) |
| 111 | (T₀ : ℝ) {t : ℝ} (ht : t ∈ interior J) (hτ : t - T₀ ≠ 0) {x : M} |
| 112 | {X : Fin 2 → (y : M) → TangentSpace (𝓡 n) y} |
| 113 | (hX : ∀ i, ContMDiffAt (𝓡 n) ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ |
| 114 | (T% (X i)) x) : |
| 115 | ContMDiffAt (𝓘(ℝ, ℝ).prod (𝓡 n)) 𝓘(ℝ, ℝ) ∞ |
| 116 | (fun p : ℝ × M => hamiltonM (F.connection p.1) (p.1 - T₀) p.2 |
| 117 | (X 0 p.2) (X 1 p.2)) (t, x) := by |
| 118 | have hRic := F.contMDiffAt_ricci_fields ht (hX 0) (hX 1) |
| 119 | have hdRic := Poincare.Manifold.contMDiffAt_deriv_time hRic |
| 120 | have hH := contMDiffAt_hessian_scalarCurvature_fields hC F ht hX |
| 121 | have hS := contMDiffAt_ricciSquare_fields hC F ht hX |
| 122 | have hQ : ContMDiffAt (𝓘(ℝ, ℝ).prod (𝓡 n)) 𝓘(ℝ, ℝ) ∞ |
| 123 | (fun p : ℝ × M => (F.connection p.1).ricci p.2 (X 0 p.2) (X 1 p.2) / |
| 124 | (2 * (p.1 - T₀))) (t, x) := |
| 125 | hRic.div₀ (contMDiffAt_const.mul (contMDiffAt_fst.sub contMDiffAt_const)) |
| 126 | (mul_ne_zero (by norm_num) hτ) |
| 127 | have h := ((hdRic.sub (hH.div_const 2)).add hS).add hQ |
| 128 | apply h.congr_of_eventuallyEq |
| 129 | have htime : ∀ᶠ p : ℝ × M in 𝓝 (t, x), p.1 ∈ interior J := |
| 130 | (continuousAt_fst : ContinuousAt Prod.fst (t, x)).eventually |
| 131 | (isOpen_interior.mem_nhds ht) |
| 132 | filter_upwards [htime] with p hp |
| 133 | have heq := (ricci_hasDerivWithinAt_hamiltonM hC J F p.1 (interior_subset hp) |
| 134 | (p.1 - T₀) p.2 (X 0 p.2) (X 1 p.2)).hasDerivAt |
| 135 | (mem_interior_iff_mem_nhds.mp hp) |>.deriv |
| 136 | simp only [Pi.add_apply] at ⊢ |
| 137 | linarith only [heq] |
| 138 | |
| 139 | end Poincare.RicciFlow.Harnack |