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.Spacetime.Horizontal.Regularity.Curvature |
| 2 | import PoincareLib.Geometry.Riemannian.Tensor.Norm |
| 3 | import Mathlib.Geometry.Manifold.VectorBundle.LocalFrame |
| 4 | import Mathlib.Geometry.Manifold.Algebra.Structures |
| 5 | |
| 6 | /-! |
| 7 | # Joint regularity of the horizontal curvature norm |
| 8 | |
| 9 | In a smooth local frame the squared curvature norm is a contraction with four |
| 10 | copies of the inverse Gram matrix of the horizontal metric. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | set_option backward.isDefEq.respectTransparency false |
| 15 | set_option synthInstance.maxHeartbeats 100000 |
| 16 | |
| 17 | open scoped Manifold ContDiff Bundle BigOperators Topology |
| 18 | open Bundle Set |
| 19 | |
| 20 | universe u |
| 21 | |
| 22 | namespace PoincareMT |
| 23 | |
| 24 | variable {n : ℕ} {X : Type u} [TopologicalSpace X] {time : X → ℝ} |
| 25 | {I : SpacetimeInterval} {F : GeneralizedFlowSpacetime n X time I} |
| 26 | {S : ∀ t : ℝ, SpacetimeSliceGeometry F t} |
| 27 | |
| 28 | private lemma smooth_matrix_det {ι : Type} [Fintype ι] [DecidableEq ι] |
| 29 | (G : F.Point → Matrix ι ι ℝ) (x : F.Point) |
| 30 | (hG : ∀ i j, ContMDiffAt (spacetimeModel n) 𝓘(ℝ) ∞ (fun y => G y i j) x) : |
| 31 | ContMDiffAt (spacetimeModel n) 𝓘(ℝ) ∞ (fun y => (G y).det) x := by |
| 32 | simp only [Matrix.det_apply'] |
| 33 | apply ContMDiffAt.sum |
| 34 | intro σ _ |
| 35 | exact contMDiffAt_const.mul (ContMDiffAt.prod fun i _ => hG (σ i) i) |
| 36 | |
| 37 | private lemma smooth_matrix_inv {ι : Type} [Fintype ι] [DecidableEq ι] |
| 38 | (G : F.Point → Matrix ι ι ℝ) (x : F.Point) |
| 39 | (hG : ∀ i j, ContMDiffAt (spacetimeModel n) 𝓘(ℝ) ∞ (fun y => G y i j) x) |
| 40 | (hx : (G x).det ≠ 0) (i j : ι) : |
| 41 | ContMDiffAt (spacetimeModel n) 𝓘(ℝ) ∞ (fun y => (G y)⁻¹ i j) x := by |
| 42 | simp only [Matrix.inv_def, Ring.inverse_eq_inv, Matrix.smul_apply, smul_eq_mul, |
| 43 | Matrix.adjugate_apply] |
| 44 | apply ((smooth_matrix_det G x hG).inv₀ hx).mul |
| 45 | apply smooth_matrix_det |
| 46 | intro a b |
| 47 | by_cases ha : a = j |
| 48 | · subst a |
| 49 | simpa using (contMDiffAt_const (I := spacetimeModel n) (x := x) (n := ∞) |
| 50 | (c := (Pi.single i (1 : ℝ) : ι → ℝ) b)) |
| 51 | · simpa [Matrix.updateRow_apply, ha] using hG a b |
| 52 | |
| 53 | private theorem sum_fin_cons {ι : Type*} [Fintype ι] {d : ℕ} |
| 54 | (f : (Fin (d + 1) → ι) → ℝ) : |
| 55 | (∑ p, f p) = ∑ a, ∑ q, f (Fin.cons a q) := by |
| 56 | calc |
| 57 | (∑ p, f p) = ∑ p : ι × (Fin d → ι), f (Fin.cons p.1 p.2) := |
| 58 | Fintype.sum_equiv (Fin.consEquiv (fun _ : Fin (d + 1) => ι)).symm _ _ |
| 59 | (fun p => congrArg f (Fin.cons_self_tail p).symm) |
| 60 | _ = _ := Fintype.sum_prod_type _ |
| 61 | |
| 62 | private theorem horizontalCurvatureNormSq_inverse_gram |
| 63 | (D : LeafwiseLeviCivitaFamily F S) (p : F.Point) |
| 64 | (A : MultilinearMap ℝ (fun _ : Fin 4 => F.Horizontal p) ℝ) |
| 65 | (hA : ∀ v, horizontalRiemann D p (v 0) (v 1) (v 2) (v 3) = A v) |
| 66 | (b : Module.Basis (Fin n) ℝ (F.Horizontal p)) : |
| 67 | horizontalCurvatureNormSq D p = |
| 68 | ∑ i : Fin 4 → Fin n, ∑ j : Fin 4 → Fin n, |
| 69 | (∏ r, (Matrix.of (fun a c => F.horizontalMetric.inner p (b a) (b c)))⁻¹ |
| 70 | (i r) (j r)) * |
| 71 | (A (fun r => b (i r)) * A (fun r => b (j r))) := by |
| 72 | let t := F.timeFunction p |
| 73 | let : ChartedSpace (EuclideanSpace ℝ (Fin n)) (S t).Point := (S t).chartedSpace |
| 74 | let : RiemannianBundle (TangentSpace (𝓡 n) : (S t).Point → Type _) := |
| 75 | ⟨(S t).metricOnPoints.toRiemannianMetric⟩ |
| 76 | let x := spacetimeSlicePoint S p |
| 77 | let j := (S t).tangentEquiv x |
| 78 | let B := A.compLinearMap (fun _ => j.toLinearMap) |
| 79 | let c := b.map j.symm.toLinearEquiv |
| 80 | let o := (S t).metricOnPoints.orthonormalBasis x |
| 81 | have h := multilinear_sum_mul_eq_inverse_gram B B c o |
| 82 | have hgram : (Matrix.of (fun a d => inner ℝ (c a) (c d))) = |
| 83 | Matrix.of (fun a d => F.horizontalMetric.inner p (b a) (b d)) := by |
| 84 | ext a d |
| 85 | change (S t).metricOnPoints.inner x (j.symm (b a)) (j.symm (b d)) = _ |
| 86 | rw [(S t).metric_eq] |
| 87 | simp only [j, ContinuousLinearEquiv.apply_symm_apply] |
| 88 | rfl |
| 89 | rw [hgram] at h |
| 90 | have hB (v : Fin 4 → TangentSpace (𝓡 n) x) : B v = |
| 91 | (D.sliceConnection t).curvatureTensor x (v 0) (v 1) (v 2) (v 3) := by |
| 92 | rw [show B v = A (fun r => j (v r)) from rfl, ← hA] |
| 93 | simp only [horizontalRiemann, j, t, x, ContinuousLinearEquiv.symm_apply_apply] |
| 94 | have hBc (a : Fin 4 → Fin n) : B (fun r => c (a r)) = A (fun r => b (a r)) := by |
| 95 | change A (fun r => j (j.symm (b (a r)))) = _ |
| 96 | simp only [ContinuousLinearEquiv.apply_symm_apply] |
| 97 | simp_rw [hBc] at h |
| 98 | rw [← h] |
| 99 | simp_rw [hB, ← pow_two] |
| 100 | rw [sum_fin_cons] |
| 101 | simp only [sum_fin_cons, Fin.cons_zero, Fintype.sum_unique] |
| 102 | unfold horizontalCurvatureNormSq horizontalCurvatureNorm LeviCivitaData.curvatureTensorNorm |
| 103 | exact Real.sq_sqrt (Finset.sum_nonneg fun _ _ => Finset.sum_nonneg fun _ _ => |
| 104 | Finset.sum_nonneg fun _ _ => Finset.sum_nonneg fun _ _ => sq_nonneg _) |
| 105 | |
| 106 | /-- Joint smoothness of the Riemann tensor implies smoothness of its squared norm. -/ |
| 107 | theorem horizontalCurvatureNormSq_smooth_of_riemann |
| 108 | (D : LeafwiseLeviCivitaFamily F S) |
| 109 | (hR : IsSmoothHorizontalCovariantTensor F (k := 4) |
| 110 | (fun p v => horizontalRiemann D p (v 0) (v 1) (v 2) (v 3))) : |
| 111 | ContMDiff (spacetimeModel n) 𝓘(ℝ) ∞ (horizontalCurvatureNormSq D) := by |
| 112 | classical |
| 113 | let : RiemannianBundle F.Horizontal := ⟨F.horizontalMetric.toRiemannianMetric⟩ |
| 114 | let : IsContMDiffRiemannianBundle (spacetimeModel n) ∞ |
| 115 | (EuclideanSpace ℝ (Fin n)) F.Horizontal := |
| 116 | ⟨F.horizontalMetric.inner, F.horizontalMetric.contMDiff, fun _ _ _ => rfl⟩ |
| 117 | intro p |
| 118 | let E := EuclideanSpace ℝ (Fin n) |
| 119 | let e := trivializationAt E F.Horizontal p |
| 120 | let b := (EuclideanSpace.basisFun (Fin n) ℝ).toBasis |
| 121 | let V := e.localFrame b |
| 122 | let G : F.Point → Matrix (Fin n) (Fin n) ℝ := fun q i j => |
| 123 | F.horizontalMetric.inner q (V i q) (V j q) |
| 124 | let R : F.Point → (Fin 4 → Fin n) → ℝ := fun q a => |
| 125 | horizontalRiemann D q (V (a 0) q) (V (a 1) q) (V (a 2) q) (V (a 3) q) |
| 126 | have hp : p ∈ e.baseSet := FiberBundle.mem_baseSet_trivializationAt E F.Horizontal p |
| 127 | have hV (i : Fin n) : IsSmoothHorizontalSectionOn F (V i) e.baseSet := |
| 128 | e.contMDiffOn_localFrame_baseSet ∞ b i |
| 129 | have hG (i j) : ContMDiffAt (spacetimeModel n) 𝓘(ℝ) ∞ (fun q => G q i j) p := |
| 130 | ((hV i).contMDiffAt (e.open_baseSet.mem_nhds hp)).inner_bundle |
| 131 | ((hV j).contMDiffAt (e.open_baseSet.mem_nhds hp)) |
| 132 | have hR' (a : Fin 4 → Fin n) : |
| 133 | ContMDiffAt (spacetimeModel n) 𝓘(ℝ) ∞ (fun q => R q a) p := |
| 134 | (hR.2 e.baseSet e.open_baseSet (fun r => V (a r)) (fun r => hV (a r))).contMDiffAt |
| 135 | (e.open_baseSet.mem_nhds hp) |
| 136 | have hdet : (G p).det ≠ 0 := by |
| 137 | have hb := (e.basisAt b hp).linearIndependent |
| 138 | change (Matrix.gram ℝ (fun i => V i p)).det ≠ 0 |
| 139 | apply Matrix.det_gram_ne_zero_iff_linearIndependent.mpr |
| 140 | simpa only [V, e.localFrame_apply_of_mem_baseSet b hp] using hb |
| 141 | have hinv := smooth_matrix_inv G p hG hdet |
| 142 | have hs : ContMDiffAt (spacetimeModel n) 𝓘(ℝ) ∞ |
| 143 | (fun q => ∑ i : Fin 4 → Fin n, ∑ j : Fin 4 → Fin n, |
| 144 | (∏ r, (G q)⁻¹ (i r) (j r)) * (R q i * R q j)) p := by |
| 145 | exact ContMDiffAt.sum fun i _ => ContMDiffAt.sum fun j _ => |
| 146 | (ContMDiffAt.prod fun r _ => hinv (i r) (j r)).mul ((hR' i).mul (hR' j)) |
| 147 | apply hs.congr_of_eventuallyEq |
| 148 | filter_upwards [e.open_baseSet.mem_nhds hp] with q hq |
| 149 | obtain ⟨A, hA⟩ := hR.1 q |
| 150 | have h := horizontalCurvatureNormSq_inverse_gram D q A hA (e.basisAt b hq) |
| 151 | have hg : Matrix.of (fun a c => F.horizontalMetric.inner q |
| 152 | (e.basisAt b hq a) (e.basisAt b hq c)) = G q := by |
| 153 | ext a c |
| 154 | simp only [G, V, Matrix.of_apply, e.localFrame_apply_of_mem_baseSet b hq] |
| 155 | rw [hg] at h |
| 156 | simpa only [← e.localFrame_apply_of_mem_baseSet b hq, ← hA, V, R] using h |
| 157 | |
| 158 | end PoincareMT |