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.Positivity.Sectional.Rayleigh |
| 2 | import PoincareLib.Geometry.RicciFlow.Positivity.Sectional.NullMinimum |
| 3 | import PoincareLib.Geometry.RicciFlow.Curvature.Calculus.Identities.CurvatureSymmetries |
| 4 | |
| 5 | /-! Adapted from Mapher06/Poincare-MorganTian, `PoincareMT/Proofs/M04/SectionalMinimumDiffusion.lean`, |
| 6 | revision `f927d9e1f0810042766d3b5f64d3f4da02ee93cc`. See the curvature import record under |
| 7 | `references/ricci-flow/mapher/curvature/`. -/ |
| 8 | |
| 9 | /-! |
| 10 | # Diffusion at a minimum sectional Rayleigh quotient |
| 11 | |
| 12 | The actual metric Gram tensor is parallel. Its subtraction preserves the |
| 13 | curvature Laplacian and produces the tensor used in the null-plane test. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | |
| 18 | open scoped Manifold ContDiff Bundle |
| 19 | open Set |
| 20 | |
| 21 | universe u |
| 22 | |
| 23 | namespace PoincareMT.RicciFlowAnalysis |
| 24 | |
| 25 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 26 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 27 | {g : RiemannianMetric n M} |
| 28 | |
| 29 | set_option maxHeartbeats 2000000 in |
| 30 | -- The Gram-tensor product rule and metric-compatibility traces need extra elaboration. |
| 31 | set_option backward.isDefEq.respectTransparency false in |
| 32 | theorem covariantTensorDerivative_metricGramEvaluation (D : LeviCivitaData g) : |
| 33 | D.covariantTensorDerivative (metricGramEvaluation g) = 0 := by |
| 34 | classical |
| 35 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 36 | ⟨g.toRiemannianMetric⟩ |
| 37 | funext y v |
| 38 | let E := EuclideanSpace ℝ (Fin n) |
| 39 | let e := trivializationAt E (TangentSpace (𝓡 n) : M → Type _) y |
| 40 | have hy : y ∈ e.baseSet := FiberBundle.mem_baseSet_trivializationAt' y |
| 41 | let X : Fin 4 → (z : M) → TangentSpace (𝓡 n) z := |
| 42 | fun i ↦ FiberBundle.extend E (v i.succ) |
| 43 | have hX (i : Fin 4) : ContMDiffAt (𝓡 n) ((𝓡 n).prod 𝓘(ℝ, E)) ∞ (T% (X i)) y := |
| 44 | (contMDiffOn_extend_baseSet (v i.succ)).contMDiffAt (e.open_baseSet.mem_nhds hy) |
| 45 | let k (i j : Fin 4) : M → ℝ := fun z ↦ g.inner z (X i z) (X j z) |
| 46 | have hk (i j : Fin 4) : MDifferentiableAt (𝓡 n) 𝓘(ℝ, ℝ) (k i j) y := |
| 47 | ((hX i).inner_bundle (hX j)).mdifferentiableAt (by simp) |
| 48 | have hkval (i j : Fin 4) : k i j y = g.inner y (v i.succ) (v j.succ) := by |
| 49 | simp only [k, X, FiberBundle.extend_apply_self] |
| 50 | have hmetric (i j : Fin 4) : mvfderiv (𝓡 n) (k i j) y (v 0) = |
| 51 | g.inner y (D.connection (X i) y (v 0)) (v j.succ) + |
| 52 | g.inner y (v i.succ) (D.connection (X j) y (v 0)) := by |
| 53 | simpa only [X, FiberBundle.extend_apply_self] using! |
| 54 | metric_derivative_pairing D (FiberBundle.extend E (v 0)) |
| 55 | ((hX i).mdifferentiableAt (by simp)) ((hX j).mdifferentiableAt (by simp)) |
| 56 | change mvfderiv (𝓡 n) (fun z ↦ k 0 2 z * k 1 3 z - k 0 3 z * k 1 2 z) y (v 0) - |
| 57 | ∑ i : Fin 4, metricGramEvaluation g y |
| 58 | (Function.update (fun j ↦ v j.succ) i (D.connection (X i) y (v 0))) = 0 |
| 59 | have hsub := mvfderiv_fun_sub ((hk 0 2).mul (hk 1 3)) ((hk 0 3).mul (hk 1 2)) |
| 60 | simp only [Pi.mul_def] at hsub |
| 61 | rw [hsub, mvfderiv_fun_mul (hk 0 2) (hk 1 3), mvfderiv_fun_mul (hk 0 3) (hk 1 2)] |
| 62 | simp only [sub_apply, add_apply, smul_apply, smul_eq_mul, hmetric, hkval] |
| 63 | simp [metricGramEvaluation, Fin.sum_univ_succ, Function.update] |
| 64 | ring |
| 65 | |
| 66 | set_option maxHeartbeats 2400000 in |
| 67 | -- The shifted sectional tensor and null-plane diffusion bound need extra elaboration. |
| 68 | set_option backward.isDefEq.respectTransparency false in |
| 69 | theorem curvature_tensorLaplacian_nonneg_at_sectional_rayleigh_min |
| 70 | (D : LeviCivitaData g) (m : ℝ) |
| 71 | (hmin : ∀ (y : M) (a b : TangentSpace (𝓡 n) y), |
| 72 | m * metricGram g y a b ≤ D.curvatureTensor y a b a b) |
| 73 | (x : M) (u v : TangentSpace (𝓡 n) x) |
| 74 | (hnull : D.curvatureTensor x u v u v = m * metricGram g x u v) : |
| 75 | 0 ≤ D.tensorLaplacian D.riemannEvaluation x ![u, v, u, v] := by |
| 76 | classical |
| 77 | let G := metricGramEvaluation g |
| 78 | have hG : IsSmoothCovariantTensor G := isSmoothCovariantTensor_metricGramEvaluation g |
| 79 | have hR : IsSmoothCovariantTensor D.riemannEvaluation := |
| 80 | isSmoothCovariantTensor_riemannEvaluation D |
| 81 | let S : CovariantTensorEvaluation n M 4 := fun y w ↦ D.riemannEvaluation y w - m * G y w |
| 82 | have hS : IsSmoothCovariantTensor S := by |
| 83 | constructor |
| 84 | · intro y |
| 85 | obtain ⟨A, hA⟩ := hR.1 y |
| 86 | obtain ⟨B, hB⟩ := hG.1 y |
| 87 | refine ⟨A - m • B, ?_⟩ |
| 88 | intro w |
| 89 | simp only [S, hA, hB, sub_apply, smul_apply, smul_eq_mul] |
| 90 | · intro U hU X hX |
| 91 | exact (hR.2 U hU X hX).sub (contMDiffOn_const.mul (hG.2 U hU X hX)) |
| 92 | have hline (y : M) (w : Fin 5 → TangentSpace (𝓡 n) y) : |
| 93 | D.covariantTensorDerivative S y w = |
| 94 | D.covariantTensorDerivative D.riemannEvaluation y w - |
| 95 | m * D.covariantTensorDerivative G y w := by |
| 96 | let E := EuclideanSpace ℝ (Fin n) |
| 97 | let e := trivializationAt E (TangentSpace (𝓡 n) : M → Type _) y |
| 98 | have hy : y ∈ e.baseSet := FiberBundle.mem_baseSet_trivializationAt' y |
| 99 | let X : Fin 4 → (z : M) → TangentSpace (𝓡 n) z := |
| 100 | fun i ↦ FiberBundle.extend E (w i.succ) |
| 101 | have hX (i : Fin 4) : ContMDiffOn (𝓡 n) ((𝓡 n).prod 𝓘(ℝ, E)) ∞ |
| 102 | (T% (X i)) e.baseSet := contMDiffOn_extend_baseSet (w i.succ) |
| 103 | let f : M → ℝ := fun z ↦ D.riemannEvaluation z (fun i ↦ X i z) |
| 104 | let k : M → ℝ := fun z ↦ G z (fun i ↦ X i z) |
| 105 | have hf : MDifferentiableAt (𝓡 n) 𝓘(ℝ, ℝ) f y := |
| 106 | ((hR.2 e.baseSet e.open_baseSet X hX).contMDiffAt |
| 107 | (e.open_baseSet.mem_nhds hy)).mdifferentiableAt (by simp) |
| 108 | have hk : MDifferentiableAt (𝓡 n) 𝓘(ℝ, ℝ) k y := |
| 109 | ((hG.2 e.baseSet e.open_baseSet X hX).contMDiffAt |
| 110 | (e.open_baseSet.mem_nhds hy)).mdifferentiableAt (by simp) |
| 111 | have hmk : mvfderiv (𝓡 n) (fun z ↦ m * k z) y = m • mvfderiv (𝓡 n) k y := by |
| 112 | rw [mvfderiv_fun_mul mdifferentiableAt_const hk] |
| 113 | simp only [mvfderiv_const, smul_zero, add_zero] |
| 114 | have hsub : mvfderiv (𝓡 n) (fun z ↦ f z - m * k z) y = |
| 115 | mvfderiv (𝓡 n) f y - m • mvfderiv (𝓡 n) k y := by |
| 116 | have h := mvfderiv_fun_sub hf ((mdifferentiableAt_const (c := m)).mul hk) |
| 117 | simpa only [Pi.mul_def, hmk] using! h |
| 118 | let C (i : Fin 4) := Function.update (fun j ↦ w j.succ) i (D.connection (X i) y (w 0)) |
| 119 | change mvfderiv (𝓡 n) (fun z ↦ f z - m * k z) y (w 0) - |
| 120 | (∑ i, (D.riemannEvaluation y (C i) - m * G y (C i))) = |
| 121 | (mvfderiv (𝓡 n) f y (w 0) - ∑ i, D.riemannEvaluation y (C i)) - |
| 122 | m * (mvfderiv (𝓡 n) k y (w 0) - ∑ i, G y (C i)) |
| 123 | rw [hsub] |
| 124 | simp only [sub_apply, smul_apply, smul_eq_mul, Finset.sum_sub_distrib, ← Finset.mul_sum] |
| 125 | ring |
| 126 | have hfirst : D.covariantTensorDerivative S = |
| 127 | D.covariantTensorDerivative D.riemannEvaluation := by |
| 128 | funext y w |
| 129 | have hz : D.covariantTensorDerivative G y w = 0 := |
| 130 | congrFun (congrFun (covariantTensorDerivative_metricGramEvaluation D) y) w |
| 131 | simpa only [hz, mul_zero, sub_zero] using hline y w |
| 132 | have hsecond : D.iteratedCovariantTensorDerivative S 2 = |
| 133 | D.iteratedCovariantTensorDerivative D.riemannEvaluation 2 := by |
| 134 | simp only [LeviCivitaData.iteratedCovariantTensorDerivative, hfirst] |
| 135 | have hLap : D.tensorLaplacian S = D.tensorLaplacian D.riemannEvaluation := by |
| 136 | funext y w |
| 137 | simp only [LeviCivitaData.tensorLaplacian, hsecond] |
| 138 | have hpair (a b c d : TangentSpace (𝓡 n) x) : |
| 139 | S x ![a, b, c, d] = S x ![c, d, a, b] := by |
| 140 | change D.curvatureTensor x a b c d - m * |
| 141 | (g.inner x a c * g.inner x b d - g.inner x a d * g.inner x b c) = |
| 142 | D.curvatureTensor x c d a b - m * |
| 143 | (g.inner x c a * g.inner x d b - g.inner x c b * g.inner x d a) |
| 144 | rw [curvatureTensor_pair_exchange D x a b c d, |
| 145 | g.symm x c a, g.symm x d b, g.symm x c b, g.symm x d a] |
| 146 | ring |
| 147 | have hdiag (y : M) (a b : TangentSpace (𝓡 n) y) : |
| 148 | S y ![a, b, a, b] = D.curvatureTensor y a b a b - m * metricGram g y a b := by |
| 149 | change D.curvatureTensor y a b a b - m * |
| 150 | (g.inner y a a * g.inner y b b - g.inner y a b * g.inner y b a) = _ |
| 151 | rw [g.symm y b a] |
| 152 | simp only [metricGram, pow_two] |
| 153 | rw [← hLap] |
| 154 | apply tensorLaplacian_nonneg_at_sectional_null D hS isOpen_univ (mem_univ x) hpair |
| 155 | (fun y _ a b ↦ by rw [hdiag]; exact sub_nonneg.mpr (hmin y a b)) u v |
| 156 | rw [hdiag] |
| 157 | exact sub_eq_zero.mpr hnull |
| 158 | |
| 159 | end PoincareMT.RicciFlowAnalysis |
| 160 |