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.Normalization |
| 3 | import PoincareLib.Geometry.RicciFlow.Harnack.Matrix.Positivity.BlockContact |
| 4 | import PoincareLib.Geometry.RicciFlow.Harnack.Matrix.Positivity.PerturbedSpatialContact |
| 5 | |
| 6 | /-! |
| 7 | # Positivity from a fixed reference frame |
| 8 | |
| 9 | Normalized tests in orthonormal frames of an arbitrary reference metric |
| 10 | recover the actual Hamilton block in the evolving metric's canonical basis. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | set_option backward.isDefEq.respectTransparency false |
| 15 | |
| 16 | open scoped Manifold ContDiff Bundle BigOperators |
| 17 | |
| 18 | namespace Poincare.RicciFlow.Harnack |
| 19 | |
| 20 | open PoincareMT |
| 21 | |
| 22 | universe u |
| 23 | |
| 24 | variable {n : ℕ} {N : Type u} [TopologicalSpace N] |
| 25 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) N] [IsManifold (𝓡 n) ∞ N] |
| 26 | |
| 27 | /-- Unit skew tests in reference orthonormal frames recover a tensor block |
| 28 | on every finite family of tangent inputs. -/ |
| 29 | theorem tensor_block_posSemidef_of_reference_unit_tests |
| 30 | {I : Type*} [Fintype I] (g : RiemannianMetric n N) |
| 31 | {R : CovariantTensorEvaluation n N 4} {P : CovariantTensorEvaluation n N 3} |
| 32 | {B : CovariantTensorEvaluation n N 2} |
| 33 | (hR : IsSmoothCovariantTensor R) (hP : IsSmoothCovariantTensor P) |
| 34 | (hB : IsSmoothCovariantTensor B) (x : N) |
| 35 | (hpair : ∀ a b c d, R x ![a, b, c, d] = R x ![c, d, a, b]) |
| 36 | (hfirst : ∀ a b c d, R x ![a, b, c, d] = -R x ![b, a, c, d]) |
| 37 | (hlast : ∀ a b c d, R x ![a, b, c, d] = -R x ![a, b, d, c]) |
| 38 | (hskew : ∀ a b c, P x ![a, b, c] = -P x ![b, a, c]) |
| 39 | (hsymm : ∀ a b, B x ![a, b] = B x ![b, a]) |
| 40 | (hunit : letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : N → Type _) := |
| 41 | ⟨g.toRiemannianMetric⟩ |
| 42 | ∀ (e : Fin n → TangentSpace (𝓡 n) x), Orthonormal ℝ e → |
| 43 | ∀ z : EuclideanSpace ℝ ((Fin n × Fin n) ⊕ Fin n), ‖z‖ = 1 → |
| 44 | (∀ a b, z (Sum.inl (a, b)) = -z (Sum.inl (b, a))) → |
| 45 | 0 ≤ (∑ a, ∑ b, B x ![e a, e b] * z (Sum.inr a) * z (Sum.inr b)) + |
| 46 | 2 * (∑ a, ∑ b, ∑ c, P x ![e a, e b, e c] * |
| 47 | z (Sum.inl (a, b)) * z (Sum.inr c)) + |
| 48 | (∑ a, ∑ b, ∑ c, ∑ d, R x ![e a, e b, e c, e d] * |
| 49 | z (Sum.inl (a, b)) * z (Sum.inl (c, d)))) |
| 50 | (e : I → TangentSpace (𝓡 n) x) : |
| 51 | (Matrix.fromBlocks (fun ac bd : I × I => R x ![e ac.1, e ac.2, e bd.1, e bd.2]) |
| 52 | (fun ac d => P x ![e ac.1, e ac.2, e d]) |
| 53 | (fun c bd => P x ![e bd.1, e bd.2, e c]) |
| 54 | (fun a b => B x ![e a, e b])).PosSemidef := by |
| 55 | classical |
| 56 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : N → Type _) := |
| 57 | ⟨g.toRiemannianMetric⟩ |
| 58 | have hdim : Module.finrank ℝ (TangentSpace (𝓡 n) x) = n := finrank_euclideanSpace_fin |
| 59 | let ι := finCongr hdim |
| 60 | let b := (g.orthonormalBasis x).reindex ι |
| 61 | have hp := hamiltonBlock_posSemidef_of_unit_skew_quadratic_nonneg |
| 62 | (fun a c d f => R x ![b a, b c, b d, b f]) |
| 63 | (fun a c d => P x ![b a, b c, b d]) (fun a c => B x ![b a, b c]) |
| 64 | (fun _ _ _ _ => hpair _ _ _ _) (fun _ _ _ _ => hfirst _ _ _ _) |
| 65 | (fun _ _ _ _ => hlast _ _ _ _) (fun _ _ _ => hskew _ _ _) |
| 66 | (fun _ _ => hsymm _ _) (hunit b b.orthonormal) |
| 67 | let σ := Equiv.sumCongr (Equiv.prodCongr ι ι) ι |
| 68 | have hp' := hp.submatrix σ |
| 69 | apply tensor_block_posSemidef_of_basis g hR hP hB x ?_ e |
| 70 | convert hp' using 1 |
| 71 | ext (ac | a) (bd | d) <;> |
| 72 | simp only [Matrix.submatrix_apply, Matrix.fromBlocks_apply₁₁, |
| 73 | Matrix.fromBlocks_apply₁₂, Matrix.fromBlocks_apply₂₁, Matrix.fromBlocks_apply₂₂, |
| 74 | σ, Equiv.sumCongr_apply, Equiv.prodCongr_apply, Prod.map_fst, Prod.map_snd, |
| 75 | Sum.map_inl, Sum.map_inr, b, OrthonormalBasis.reindex_apply, Equiv.symm_apply_apply] |
| 76 | |
| 77 | /-- Reference-frame tests of the actual perturbed Hamilton quadratic imply |
| 78 | positivity of its block in the current metric's canonical orthonormal basis. -/ |
| 79 | theorem perturbedHamiltonBlock_posSemidef_of_reference_unit_tests |
| 80 | (hC : RicciFlowCurvatureCalculus.{u}) {J : Set ℝ} |
| 81 | (F : RicciFlow n N J) (g : RiemannianMetric n N) |
| 82 | {t : ℝ} (ht : t ∈ interior J) (τ : ℝ) (x : N) |
| 83 | (α : N → ℝ) (hα : ContMDiff (𝓡 n) 𝓘(ℝ, ℝ) ∞ α) (ψ : ℝ) |
| 84 | (hunit : letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : N → Type _) := |
| 85 | ⟨g.toRiemannianMetric⟩ |
| 86 | ∀ (e : Fin n → TangentSpace (𝓡 n) x), Orthonormal ℝ e → |
| 87 | ∀ z : EuclideanSpace ℝ ((Fin n × Fin n) ⊕ Fin n), ‖z‖ = 1 → |
| 88 | (∀ a b, z (Sum.inl (a, b)) = -z (Sum.inl (b, a))) → |
| 89 | 0 ≤ (∑ a, ∑ b, |
| 90 | (hamiltonM (F.connection t) τ x (e a) (e b) + |
| 91 | α x * (F.metric t).inner x (e a) (e b)) * z (Sum.inr a) * z (Sum.inr b)) + |
| 92 | 2 * (∑ a, ∑ b, ∑ c, hamiltonP (F.connection t) x (e a) (e b) (e c) * |
| 93 | z (Sum.inl (a, b)) * z (Sum.inr c)) + |
| 94 | (∑ a, ∑ b, ∑ c, ∑ d, |
| 95 | ((F.connection t).curvatureTensor x (e a) (e b) (e c) (e d) + |
| 96 | ψ * metricTwoFormIdentity (F.metric t) x ![e a, e b, e c, e d]) * |
| 97 | z (Sum.inl (a, b)) * z (Sum.inl (c, d)))) : |
| 98 | let b := (F.metric t).orthonormalBasis x |
| 99 | (Matrix.fromBlocks |
| 100 | (fun ac de : Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) × |
| 101 | Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) => |
| 102 | (F.connection t).curvatureTensor x (b ac.1) (b ac.2) (b de.1) (b de.2) + |
| 103 | ψ * twoFormIdentity ac.1 ac.2 de.1 de.2) |
| 104 | (fun ac d => hamiltonP (F.connection t) x (b ac.1) (b ac.2) (b d)) |
| 105 | (fun c de => hamiltonP (F.connection t) x (b de.1) (b de.2) (b c)) |
| 106 | (fun a c => hamiltonM (F.connection t) τ x (b a) (b c) + |
| 107 | α x * (if a = c then 1 else 0))).PosSemidef := by |
| 108 | let D := F.connection t |
| 109 | have hD := hC.tensor_calculus n N (F.metric t) D |
| 110 | let R : CovariantTensorEvaluation n N 4 := fun y v => |
| 111 | D.riemannEvaluation y v + ψ * metricTwoFormIdentity (F.metric t) y v |
| 112 | let P : CovariantTensorEvaluation n N 3 := fun y v => |
| 113 | hamiltonP D y (v 0) (v 1) (v 2) |
| 114 | let B : CovariantTensorEvaluation n N 2 := fun y v => |
| 115 | hamiltonM D τ y (v 0) (v 1) + α y * (F.metric t).inner y (v 0) (v 1) |
| 116 | have hR : IsSmoothCovariantTensor R := |
| 117 | hD.1.add ((metricTwoFormIdentity_isSmooth (F.metric t)).const_mul ψ) |
| 118 | have hP : IsSmoothCovariantTensor P := hamiltonP_isSmoothCovariantTensor D hD |
| 119 | have hB : IsSmoothCovariantTensor B := |
| 120 | (hamiltonM_isSmoothCovariantTensor D hD τ).add |
| 121 | (scalar_metric_isSmoothCovariantTensor (g := F.metric t) hα) |
| 122 | have hpair (a b c d) : R x ![a, b, c, d] = R x ![c, d, a, b] := by |
| 123 | change D.curvatureTensor x a b c d + ψ * metricTwoFormIdentity (F.metric t) x ![a, b, c, d] = |
| 124 | D.curvatureTensor x c d a b + ψ * metricTwoFormIdentity (F.metric t) x ![c, d, a, b] |
| 125 | rw [(hD.2.2.2.1 x a b c d).2.1] |
| 126 | congr 1 |
| 127 | simp only [metricTwoFormIdentity, Matrix.cons_val_zero, Matrix.cons_val_one, |
| 128 | Matrix.cons_val_two, Matrix.cons_val_three, Matrix.head_cons, Matrix.tail_cons] |
| 129 | rw [(F.metric t).symm x c a, (F.metric t).symm x d b, |
| 130 | (F.metric t).symm x c b, (F.metric t).symm x d a] |
| 131 | ring |
| 132 | have hlast (a b c d) : R x ![a, b, c, d] = -R x ![a, b, d, c] := by |
| 133 | change D.curvatureTensor x a b c d + ψ * metricTwoFormIdentity (F.metric t) x ![a, b, c, d] = |
| 134 | -(D.curvatureTensor x a b d c + ψ * metricTwoFormIdentity (F.metric t) x ![a, b, d, c]) |
| 135 | rw [(hD.2.2.2.1 x a b c d).1] |
| 136 | simp only [metricTwoFormIdentity, Matrix.cons_val_zero, Matrix.cons_val_one, |
| 137 | Matrix.cons_val_two, Matrix.cons_val_three, Matrix.head_cons, Matrix.tail_cons] |
| 138 | ring |
| 139 | have hfirst (a b c d) : R x ![a, b, c, d] = -R x ![b, a, c, d] := by |
| 140 | rw [hpair, hlast, hpair] |
| 141 | have hp (a b c) : P x ![a, b, c] = -P x ![b, a, c] := |
| 142 | hamiltonP_skew D x a b c |
| 143 | have hb (a b) : B x ![a, b] = B x ![b, a] := by |
| 144 | change hamiltonM D τ x a b + α x * (F.metric t).inner x a b = |
| 145 | hamiltonM D τ x b a + α x * (F.metric t).inner x b a |
| 146 | rw [hamiltonM_symm_of_curvatureTheory hC J F t (interior_subset ht) τ x a b, |
| 147 | (F.metric t).symm x a b] |
| 148 | have h := tensor_block_posSemidef_of_reference_unit_tests g hR hP hB x |
| 149 | hpair hfirst hlast hp hb hunit ((F.metric t).orthonormalBasis x) |
| 150 | simpa only [R, P, B, D, LeviCivitaData.riemannEvaluation, |
| 151 | Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val_two, Matrix.cons_val_three, |
| 152 | Matrix.head_cons, Matrix.tail_cons, |
| 153 | metricTwoFormIdentity_orthonormalBasis, metric_inner_orthonormalBasis] using h |
| 154 | |
| 155 | /-- Unit tests in frames orthonormal for one reference metric imply |
| 156 | positivity of the geometric Hamilton block for the current flow metric. -/ |
| 157 | theorem hamiltonBlockPos_of_reference_unit_tests |
| 158 | (hC : RicciFlowCurvatureCalculus.{u}) {T₀ T₁ : ℝ} |
| 159 | (F : RicciFlow n N (Set.Ioo T₀ T₁)) |
| 160 | (g : RiemannianMetric n N) {t : ℝ} (ht : t ∈ Set.Ioo T₀ T₁) (τ : ℝ) (x : N) |
| 161 | (hunit : letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : N → Type _) := |
| 162 | ⟨g.toRiemannianMetric⟩ |
| 163 | ∀ (e : Fin n → TangentSpace (𝓡 n) x), Orthonormal ℝ e → |
| 164 | ∀ z : EuclideanSpace ℝ ((Fin n × Fin n) ⊕ Fin n), ‖z‖ = 1 → |
| 165 | (∀ a b, z (Sum.inl (a, b)) = -z (Sum.inl (b, a))) → |
| 166 | 0 ≤ (∑ a, ∑ b, |
| 167 | hamiltonM (F.connection t) τ x (e a) (e b) * z (Sum.inr a) * z (Sum.inr b)) + |
| 168 | 2 * (∑ a, ∑ b, ∑ c, hamiltonP (F.connection t) x (e a) (e b) (e c) * |
| 169 | z (Sum.inl (a, b)) * z (Sum.inr c)) + |
| 170 | (∑ a, ∑ b, ∑ c, ∑ d, |
| 171 | (F.connection t).curvatureTensor x (e a) (e b) (e c) (e d) * |
| 172 | z (Sum.inl (a, b)) * z (Sum.inl (c, d)))) : |
| 173 | HamiltonBlockPos F t x τ := by |
| 174 | classical |
| 175 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : N → Type _) := |
| 176 | ⟨g.toRiemannianMetric⟩ |
| 177 | let D := F.connection t |
| 178 | have hD := hC.tensor_calculus n N (F.metric t) D |
| 179 | have hdim : Module.finrank ℝ (TangentSpace (𝓡 n) x) = n := finrank_euclideanSpace_fin |
| 180 | let ι := finCongr hdim |
| 181 | let b := (g.orthonormalBasis x).reindex ι |
| 182 | let R := fun a c d e => D.curvatureTensor x (b a) (b c) (b d) (b e) |
| 183 | let P := fun a c d => hamiltonP D x (b a) (b c) (b d) |
| 184 | let B := fun a c => hamiltonM D τ x (b a) (b c) |
| 185 | have hpair (a c d e) : R a c d e = R d e a c := |
| 186 | (hD.2.2.2.1 x _ _ _ _).2.1 |
| 187 | have hlast (a c d e) : R a c d e = -R a c e d := |
| 188 | (hD.2.2.2.1 x _ _ _ _).1 |
| 189 | have hfirst (a c d e) : R a c d e = -R c a d e := by |
| 190 | rw [hpair, hlast, hpair] |
| 191 | have hp (a c d) : P a c d = -P c a d := hamiltonP_skew D x _ _ _ |
| 192 | have hb (a c) : B a c = B c a := |
| 193 | hamiltonM_symm_of_curvatureTheory hC (Set.Ioo T₀ T₁) F t ht τ x _ _ |
| 194 | have hpos := hamiltonBlock_posSemidef_of_unit_skew_quadratic_nonneg R P B |
| 195 | hpair hfirst hlast hp hb (hunit b b.orthonormal) |
| 196 | let σ := Equiv.sumCongr (Equiv.prodCongr ι ι) ι |
| 197 | have hpos' := hpos.submatrix σ |
| 198 | have hB := hamiltonM_isSmoothCovariantTensor D hD τ |
| 199 | have hP := hamiltonP_isSmoothCovariantTensor D hD |
| 200 | apply tensor_block_posSemidef_of_basis g hD.1 hP hB x ?_ |
| 201 | ((F.metric t).orthonormalBasis x) |
| 202 | convert hpos' using 1 |
| 203 | ext (ac | a) (bd | d) <;> |
| 204 | simp only [Matrix.submatrix_apply, Matrix.fromBlocks_apply₁₁, |
| 205 | Matrix.fromBlocks_apply₁₂, Matrix.fromBlocks_apply₂₁, Matrix.fromBlocks_apply₂₂, |
| 206 | σ, Equiv.sumCongr_apply, Equiv.prodCongr_apply, Prod.map_fst, Prod.map_snd, |
| 207 | Sum.map_inl, Sum.map_inr, |
| 208 | R, P, B, b, OrthonormalBasis.reindex_apply, Equiv.symm_apply_apply, |
| 209 | LeviCivitaData.riemannEvaluation, Matrix.cons_val_zero, Matrix.cons_val_one, |
| 210 | Matrix.cons_val_two, Matrix.cons_val_three, Matrix.head_cons, Matrix.tail_cons] |
| 211 | |
| 212 | end Poincare.RicciFlow.Harnack |