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.Trace |
| 3 | import PoincareLib.Geometry.RicciFlow.Harnack.Matrix.Positivity.Diagonal |
| 4 | import PoincareLib.Geometry.Riemannian.Tensor.MetricDuality |
| 5 | |
| 6 | /-! |
| 7 | # Finite differential Harnack assembly |
| 8 | |
| 9 | The noncompact maximum-principle proof constructs a positive-semidefinite |
| 10 | Hamilton block on each time slice. This module keeps that geometric producer |
| 11 | separate from the exact scalar-field assembly: once the block witness is |
| 12 | available, the diagonal extraction and trace identity give the frozen finite |
| 13 | differential field without any additional hypotheses. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | |
| 18 | open scoped Manifold ContDiff Bundle BigOperators |
| 19 | open Set |
| 20 | |
| 21 | universe u |
| 22 | |
| 23 | namespace Poincare.RicciFlow.Harnack |
| 24 | |
| 25 | open PoincareMT |
| 26 | |
| 27 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 28 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 29 | [IsManifold (𝓡 n) ∞ M] |
| 30 | |
| 31 | /- The block witness is supplied by the finite noncompact producer. -/ |
| 32 | def HamiltonBlockPos |
| 33 | {T₀ T₁ : ℝ} (F : RicciFlow n M (Ioo T₀ T₁)) (t : ℝ) (x : M) |
| 34 | (τ : ℝ) : Prop := |
| 35 | let eb := (F.metric t).orthonormalBasis x |
| 36 | (Matrix.fromBlocks |
| 37 | (fun ac bd : (Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) × |
| 38 | Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x))) => |
| 39 | (F.connection t).curvatureTensor x (eb ac.1) (eb ac.2) |
| 40 | (eb bd.1) (eb bd.2)) |
| 41 | (fun (ac : Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) × |
| 42 | Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x))) d => |
| 43 | hamiltonP (F.connection t) x (eb ac.1) (eb ac.2) (eb d)) |
| 44 | (fun c (bd : Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) × |
| 45 | Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x))) => |
| 46 | hamiltonP (F.connection t) x (eb bd.1) (eb bd.2) (eb c)) |
| 47 | (fun a b => hamiltonM (F.connection t) τ x (eb a) (eb b))).PosSemidef |
| 48 | |
| 49 | theorem finite_differential_of_hamilton_diagonal |
| 50 | (hC : RicciFlowCurvatureCalculus.{u}) |
| 51 | (T₀ T₁ : ℝ) (F : RicciFlow n M (Ioo T₀ T₁)) |
| 52 | (hdiag : ∀ t ∈ Ioo T₀ T₁, ∀ x : M, |
| 53 | ∀ v : TangentSpace (𝓡 n) x, ∀ i, |
| 54 | 0 ≤ hamiltonM (F.connection t) (t - T₀) x |
| 55 | ((F.metric t).orthonormalBasis x i) |
| 56 | ((F.metric t).orthonormalBasis x i) + |
| 57 | 2 * hamiltonP (F.connection t) x v |
| 58 | ((F.metric t).orthonormalBasis x i) |
| 59 | ((F.metric t).orthonormalBasis x i) + |
| 60 | (F.connection t).curvatureTensor x v |
| 61 | ((F.metric t).orthonormalBasis x i) v |
| 62 | ((F.metric t).orthonormalBasis x i)) : |
| 63 | ∀ t ∈ Ioo T₀ T₁, ∀ x : M, ∀ v : TangentSpace (𝓡 n) x, |
| 64 | ∃ dR : ℝ, |
| 65 | HasDerivWithinAt (fun s ↦ (F.connection s).scalarCurvature x) dR |
| 66 | (Ioo T₀ T₁) t ∧ |
| 67 | 0 ≤ dR + (F.connection t).scalarCurvature x / (t - T₀) + |
| 68 | 2 * mvfderiv (𝓡 n) |
| 69 | (fun y ↦ (F.connection t).scalarCurvature y) x v + |
| 70 | 2 * (F.connection t).ricci x v v := by |
| 71 | intro t ht x v |
| 72 | apply finite_differential_of_hamilton_diagonal_nonneg hC T₀ T₁ F t ht x v |
| 73 | exact hdiag t ht x v |
| 74 | |
| 75 | /- The geometric block is the direct producer interface. Keeping this |
| 76 | bridge next to the scalar assembly leaves the noncompact maximum-principle |
| 77 | proof responsible only for the block witness itself. -/ |
| 78 | theorem finite_differential_of_hamilton_block |
| 79 | (hC : RicciFlowCurvatureCalculus.{u}) |
| 80 | (T₀ T₁ : ℝ) (F : RicciFlow n M (Ioo T₀ T₁)) |
| 81 | (hblock : ∀ t ∈ Ioo T₀ T₁, ∀ x : M, |
| 82 | HamiltonBlockPos F t x (t - T₀)) : |
| 83 | ∀ t ∈ Ioo T₀ T₁, ∀ x : M, ∀ v : TangentSpace (𝓡 n) x, |
| 84 | ∃ dR : ℝ, |
| 85 | HasDerivWithinAt (fun s ↦ (F.connection s).scalarCurvature x) dR |
| 86 | (Ioo T₀ T₁) t ∧ |
| 87 | 0 ≤ dR + (F.connection t).scalarCurvature x / (t - T₀) + |
| 88 | 2 * mvfderiv (𝓡 n) |
| 89 | (fun y ↦ (F.connection t).scalarCurvature y) x v + |
| 90 | 2 * (F.connection t).ricci x v v := by |
| 91 | apply finite_differential_of_hamilton_diagonal hC T₀ T₁ F |
| 92 | intro t ht x v |
| 93 | have ht' : t ∈ interior (Ioo T₀ T₁) := by |
| 94 | simpa only [interior_Ioo] using ht |
| 95 | let g := F.metric t |
| 96 | let D := F.connection t |
| 97 | let b := g.orthonormalBasis x |
| 98 | have hD := hC.tensor_calculus n M g D |
| 99 | intro a |
| 100 | have hP : hamiltonP D x v (b a) (b a) = |
| 101 | ∑ i, hamiltonP D x (b i) (b a) (b a) * g.inner x v (b i) := by |
| 102 | simpa [Function.update, b, mul_comm] using |
| 103 | (hamiltonP_isSmoothCovariantTensor D hD).update_eq_sum g x ![v, b a, b a] 0 v |
| 104 | have hRfirst : D.curvatureTensor x v (b a) v (b a) = |
| 105 | ∑ i, g.inner x v (b i) * D.curvatureTensor x (b i) (b a) v (b a) := by |
| 106 | simpa [LeviCivitaData.riemannEvaluation, Function.update, b] using |
| 107 | hD.1.update_eq_sum g x ![v, b a, v, b a] 0 v |
| 108 | have hRthird (i) : D.curvatureTensor x (b i) (b a) v (b a) = |
| 109 | ∑ k, g.inner x v (b k) * D.curvatureTensor x (b i) (b a) (b k) (b a) := by |
| 110 | simpa [LeviCivitaData.riemannEvaluation, Function.update, b] using |
| 111 | hD.1.update_eq_sum g x ![b i, b a, v, b a] 2 v |
| 112 | have hR : D.curvatureTensor x v (b a) v (b a) = |
| 113 | ∑ i, ∑ k, D.curvatureTensor x (b i) (b a) (b k) (b a) * |
| 114 | g.inner x v (b i) * g.inner x v (b k) := by |
| 115 | rw [hRfirst] |
| 116 | apply Finset.sum_congr rfl |
| 117 | intro i hi |
| 118 | rw [hRthird, Finset.mul_sum] |
| 119 | apply Finset.sum_congr rfl |
| 120 | intro k hk |
| 121 | ring |
| 122 | change 0 ≤ hamiltonM D (t - T₀) x (b a) (b a) + |
| 123 | 2 * hamiltonP D x v (b a) (b a) + D.curvatureTensor x v (b a) v (b a) |
| 124 | rw [hP, hR] |
| 125 | exact hamilton_diagonal_nonneg_of_geometric_block hC F |
| 126 | ht' (t - T₀) x v (hblock t ht x) a |
| 127 | |
| 128 | end Poincare.RicciFlow.Harnack |