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.Reaction |
| 3 | import PoincareLib.Geometry.RicciFlow.Harnack.TwoForm |
| 4 | import PoincareLib.Geometry.RicciFlow.Harnack.Matrix.Tensors |
| 5 | |
| 6 | /-! |
| 7 | # Diagonal extraction from the Hamilton block |
| 8 | |
| 9 | The block maximum principle is tested on the half-wedge `v ∧ e_a` and the |
| 10 | coordinate vector `e_a`. This finite-dimensional lemma records that exact |
| 11 | specialization before the geometric trace adapter is applied. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | |
| 16 | open scoped BigOperators |
| 17 | open Matrix |
| 18 | open scoped Manifold ContDiff Bundle |
| 19 | |
| 20 | namespace Poincare.RicciFlow.Harnack |
| 21 | |
| 22 | open PoincareMT |
| 23 | |
| 24 | variable {I : Type*} [Fintype I] [DecidableEq I] |
| 25 | |
| 26 | /-- A nonnegative Hamilton quadratic on skew coefficients is nonnegative on |
| 27 | each simple half-wedge, with the resulting diagonal expression exposed. -/ |
| 28 | lemma hamilton_diagonal_nonneg_of_skew_quadratic_nonneg |
| 29 | (R : I → I → I → I → ℝ) (P : I → I → I → ℝ) (M : I → I → ℝ) |
| 30 | (hfirst : ∀ a b c d, R a b c d = -R b a c d) |
| 31 | (hlast : ∀ a b c d, R a b c d = -R a b d c) |
| 32 | (hP : ∀ a b c, P a b c = -P b a c) |
| 33 | (hQ : ∀ (U : I → I → ℝ) (W : I → ℝ), |
| 34 | (∀ a b, U a b = -U b a) → |
| 35 | 0 ≤ (∑ a, ∑ b, M a b * W a * W b) + |
| 36 | 2 * (∑ a, ∑ b, ∑ c, P a b c * U a b * W c) + |
| 37 | (∑ a, ∑ b, ∑ c, ∑ d, R a b c d * U a b * U c d)) |
| 38 | (V : I → ℝ) : |
| 39 | ∀ a, 0 ≤ M a a + 2 * (∑ i, P i a a * V i) + |
| 40 | ∑ i, ∑ k, R i a k a * V i * V k := by |
| 41 | intro a |
| 42 | let e : I → ℝ := fun i => if i = a then 1 else 0 |
| 43 | let U : I → I → ℝ := fun i j => (V i * e j - e i * V j) / 2 |
| 44 | have hU : ∀ i j, U i j = -U j i := by |
| 45 | intro i j |
| 46 | dsimp [U] |
| 47 | ring |
| 48 | have h := hQ U e hU |
| 49 | have hR' : |
| 50 | (∑ i, ∑ j, ∑ k, ∑ l, R i j k l * U i j * U k l) = |
| 51 | ∑ i, ∑ k, R i a k a * V i * V k := by |
| 52 | have hR₀ := curvature_contraction_half_wedge R hfirst hlast V e |
| 53 | simpa [U, e, mul_ite, ite_mul, Finset.sum_ite_eq', Finset.mem_univ] |
| 54 | using hR₀ |
| 55 | have hP' : |
| 56 | (∑ i, ∑ j, P i j a * U i j) = ∑ i, P i a a * V i := by |
| 57 | have hP₀ := skew_contraction_half_wedge (fun i j => P i j a) |
| 58 | (fun i j => hP i j a) V e |
| 59 | simpa [U, e, mul_ite, ite_mul, Finset.sum_ite_eq', Finset.mem_univ] |
| 60 | using hP₀ |
| 61 | rw [hR'] at h |
| 62 | have hmix : |
| 63 | (∑ a_1, ∑ b, ∑ c, P a_1 b c * U a_1 b * e c) = |
| 64 | ∑ i, P i a a * V i := by |
| 65 | simpa [e, mul_ite, Finset.sum_ite_eq', Finset.mem_univ] using hP' |
| 66 | rw [hmix] at h |
| 67 | dsimp [e] at h |
| 68 | simp only [mul_ite, Finset.sum_ite_eq', Finset.mem_univ, if_true, |
| 69 | mul_one, mul_zero] at h |
| 70 | simpa [mul_comm, mul_left_comm, mul_assoc] using h |
| 71 | |
| 72 | /-- The same diagonal extraction with the block positive-semidefinite witness |
| 73 | as input. -/ |
| 74 | lemma hamilton_diagonal_nonneg_of_block_posSemidef |
| 75 | (R : I → I → I → I → ℝ) (P : I → I → I → ℝ) (M : I → I → ℝ) |
| 76 | (hR : ∀ a b c d, R a b c d = R c d a b) |
| 77 | (hfirst : ∀ a b c d, R a b c d = -R b a c d) |
| 78 | (hlast : ∀ a b c d, R a b c d = -R a b d c) |
| 79 | (hP : ∀ a b c, P a b c = -P b a c) |
| 80 | (hM : ∀ a b, M a b = M b a) |
| 81 | (hQ : (Matrix.fromBlocks |
| 82 | (fun ac bd : I × I => R ac.1 ac.2 bd.1 bd.2) |
| 83 | (fun (ac : I × I) d => P ac.1 ac.2 d) |
| 84 | (fun c (bd : I × I) => P bd.1 bd.2 c) M).PosSemidef) |
| 85 | (V : I → ℝ) : |
| 86 | ∀ a, 0 ≤ M a a + 2 * (∑ i, P i a a * V i) + |
| 87 | ∑ i, ∑ k, R i a k a * V i * V k := by |
| 88 | apply hamilton_diagonal_nonneg_of_skew_quadratic_nonneg R P M hfirst hlast hP |
| 89 | intro U W hU |
| 90 | exact hamiltonBlock_quadratic_nonneg_of_posSemidef R P M hR hM hQ U W |
| 91 | |
| 92 | /-! The geometric consumer below packages the curvature symmetries and the |
| 93 | Hamilton tensor symmetries, leaving the noncompact maximum-principle producer |
| 94 | with only the block positive-semidefinite witness to establish. -/ |
| 95 | |
| 96 | universe u |
| 97 | |
| 98 | theorem hamilton_diagonal_nonneg_of_geometric_block |
| 99 | {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 100 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 101 | [IsManifold (𝓡 n) ∞ M] {J : Set ℝ} |
| 102 | (hC : RicciFlowCurvatureCalculus.{u}) (F : RicciFlow n M J) |
| 103 | {t : ℝ} (ht : t ∈ interior J) (τ : ℝ) |
| 104 | (x : M) (v : TangentSpace (𝓡 n) x) |
| 105 | (hQ : let eb := (F.metric t).orthonormalBasis x |
| 106 | (Matrix.fromBlocks |
| 107 | (fun ac bd : (Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) × |
| 108 | Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x))) => |
| 109 | (F.connection t).curvatureTensor x (eb ac.1) (eb ac.2) |
| 110 | (eb bd.1) (eb bd.2)) |
| 111 | (fun (ac : Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) × |
| 112 | Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x))) d => |
| 113 | hamiltonP (F.connection t) x (eb ac.1) (eb ac.2) (eb d)) |
| 114 | (fun c (bd : Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) × |
| 115 | Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x))) => |
| 116 | hamiltonP (F.connection t) x (eb bd.1) (eb bd.2) (eb c)) |
| 117 | (fun a b => hamiltonM (F.connection t) τ x (eb a) (eb b))).PosSemidef) : |
| 118 | ∀ a, 0 ≤ hamiltonM (F.connection t) τ x |
| 119 | ((F.metric t).orthonormalBasis x a) |
| 120 | ((F.metric t).orthonormalBasis x a) + |
| 121 | 2 * (∑ i, hamiltonP (F.connection t) x |
| 122 | ((F.metric t).orthonormalBasis x i) |
| 123 | ((F.metric t).orthonormalBasis x a) |
| 124 | ((F.metric t).orthonormalBasis x a) * |
| 125 | (F.metric t).inner x v ((F.metric t).orthonormalBasis x i)) + |
| 126 | (∑ i, ∑ k, (F.connection t).curvatureTensor x |
| 127 | ((F.metric t).orthonormalBasis x i) |
| 128 | ((F.metric t).orthonormalBasis x a) |
| 129 | ((F.metric t).orthonormalBasis x k) |
| 130 | ((F.metric t).orthonormalBasis x a) * |
| 131 | (F.metric t).inner x v ((F.metric t).orthonormalBasis x i) * |
| 132 | (F.metric t).inner x v ((F.metric t).orthonormalBasis x k)) := by |
| 133 | let g := F.metric t |
| 134 | let D := F.connection t |
| 135 | let eb := g.orthonormalBasis x |
| 136 | let I := Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) |
| 137 | let R : I → I → I → I → ℝ := fun i j k l => |
| 138 | D.curvatureTensor x (eb i) (eb j) (eb k) (eb l) |
| 139 | let P : I → I → I → ℝ := fun i j k => hamiltonP D x (eb i) (eb j) (eb k) |
| 140 | let M' : I → I → ℝ := fun i j => hamiltonM D τ x (eb i) (eb j) |
| 141 | have hcalc := hC.tensor_calculus n M g D |
| 142 | have hR : ∀ a b c d, R a b c d = R c d a b := by |
| 143 | intro a b c d |
| 144 | exact (hcalc.2.2.2.1 x (eb a) (eb b) (eb c) (eb d)).2.1 |
| 145 | have hfirst : ∀ a b c d, R a b c d = -R b a c d := by |
| 146 | intro a b c d |
| 147 | change D.curvatureTensor x (eb a) (eb b) (eb c) (eb d) = |
| 148 | -D.curvatureTensor x (eb b) (eb a) (eb c) (eb d) |
| 149 | have h₁ := (hcalc.2.2.2.1 x (eb a) (eb b) (eb c) (eb d)).2.1 |
| 150 | have h₂ := (hcalc.2.2.2.1 x (eb c) (eb d) (eb b) (eb a)).1 |
| 151 | have h₃ := (hcalc.2.2.2.1 x (eb b) (eb a) (eb c) (eb d)).2.1 |
| 152 | linarith |
| 153 | have hlast : ∀ a b c d, R a b c d = -R a b d c := by |
| 154 | intro a b c d |
| 155 | have hs := hcalc.2.2.2.1 x (eb a) (eb b) (eb c) (eb d) |
| 156 | change D.curvatureTensor x (eb a) (eb b) (eb c) (eb d) = |
| 157 | -D.curvatureTensor x (eb a) (eb b) (eb d) (eb c) |
| 158 | exact hs.1 |
| 159 | have hP : ∀ a b c, P a b c = -P b a c := by |
| 160 | intro a b c |
| 161 | exact hamiltonP_skew D x (eb a) (eb b) (eb c) |
| 162 | have hM : ∀ a b, M' a b = M' b a := by |
| 163 | intro a b |
| 164 | exact hamiltonM_symm_of_curvatureTheory hC J F t (interior_subset ht) τ x |
| 165 | (eb a) (eb b) |
| 166 | have hQ' : (Matrix.fromBlocks |
| 167 | (fun ac bd : I × I => R ac.1 ac.2 bd.1 bd.2) |
| 168 | (fun (ac : I × I) d => P ac.1 ac.2 d) |
| 169 | (fun c (bd : I × I) => P bd.1 bd.2 c) M').PosSemidef := by |
| 170 | simpa only [R, P, M', I, eb, g, D] using hQ |
| 171 | simpa only [R, P, M', I, eb, g, D] using |
| 172 | (hamilton_diagonal_nonneg_of_block_posSemidef R P M' hR hfirst hlast hP hM hQ' |
| 173 | (fun i => g.inner x v (eb i))) |
| 174 | |
| 175 | end Poincare.RicciFlow.Harnack |