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 | /- Adapted from Mapher `PoincareMT/Proofs/M03/ConnectionVariation.lean` at |
| 2 | f927d9e1f0810042766d3b5f64d3f4da02ee93cc. See |
| 3 | `references/ricci-flow/mapher/local-theory/port.json`. -/ |
| 4 | |
| 5 | import PoincareLib.Geometry.RicciFlow.Local.Connection.PairingEvolution |
| 6 | import PoincareLib.Geometry.RicciFlow.Local.Curvature.Evolution.CurvatureVectorTime |
| 7 | |
| 8 | /-! |
| 9 | # Actual connection variation under Ricci flow |
| 10 | |
| 11 | Differentiate the Koszul pairing and separate its metric product rule. |
| 12 | Torsion-freeness then gives the covariant Ricci derivative formula of |
| 13 | Kotschwar, arXiv:1206.3225v1, printed p. 4, equation (6). |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | set_option maxHeartbeats 1800000 |
| 18 | |
| 19 | open scoped Manifold ContDiff Bundle Topology |
| 20 | open Set |
| 21 | |
| 22 | universe u |
| 23 | |
| 24 | namespace PoincareMT.RicciFlow.Local |
| 25 | |
| 26 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 27 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 28 | |
| 29 | theorem ricciFlow_connection_variation_pairing |
| 30 | {J : Set ℝ} (F : RicciFlow n M J) {t : ℝ} (ht : t ∈ interior J) |
| 31 | {U : Set M} (hU : IsOpen U) |
| 32 | (X Y Z : (x : M) → TangentSpace (𝓡 n) x) |
| 33 | (hX : ContMDiffOn (𝓡 n) |
| 34 | ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ (T% X) U) |
| 35 | (hY : ContMDiffOn (𝓡 n) |
| 36 | ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ (T% Y) U) |
| 37 | (hZ : ContMDiffOn (𝓡 n) |
| 38 | ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ (T% Z) U) |
| 39 | {x : M} (hx : x ∈ U) : |
| 40 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 41 | ⟨(F.metric 0).toRiemannianMetric⟩ |
| 42 | let c := extChartAt (𝓡 n) x |
| 43 | let r := fun y (a b : TangentSpace (𝓡 n) y) => |
| 44 | (F.connection t).ricci y a b |
| 45 | let cr := fun (A B C : (y : M) → TangentSpace (𝓡 n) y) => |
| 46 | fderiv ℝ (fun z => r (c.symm z) (B (c.symm z)) (C (c.symm z))) |
| 47 | (c x) (A x) - |
| 48 | r x ((F.connection t).connection B x (A x)) (C x) - |
| 49 | r x (B x) ((F.connection t).connection C x (A x)) |
| 50 | let V := fun s => (F.connection s).connection Y x (X x) |
| 51 | HasDerivAt V (deriv V t) t ∧ |
| 52 | (F.metric t).inner x (deriv V t) (Z x) = |
| 53 | -cr X Y Z - cr Y Z X + cr Z X Y := by |
| 54 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 55 | ⟨(F.metric 0).toRiemannianMetric⟩ |
| 56 | let : NormedAddCommGroup (TangentSpace (𝓡 n) x →L[ℝ] ℝ) := inferInstance |
| 57 | let : NormedSpace ℝ (TangentSpace (𝓡 n) x →L[ℝ] ℝ) := inferInstance |
| 58 | let c := extChartAt (𝓡 n) x |
| 59 | let r := fun y (a b : TangentSpace (𝓡 n) y) => |
| 60 | (F.connection t).ricci y a b |
| 61 | let cr := fun (A B C : (y : M) → TangentSpace (𝓡 n) y) => |
| 62 | fderiv ℝ (fun z => r (c.symm z) (B (c.symm z)) (C (c.symm z))) |
| 63 | (c x) (A x) - |
| 64 | r x ((F.connection t).connection B x (A x)) (C x) - |
| 65 | r x (B x) ((F.connection t).connection C x (A x)) |
| 66 | let V := fun s => (F.connection s).connection Y x (X x) |
| 67 | change HasDerivAt V (deriv V t) t ∧ |
| 68 | (F.metric t).inner x (deriv V t) (Z x) = |
| 69 | -cr X Y Z - cr Y Z X + cr Z X Y |
| 70 | have htJ : J ∈ 𝓝 t := mem_interior_iff_mem_nhds.mp ht |
| 71 | have hV : HasDerivAt V (deriv V t) t := by |
| 72 | have hs := contMDiffOn_connection_family_apply F.smooth F.connection hU Y X hY hX |
| 73 | have hi : ContMDiffAt 𝓘(ℝ, ℝ) (𝓘(ℝ, ℝ).prod (𝓡 n)) ∞ |
| 74 | (fun s : ℝ => (s, x)) t := contMDiffAt_id.prodMk contMDiffAt_const |
| 75 | have hsAt := (hs.contMDiffAt (prod_mem_nhds htJ (hU.mem_nhds hx))).comp t hi |
| 76 | let e := trivializationAt (EuclideanSpace ℝ (Fin n)) (TangentSpace (𝓡 n)) x |
| 77 | have he : x ∈ e.baseSet := FiberBundle.mem_baseSet_trivializationAt' x |
| 78 | let L := e.continuousLinearEquivAt ℝ x he |
| 79 | have hc : ContDiffAt ℝ ∞ (fun s => L (V s)) t := |
| 80 | (Bundle.contMDiffAt_totalSpace.mp hsAt).2.contDiffAt |
| 81 | have hv := L.symm.contDiff.contDiffAt.comp t hc |
| 82 | have hv' : ContDiffAt ℝ ∞ V t := by |
| 83 | simpa only [Function.comp_def, ContinuousLinearEquiv.symm_apply_apply] using hv |
| 84 | exact (hv'.differentiableAt (by simp)).hasDerivAt |
| 85 | refine ⟨hV, ?_⟩ |
| 86 | let G (s : ℝ) : TangentSpace (𝓡 n) x →L[ℝ] |
| 87 | TangentSpace (𝓡 n) x →L[ℝ] ℝ := (F.metric s).inner x |
| 88 | have hG : HasDerivAt G (deriv G t) t := |
| 89 | (((contDiffOn_family_metric_inner_time F.smooth x).contDiffAt htJ).differentiableAt |
| 90 | (by simp)).hasDerivAt |
| 91 | have he (a b : TangentSpace (𝓡 n) x) : |
| 92 | HasDerivAt (fun s => (F.metric s).inner x a b) (-2 * r x a b) t := |
| 93 | (F.equation t (interior_subset ht) x a b).hasDerivAt htJ |
| 94 | have hq (a b : TangentSpace (𝓡 n) x) : (deriv G t) a b = -2 * r x a b := by |
| 95 | have hd := (hG.clm_apply (hasDerivAt_const t a)).clm_apply (hasDerivAt_const t b) |
| 96 | have hd' : HasDerivAt (fun s => (F.metric s).inner x a b) ((deriv G t) a b) t := by |
| 97 | simpa only [map_zero, add_zero] using hd |
| 98 | exact hd'.unique (he a b) |
| 99 | have hprod : HasDerivAt |
| 100 | (fun s => 2 * (F.metric s).inner x (V s) (Z x)) |
| 101 | (2 * (-2 * r x (V t) (Z x) + (F.metric t).inner x (deriv V t) (Z x))) t := by |
| 102 | have hd := ((hG.clm_apply hV).clm_apply (hasDerivAt_const t (Z x))).const_mul 2 |
| 103 | simpa only [map_zero, add_zero, add_apply, hq] using hd |
| 104 | have hscale (B C : (y : M) → TangentSpace (𝓡 n) y) |
| 105 | (a : EuclideanSpace ℝ (Fin n)) : |
| 106 | fderiv ℝ (fun z => -2 * r (c.symm z) (B (c.symm z)) (C (c.symm z))) |
| 107 | (c x) a = |
| 108 | -2 * fderiv ℝ (fun z => r (c.symm z) (B (c.symm z)) (C (c.symm z))) |
| 109 | (c x) a := by |
| 110 | change fderiv ℝ ((-2 : ℝ) • |
| 111 | (fun z => r (c.symm z) (B (c.symm z)) (C (c.symm z)))) (c x) a = _ |
| 112 | rw [fderiv_const_smul_field] |
| 113 | rfl |
| 114 | have hk := (hasDerivAt_ricciFlow_koszul_pairing F ht hU X Y Z hX hY hZ hx).unique hprod |
| 115 | change |
| 116 | fderiv ℝ (fun z => -2 * r (c.symm z) (Y (c.symm z)) (Z (c.symm z))) (c x) (X x) + |
| 117 | fderiv ℝ (fun z => -2 * r (c.symm z) (Z (c.symm z)) (X (c.symm z))) (c x) (Y x) - |
| 118 | fderiv ℝ (fun z => -2 * r (c.symm z) (X (c.symm z)) (Y (c.symm z))) (c x) (Z x) + |
| 119 | -2 * r x (VectorField.mlieBracket (𝓡 n) X Y x) (Z x) - |
| 120 | -2 * r x (Y x) (VectorField.mlieBracket (𝓡 n) X Z x) - |
| 121 | -2 * r x (X x) (VectorField.mlieBracket (𝓡 n) Y Z x) = |
| 122 | 2 * (-2 * r x (V t) (Z x) + (F.metric t).inner x (deriv V t) (Z x)) at hk |
| 123 | rw [hscale Y Z (X x), hscale Z X (Y x), hscale X Y (Z x)] at hk |
| 124 | have hsub₁ (a b z : TangentSpace (𝓡 n) x) : |
| 125 | r x (a - b) z = r x a z - r x b z := by |
| 126 | have hh : (deriv G t) (a - b) z = (deriv G t) a z - (deriv G t) b z := by |
| 127 | rw [map_sub, sub_apply] |
| 128 | rw [hq, hq, hq] at hh |
| 129 | linarith only [hh] |
| 130 | have hsub₂ (a b z : TangentSpace (𝓡 n) x) : |
| 131 | r x a (b - z) = r x a b - r x a z := by |
| 132 | have hh := map_sub ((deriv G t) a) b z |
| 133 | rw [hq, hq, hq] at hh |
| 134 | linarith only [hh] |
| 135 | have hsymm (a b : TangentSpace (𝓡 n) x) : r x a b = r x b a := by |
| 136 | have hb := (he b a).congr_of_eventuallyEq |
| 137 | (Filter.Eventually.of_forall (fun s => (F.metric s).symm x a b)) |
| 138 | have hh := (he a b).unique hb |
| 139 | linarith only [hh] |
| 140 | have hXx := (hX.contMDiffAt (hU.mem_nhds hx)).mdifferentiableAt (by simp) |
| 141 | have hYx := (hY.contMDiffAt (hU.mem_nhds hx)).mdifferentiableAt (by simp) |
| 142 | have hZx := (hZ.contMDiffAt (hU.mem_nhds hx)).mdifferentiableAt (by simp) |
| 143 | rw [← ((F.connection t).connection.torsion_eq_zero_iff.mp |
| 144 | (F.connection t).torsion_eq_zero) hXx hYx, |
| 145 | ← ((F.connection t).connection.torsion_eq_zero_iff.mp |
| 146 | (F.connection t).torsion_eq_zero) hXx hZx, |
| 147 | ← ((F.connection t).connection.torsion_eq_zero_iff.mp |
| 148 | (F.connection t).torsion_eq_zero) hYx hZx, |
| 149 | hsub₁, hsub₂, hsub₂] at hk |
| 150 | dsimp only [cr] |
| 151 | rw [hsymm (Z x) ((F.connection t).connection X x (Y x)), |
| 152 | hsymm ((F.connection t).connection X x (Z x)) (Y x), |
| 153 | hsymm ((F.connection t).connection Z x (Y x)) (X x)] |
| 154 | change _ = _ at hk |
| 155 | dsimp only [V] at hk |
| 156 | linarith only [hk] |
| 157 | |
| 158 | end PoincareMT.RicciFlow.Local |