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.Harnack.Matrix.Positivity.SpatialContact |
| 2 | import PoincareLib.Geometry.Riemannian.Tensor.MaximumPrinciple.Transport.Jets |
| 3 | |
| 4 | /-! |
| 5 | # Geometric spatial contact for tensor matrices |
| 6 | |
| 7 | Radial parallel fields identify the scalar derivatives of tensor-matrix |
| 8 | coefficients with their covariant derivatives. Tensor entries may have |
| 9 | different ranks, as in Hamilton's curvature, mixed, and two-tensor block. |
| 10 | The first derivatives of the test direction remain freely prescribed. |
| 11 | |
| 12 | This is the spatial contact calculation supporting Chow et al., Part II, |
| 13 | Theorem 15.16 and Section 15.4.5. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | set_option backward.isDefEq.respectTransparency false |
| 18 | |
| 19 | open scoped Manifold ContDiff Bundle Topology BigOperators |
| 20 | open Matrix Filter |
| 21 | |
| 22 | universe u |
| 23 | |
| 24 | namespace Poincare.RicciFlow.Harnack |
| 25 | |
| 26 | open PoincareMT |
| 27 | |
| 28 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 29 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 30 | {g : RiemannianMetric n M} |
| 31 | |
| 32 | /-- With zero first covariant jets, a tensor coefficient has its actual |
| 33 | covariant derivative as its scalar directional derivative. -/ |
| 34 | lemma covariantTensorDerivative_eq_mvfderiv_of_zero_jets |
| 35 | (D : LeviCivitaData g) {k : ℕ} {T : CovariantTensorEvaluation n M k} |
| 36 | (hT : IsSmoothCovariantTensor T) |
| 37 | (E : Fin k → (y : M) → TangentSpace (𝓡 n) y) (x : M) |
| 38 | (hE : ∀ i, ContMDiffAt (𝓡 n) ((𝓡 n).prod (𝓡 n)) ∞ (T% (E i)) x) |
| 39 | (hfirst : ∀ i a, D.connection (E i) x a = 0) |
| 40 | (a : TangentSpace (𝓡 n) x) : |
| 41 | D.covariantTensorDerivative T x (Fin.cons a (fun i => E i x)) = |
| 42 | mvfderiv (𝓡 n) (fun y => T y (fun i => E i y)) x a := by |
| 43 | obtain ⟨B, hB⟩ := hT.1 x |
| 44 | rw [D.covariantTensorDerivative_on_fields hT E x |
| 45 | (fun i => (hE i).mdifferentiableAt (by simp)) a] |
| 46 | simp only [hfirst, hB, B.map_update_zero, Finset.sum_const_zero, sub_zero] |
| 47 | |
| 48 | /-- A positive semidefinite matrix of geometric tensor coefficients has the |
| 49 | spatial null-contact inequality with arbitrary prescribed gradients of the |
| 50 | test direction. Each matrix entry can have its own tensor rank, but all |
| 51 | entries use the same local input family, encoded by `s`. The radial fields |
| 52 | and their vanishing covariant jets are constructed in the proof. -/ |
| 53 | theorem tensor_matrix_diffusion_nonneg_at_null [T2Space M] |
| 54 | {I J : Type} [Fintype I] |
| 55 | (D : LeviCivitaData g) (k : I → I → ℕ) |
| 56 | (T : (i j : I) → CovariantTensorEvaluation n M (k i j)) |
| 57 | (hT : ∀ i j, IsSmoothCovariantTensor (T i j)) |
| 58 | (s : (i j : I) → Fin (k i j) → J) |
| 59 | (x : M) (v : J → TangentSpace (𝓡 n) x) |
| 60 | (hpos : ∀ᶠ y in 𝓝 x, ∀ e : J → TangentSpace (𝓡 n) y, |
| 61 | Matrix.PosSemidef (fun i j => T i j y (fun l => e (s i j l)))) |
| 62 | (z : I → ℝ) |
| 63 | (hnull : z ⬝ᵥ ((fun i j => T i j x (fun l => v (s i j l))) *ᵥ z) = 0) |
| 64 | (V : I → TangentSpace (𝓡 n) x) : |
| 65 | 0 ≤ (∑ i, ∑ j, z i * D.tensorLaplacian (T i j) x |
| 66 | (fun l => v (s i j l)) * z j) + |
| 67 | 4 * (∑ i, ∑ j, z i * D.covariantTensorDerivative (T i j) x |
| 68 | (Fin.cons (V j) (fun l => v (s i j l)))) + |
| 69 | 2 * (∑ i, ∑ j, |
| 70 | T i j x (fun l => v (s i j l)) * g.inner x (V i) (V j)) := by |
| 71 | classical |
| 72 | choose r Y hr hrU hY hinit hparallel hfirst hsecond using |
| 73 | fun j => D.exists_radialParallelField x (v j) |
| 74 | let E := fun j => LeviCivitaData.fieldFromCenteredCoordinates x (Y j) |
| 75 | let A : M → Matrix I I ℝ := fun y i j => T i j y (fun l => E (s i j l) y) |
| 76 | have hE (j : J) (y : M) (hy : y ∈ (extChartAt (𝓡 n) x).source) : |
| 77 | ContMDiffAt (𝓡 n) ((𝓡 n).prod (𝓡 n)) ∞ (T% (E j)) y := |
| 78 | LeviCivitaData.contMDiffAt_fieldFromCenteredCoordinates x (hY j).contDiffAt hy |
| 79 | have hA (i j : I) : ContMDiffOn (𝓡 n) 𝓘(ℝ, ℝ) ∞ |
| 80 | (fun y => A y i j) (extChartAt (𝓡 n) x).source := |
| 81 | (hT i j).2 _ (isOpen_extChartAt_source x) _ |
| 82 | (fun l y hy => (hE (s i j l) y hy).contMDiffWithinAt) |
| 83 | have hpositive : ∀ᶠ y in 𝓝 x, (A y).PosSemidef := by |
| 84 | filter_upwards [hpos] with y hy |
| 85 | exact hy (fun j => E j y) |
| 86 | have hvalue (i j : I) : A x i j = T i j x (fun l => v (s i j l)) := by |
| 87 | simp only [A, E, hinit] |
| 88 | have hnullA : z ⬝ᵥ (A x *ᵥ z) = 0 := by |
| 89 | simpa only [dotProduct, mulVec, hvalue] using hnull |
| 90 | have hlap (i j : I) : D.laplacian (fun y => A y i j) x = |
| 91 | D.tensorLaplacian (T i j) x (fun l => v (s i j l)) := by |
| 92 | have h := D.tensorLaplacian_eq_laplacian_of_zero_jets (hT i j) |
| 93 | (fun l => E (s i j l)) x |
| 94 | (fun l => hE (s i j l) x (mem_extChartAt_source x)) |
| 95 | (fun l => hfirst (s i j l)) (fun l => hsecond (s i j l)) |
| 96 | simpa only [E, hinit] using h.symm |
| 97 | have hder (i j : I) (a : TangentSpace (𝓡 n) x) : |
| 98 | mvfderiv (𝓡 n) (fun y => A y i j) x a = |
| 99 | D.covariantTensorDerivative (T i j) x |
| 100 | (Fin.cons a (fun l => v (s i j l))) := by |
| 101 | have h := covariantTensorDerivative_eq_mvfderiv_of_zero_jets D (hT i j) |
| 102 | (fun l => E (s i j l)) x |
| 103 | (fun l => hE (s i j l) x (mem_extChartAt_source x)) |
| 104 | (fun l => hfirst (s i j l)) a |
| 105 | simpa only [E, hinit] using h.symm |
| 106 | have h := quadratic_diffusion_nonneg_of_prescribed_gradients D |
| 107 | (isOpen_extChartAt_source x) hA (mem_extChartAt_source x) hpositive z hnullA V |
| 108 | have hright (i j : I) : |
| 109 | g.inner x (V i) (D.gradient (fun y => A y i j) x) = |
| 110 | D.covariantTensorDerivative (T i j) x |
| 111 | (Fin.cons (V i) (fun l => v (s i j l))) := by |
| 112 | rw [g.symm, D.inner_gradient, hder] |
| 113 | simp only [hlap, D.inner_gradient, hder, hright, hvalue, |
| 114 | Finset.sum_add_distrib] at h |
| 115 | have hsym (i j : I) (a : TangentSpace (𝓡 n) x) : |
| 116 | D.covariantTensorDerivative (T i j) x |
| 117 | (Fin.cons a (fun l => v (s i j l))) = |
| 118 | D.covariantTensorDerivative (T j i) x |
| 119 | (Fin.cons a (fun l => v (s j i l))) := by |
| 120 | rw [← hder, ← hder] |
| 121 | have heq : (fun y => A y i j) =ᶠ[𝓝 x] (fun y => A y j i) := by |
| 122 | filter_upwards [hpositive] with y hy |
| 123 | simpa only [star_trivial] using hy.1.apply j i |
| 124 | rw [Poincare.mvfderiv_eq_of_eventuallyEq heq] |
| 125 | have hswap : (∑ i, ∑ j, z j * D.covariantTensorDerivative (T i j) x |
| 126 | (Fin.cons (V i) (fun l => v (s i j l)))) = |
| 127 | ∑ i, ∑ j, z i * D.covariantTensorDerivative (T i j) x |
| 128 | (Fin.cons (V j) (fun l => v (s i j l))) := by |
| 129 | rw [Finset.sum_comm] |
| 130 | simp_rw [hsym] |
| 131 | rw [hswap] at h |
| 132 | linarith only [h] |
| 133 | |
| 134 | end Poincare.RicciFlow.Harnack |