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.Positivity.InputAction |
| 3 | import PoincareLib.Geometry.RicciFlow.Harnack.Matrix.Positivity.BlockContact |
| 4 | import PoincareLib.Geometry.RicciFlow.Harnack.Matrix.Evolution.QuadraticHeat |
| 5 | import PoincareLib.Geometry.RicciFlow.Harnack.Matrix.Spacetime.M |
| 6 | |
| 7 | /-! |
| 8 | # Ordinary time contact for the Hamilton block |
| 9 | |
| 10 | The Ricci action on tensor slots is induced by a simultaneous linear change |
| 11 | of input frame. Its contraction vanishes at a null positive-semidefinite |
| 12 | Hamilton direction, so ordinary and covariant time contacts agree there. |
| 13 | |
| 14 | Reference: Chow et al., Part II, Theorem 15.16 and Section 15.4.5, pp. 272-287. |
| 15 | -/ |
| 16 | |
| 17 | set_option autoImplicit false |
| 18 | set_option backward.isDefEq.respectTransparency false |
| 19 | set_option maxHeartbeats 800000 |
| 20 | |
| 21 | open scoped Manifold ContDiff Bundle BigOperators Topology |
| 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 | |
| 32 | /-- The joint smoothness producer supplies ordinary time differentiability |
| 33 | of Hamilton's two-tensor on fixed tangent inputs. -/ |
| 34 | lemma differentiableAt_hamiltonM |
| 35 | (hC : RicciFlowCurvatureCalculus.{u}) {J : Set ℝ} (F : RicciFlow n M J) |
| 36 | (T₀ : ℝ) {t : ℝ} (ht : t ∈ interior J) (hτ : t - T₀ ≠ 0) |
| 37 | (x : M) (a c : TangentSpace (𝓡 n) x) : |
| 38 | DifferentiableAt ℝ (fun s => hamiltonM (F.connection s) (s - T₀) x a c) t := by |
| 39 | let X := fun i : Fin 2 => FiberBundle.extend (EuclideanSpace ℝ (Fin n)) (![a, c] i) |
| 40 | have hX (i : Fin 2) : ContMDiffAt (𝓡 n) ((𝓡 n).prod (𝓡 n)) ∞ (T% (X i)) x := |
| 41 | FiberBundle.contMDiffAt_extend (𝓡 n) (EuclideanSpace ℝ (Fin n)) (![a, c] i) |
| 42 | have h := contMDiffAt_hamiltonM_fields hC F T₀ ht hτ hX |
| 43 | have hp : ContMDiffAt 𝓘(ℝ, ℝ) (𝓘(ℝ, ℝ).prod (𝓡 n)) ∞ |
| 44 | (fun s : ℝ => (s, x)) t := contMDiffAt_id.prodMk contMDiffAt_const |
| 45 | have hd := ((h.comp t hp).contDiffAt.differentiableAt (by simp)) |
| 46 | simpa only [Function.comp_def, X, FiberBundle.extend_apply_self, Matrix.cons_val_zero, |
| 47 | Matrix.cons_val_one] using hd |
| 48 | |
| 49 | /-- Ricci slot corrections vanish in the actual geometric null quadratic. -/ |
| 50 | lemma hamilton_ricci_action_zero_at_null |
| 51 | {T₀ T₁ : ℝ} (F : RicciFlow n M (Set.Ioo T₀ T₁)) (t τ : ℝ) (x : M) |
| 52 | (U : Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) → |
| 53 | Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) → ℝ) |
| 54 | (W : Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) → ℝ) |
| 55 | (hQ : HamiltonBlockPos F t x τ) |
| 56 | (hnull : let D := F.connection t |
| 57 | let b := (F.metric t).orthonormalBasis x |
| 58 | (∑ a, ∑ c, hamiltonM D τ x (b a) (b c) * W a * W c) + |
| 59 | 2 * (∑ a, ∑ c, ∑ d, hamiltonP D x (b a) (b c) (b d) * U a c * W d) + |
| 60 | (∑ a, ∑ c, ∑ d, ∑ e, |
| 61 | D.curvatureTensor x (b a) (b c) (b d) (b e) * U a c * U d e) = 0) : |
| 62 | let D := F.connection t |
| 63 | let b := (F.metric t).orthonormalBasis x |
| 64 | (∑ a, ∑ c, D.ricciTensorAction (fun y z => |
| 65 | hamiltonM D τ y (z 0) (z 1)) x ![b a, b c] * W a * W c) + |
| 66 | 2 * (∑ a, ∑ c, ∑ d, |
| 67 | D.ricciTensorAction (fun y z => hamiltonP D y |
| 68 | (z 0) (z 1) (z 2)) x ![b a, b c, b d] * U a c * W d) + |
| 69 | (∑ a, ∑ c, ∑ d, ∑ e, |
| 70 | D.ricciTensorAction D.riemannEvaluation x ![b a, b c, b d, b e] * U a c * U d e) = 0 := by |
| 71 | let D := F.connection t |
| 72 | let b := (F.metric t).orthonormalBasis x |
| 73 | have h := hamiltonBlock_input_action_zero |
| 74 | (fun a c d e => D.curvatureTensor x (b a) (b c) (b d) (b e)) |
| 75 | (fun a c d => hamiltonP D x (b a) (b c) (b d)) |
| 76 | (fun a c => hamiltonM D τ x (b a) (b c)) U |
| 77 | (fun a c => D.ricci x (b a) (b c)) W hQ hnull |
| 78 | dsimp only [D, b] at h |
| 79 | dsimp only |
| 80 | simp only [LeviCivitaData.ricciTensorAction, Fin.sum_univ_two, |
| 81 | Fin.sum_univ_three, Fin.sum_univ_four, Function.update_apply, |
| 82 | Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val_two, |
| 83 | Matrix.cons_val_three, Matrix.head_cons, Matrix.tail_cons, |
| 84 | LeviCivitaData.riemannEvaluation] |
| 85 | simp only [Finset.sum_add_distrib] at h |
| 86 | exact h |
| 87 | |
| 88 | /-- At a spatial null direction of the positive Hamilton block, its ordinary |
| 89 | time derivative is nonnegative on the fixed tangent inputs. -/ |
| 90 | theorem hamilton_time_quadratic_nonneg_at_null [T2Space M] |
| 91 | (hC : RicciFlowCurvatureTheory.{u}) {T₀ T₁ : ℝ} |
| 92 | (F : RicciFlow n M (Set.Ioo T₀ T₁)) {t : ℝ} (ht : t ∈ Set.Ioo T₀ T₁) (x : M) |
| 93 | (U : Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) → |
| 94 | Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) → ℝ) |
| 95 | (W : Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) → ℝ) |
| 96 | (hU : ∀ a c, U a c = -U c a) |
| 97 | (hQ : ∀ᶠ y in 𝓝 x, HamiltonBlockPos F t y (t - T₀)) |
| 98 | (hnull : let D := F.connection t |
| 99 | let b := (F.metric t).orthonormalBasis x |
| 100 | (∑ a, ∑ c, hamiltonM D (t - T₀) x (b a) (b c) * W a * W c) + |
| 101 | 2 * (∑ a, ∑ c, ∑ d, hamiltonP D x (b a) (b c) (b d) * U a c * W d) + |
| 102 | (∑ a, ∑ c, ∑ d, ∑ e, |
| 103 | D.curvatureTensor x (b a) (b c) (b d) (b e) * U a c * U d e) = 0) : |
| 104 | let b := (F.metric t).orthonormalBasis x |
| 105 | 0 ≤ (∑ a, ∑ c, |
| 106 | deriv (fun s => hamiltonM (F.connection s) (s - T₀) x (b a) (b c)) t * W a * W c) + |
| 107 | 2 * (∑ a, ∑ c, ∑ d, |
| 108 | deriv (fun s => hamiltonP (F.connection s) x (b a) (b c) (b d)) t * U a c * W d) + |
| 109 | (∑ a, ∑ c, ∑ d, ∑ e, |
| 110 | deriv (fun s => (F.connection s).curvatureTensor x (b a) (b c) (b d) (b e)) t * |
| 111 | U a c * U d e) := by |
| 112 | classical |
| 113 | let D := F.connection t |
| 114 | let b := (F.metric t).orthonormalBasis x |
| 115 | let Ric := fun a c => D.ricci x (b a) (b c) |
| 116 | let k := (2 * (t - T₀))⁻¹ |
| 117 | let V := fun e a c => |
| 118 | ((Ric e a + k * (if e = a then 1 else 0)) * W c - |
| 119 | W a * (Ric e c + k * (if e = c then 1 else 0))) / 2 |
| 120 | have hheat := hamilton_heat_quadratic_nonneg_at_null hC F ht x U W hU |
| 121 | hQ.self_of_nhds hnull |
| 122 | have hspace := hamilton_diffusion_quadratic_nonneg_at_null hC F t (t - T₀) x U W |
| 123 | hQ hnull V |
| 124 | have haction := hamilton_ricci_action_zero_at_null F t (t - T₀) x U W |
| 125 | hQ.self_of_nhds hnull |
| 126 | dsimp only [V, Ric, k, D, b] at hspace |
| 127 | dsimp only at hheat hspace haction ⊢ |
| 128 | simp only [RicciFlow.tensorHeatOperator, LeviCivitaData.riemannEvaluation, |
| 129 | Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val_two, Matrix.cons_val_three, |
| 130 | Matrix.head_cons, Matrix.tail_cons, |
| 131 | add_mul, sub_mul, Finset.sum_add_distrib, Finset.sum_sub_distrib, |
| 132 | mul_assoc] at hheat hspace haction ⊢ |
| 133 | linarith only [hheat, hspace, haction] |
| 134 | |
| 135 | /-- The fixed-input Hamilton quadratic has a nonnegative ordinary derivative |
| 136 | at a spatial null direction. -/ |
| 137 | theorem deriv_hamilton_quadratic_nonneg_at_null [T2Space M] |
| 138 | (hC : RicciFlowCurvatureTheory.{u}) {T₀ T₁ : ℝ} |
| 139 | (F : RicciFlow n M (Set.Ioo T₀ T₁)) {t : ℝ} (ht : t ∈ Set.Ioo T₀ T₁) (x : M) |
| 140 | (U : Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) → |
| 141 | Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) → ℝ) |
| 142 | (W : Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) → ℝ) |
| 143 | (hU : ∀ a c, U a c = -U c a) |
| 144 | (hQ : ∀ᶠ y in 𝓝 x, HamiltonBlockPos F t y (t - T₀)) |
| 145 | (hnull : let D := F.connection t |
| 146 | let b := (F.metric t).orthonormalBasis x |
| 147 | (∑ a, ∑ c, hamiltonM D (t - T₀) x (b a) (b c) * W a * W c) + |
| 148 | 2 * (∑ a, ∑ c, ∑ d, hamiltonP D x (b a) (b c) (b d) * U a c * W d) + |
| 149 | (∑ a, ∑ c, ∑ d, ∑ e, |
| 150 | D.curvatureTensor x (b a) (b c) (b d) (b e) * U a c * U d e) = 0) : |
| 151 | let b := (F.metric t).orthonormalBasis x |
| 152 | 0 ≤ deriv (fun s => |
| 153 | (∑ a, ∑ c, hamiltonM (F.connection s) (s - T₀) x (b a) (b c) * W a * W c) + |
| 154 | 2 * (∑ a, ∑ c, ∑ d, |
| 155 | hamiltonP (F.connection s) x (b a) (b c) (b d) * U a c * W d) + |
| 156 | (∑ a, ∑ c, ∑ d, ∑ e, |
| 157 | (F.connection s).curvatureTensor x (b a) (b c) (b d) (b e) * U a c * U d e)) t := by |
| 158 | classical |
| 159 | let b := (F.metric t).orthonormalBasis x |
| 160 | have ht' : t ∈ interior (Set.Ioo T₀ T₁) := by simpa only [interior_Ioo] using ht |
| 161 | have hM := HasDerivAt.fun_sum (u := Finset.univ) fun a _ => |
| 162 | HasDerivAt.fun_sum (u := Finset.univ) fun c _ => |
| 163 | (((differentiableAt_hamiltonM hC F T₀ ht' (ne_of_gt (sub_pos.mpr ht.1)) |
| 164 | x (b a) (b c)).hasDerivAt.mul_const (W a)).mul_const (W c)) |
| 165 | have hP := HasDerivAt.fun_sum (u := Finset.univ) fun a _ => |
| 166 | HasDerivAt.fun_sum (u := Finset.univ) fun c _ => |
| 167 | HasDerivAt.fun_sum (u := Finset.univ) fun d _ => by |
| 168 | have hd := (hasDerivAt_hamiltonP_evolution hC F ht' x (b a) (b c) (b d)).differentiableAt.hasDerivAt |
| 169 | exact (hd.mul_const (U a c)).mul_const (W d) |
| 170 | have hR := HasDerivAt.fun_sum (u := Finset.univ) fun a _ => |
| 171 | HasDerivAt.fun_sum (u := Finset.univ) fun c _ => |
| 172 | HasDerivAt.fun_sum (u := Finset.univ) fun d _ => |
| 173 | HasDerivAt.fun_sum (u := Finset.univ) fun e _ => by |
| 174 | have hd := ((hC.curvature_evolution n M (Set.Ioo T₀ T₁) F t ht x |
| 175 | (b a) (b c) (b d) (b e)).hasDerivAt (mem_interior_iff_mem_nhds.mp ht')).differentiableAt.hasDerivAt |
| 176 | exact (hd.mul_const (U a c)).mul_const (U d e) |
| 177 | dsimp only |
| 178 | have hd := ((hM.add (hP.const_mul 2)).add hR).deriv |
| 179 | simp only [Pi.add_def, b] at hd |
| 180 | rw [hd] |
| 181 | exact hamilton_time_quadratic_nonneg_at_null hC F ht x U W hU hQ hnull |
| 182 | |
| 183 | end Poincare.RicciFlow.Harnack |