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/CurvatureExtension.lean` at |
| 2 | f927d9e1f0810042766d3b5f64d3f4da02ee93cc. See |
| 3 | `references/ricci-flow/mapher/local-theory/port.json`. -/ |
| 4 | |
| 5 | import PoincareLib.Geometry.RicciFlow.Local.Energy.Comparison.ScalarCommutator |
| 6 | import PoincareLib.Geometry.RicciFlow.Local.Curvature.Calculus.CurvatureTensoriality |
| 7 | |
| 8 | /-! |
| 9 | # Metric skewness and extension independence of curvature |
| 10 | |
| 11 | Differentiate metric compatibility on an open neighborhood and apply the |
| 12 | scalar commutator. Testing the resulting skewness against smooth local |
| 13 | extensions proves independence of the third field, then identifies the |
| 14 | section commutator with the frozen pointwise curvature. The convention is |
| 15 | Morgan-Tian, printed pp. 5-7. Statements and derivation were independently |
| 16 | reviewed under proof-work/tasks/M03/ before these bodies. |
| 17 | -/ |
| 18 | |
| 19 | set_option autoImplicit false |
| 20 | |
| 21 | open scoped Manifold ContDiff Bundle Topology |
| 22 | |
| 23 | universe u |
| 24 | |
| 25 | namespace PoincareMT.RicciFlow.Local |
| 26 | |
| 27 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 28 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 29 | |
| 30 | theorem curvatureOnFields_pair_skew {g : RiemannianMetric n M} |
| 31 | (D : LeviCivitaData g) {U : Set M} (hU : IsOpen U) |
| 32 | (X Y Z W : (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 | (hW : ContMDiffOn (𝓡 n) |
| 40 | ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ (T% W) U) |
| 41 | {x : M} (hx : x ∈ U) : |
| 42 | g.inner x (D.curvatureOnFields X Y Z x) (W x) = |
| 43 | -g.inner x (Z x) (D.curvatureOnFields X Y W x) := by |
| 44 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 45 | ⟨g.toRiemannianMetric⟩ |
| 46 | have hmd (A : (y : M) → TangentSpace (𝓡 n) y) |
| 47 | (hA : ContMDiffOn (𝓡 n) |
| 48 | ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ (T% A) U) |
| 49 | {y : M} (hy : y ∈ U) : |
| 50 | MDifferentiableAt (𝓡 n) |
| 51 | ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) (T% A) y := |
| 52 | (hA.contMDiffAt (hU.mem_nhds hy)).mdifferentiableAt (by simp) |
| 53 | have hsecond (A B : (y : M) → TangentSpace (𝓡 n) y) |
| 54 | (hB : ContMDiffOn (𝓡 n) |
| 55 | ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ (T% B) U) : |
| 56 | mvfderiv (𝓡 n) |
| 57 | (fun y => mvfderiv (𝓡 n) (fun z => g.inner z (Z z) (W z)) y (B y)) |
| 58 | x (A x) = |
| 59 | g.inner x (D.connection (fun y => D.connection Z y (B y)) x (A x)) (W x) + |
| 60 | g.inner x (D.connection Z x (B x)) (D.connection W x (A x)) + |
| 61 | (g.inner x (D.connection Z x (A x)) (D.connection W x (B x)) + |
| 62 | g.inner x (Z x) (D.connection (fun y => D.connection W y (B y)) x (A x))) := by |
| 63 | have hBZ := D.contMDiffOn_connection_apply hU B Z hB hZ |
| 64 | have hBW := D.contMDiffOn_connection_apply hU B W hB hW |
| 65 | have heq : |
| 66 | (fun y => mvfderiv (𝓡 n) (fun z => g.inner z (Z z) (W z)) y (B y)) |
| 67 | =ᶠ[𝓝 x] (fun y => |
| 68 | g.inner y (D.connection Z y (B y)) (W y) + |
| 69 | g.inner y (Z y) (D.connection W y (B y))) := by |
| 70 | filter_upwards [hU.mem_nhds hx] with y hy |
| 71 | exact D.localTheory_mvfderiv_inner B Z W (hmd Z hZ hy) (hmd W hW hy) |
| 72 | have hd : |
| 73 | mvfderiv (𝓡 n) |
| 74 | (fun y => mvfderiv (𝓡 n) (fun z => g.inner z (Z z) (W z)) y (B y)) x = |
| 75 | mvfderiv (𝓡 n) (fun y => |
| 76 | g.inner y (D.connection Z y (B y)) (W y) + |
| 77 | g.inner y (Z y) (D.connection W y (B y))) x := by |
| 78 | apply ContinuousLinearMap.ext |
| 79 | intro v |
| 80 | change mfderiv (𝓡 n) 𝓘(ℝ, ℝ) |
| 81 | (fun y => mvfderiv (𝓡 n) (fun z => g.inner z (Z z) (W z)) y (B y)) x v = |
| 82 | mfderiv (𝓡 n) 𝓘(ℝ, ℝ) (fun y => |
| 83 | g.inner y (D.connection Z y (B y)) (W y) + |
| 84 | g.inner y (Z y) (D.connection W y (B y))) x v |
| 85 | exact congrArg (fun L => L v) (heq.mfderiv_eq (I := 𝓡 n) (I' := 𝓘(ℝ, ℝ))) |
| 86 | have hp₁ : MDifferentiableAt (𝓡 n) 𝓘(ℝ, ℝ) |
| 87 | (fun y => g.inner y (D.connection Z y (B y)) (W y)) x := |
| 88 | (hmd _ hBZ hx).inner_bundle (hmd W hW hx) |
| 89 | have hp₂ : MDifferentiableAt (𝓡 n) 𝓘(ℝ, ℝ) |
| 90 | (fun y => g.inner y (Z y) (D.connection W y (B y))) x := |
| 91 | (hmd Z hZ hx).inner_bundle (hmd _ hBW hx) |
| 92 | rw [hd, mvfderiv_fun_add hp₁ hp₂, add_apply, |
| 93 | D.localTheory_mvfderiv_inner A _ W (hmd _ hBZ hx) (hmd W hW hx), |
| 94 | D.localTheory_mvfderiv_inner A Z _ (hmd Z hZ hx) (hmd _ hBW hx)] |
| 95 | have hpair : ContMDiffOn (𝓡 n) 𝓘(ℝ, ℝ) ∞ |
| 96 | (fun y => g.inner y (Z y) (W y)) U := hZ.inner_bundle hW |
| 97 | have hcomm := mvfderiv_mlieBracket_eq_commutator hU hpair X Y hX hY hx |
| 98 | rw [D.localTheory_mvfderiv_inner (VectorField.mlieBracket (𝓡 n) X Y) Z W |
| 99 | (hmd Z hZ hx) (hmd W hW hx), hsecond X Y hY, hsecond Y X hX] at hcomm |
| 100 | delta LeviCivitaData.curvatureOnFields |
| 101 | simp only [map_sub, sub_apply] |
| 102 | linarith only [hcomm] |
| 103 | |
| 104 | theorem curvatureOnFields_pointwise_third {g : RiemannianMetric n M} |
| 105 | (D : LeviCivitaData g) {U : Set M} (hU : IsOpen U) |
| 106 | (X Y Z Z' : (x : M) → TangentSpace (𝓡 n) x) |
| 107 | (hX : ContMDiffOn (𝓡 n) |
| 108 | ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ (T% X) U) |
| 109 | (hY : ContMDiffOn (𝓡 n) |
| 110 | ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ (T% Y) U) |
| 111 | (hZ : ContMDiffOn (𝓡 n) |
| 112 | ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ (T% Z) U) |
| 113 | (hZ' : ContMDiffOn (𝓡 n) |
| 114 | ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ (T% Z') U) |
| 115 | {x : M} (hx : x ∈ U) (hZZ' : Z x = Z' x) : |
| 116 | D.curvatureOnFields X Y Z x = D.curvatureOnFields X Y Z' x := by |
| 117 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 118 | ⟨g.toRiemannianMetric⟩ |
| 119 | apply ext_inner_right ℝ |
| 120 | intro w |
| 121 | change g.inner x (D.curvatureOnFields X Y Z x) w = |
| 122 | g.inner x (D.curvatureOnFields X Y Z' x) w |
| 123 | obtain ⟨V, hV, hw⟩ := |
| 124 | FiberBundle.exists_contMDiffOn_extend (k := ∞) (𝓡 n) (EuclideanSpace ℝ (Fin n)) w |
| 125 | obtain ⟨S, hS, hSopen, hxS⟩ := mem_nhds_iff.mp (Filter.inter_mem (hU.mem_nhds hx) hV) |
| 126 | have hXS := hX.mono fun _ hy => (hS hy).1 |
| 127 | have hYS := hY.mono fun _ hy => (hS hy).1 |
| 128 | have hwS := hw.mono fun _ hy => (hS hy).2 |
| 129 | have hleft := curvatureOnFields_pair_skew D hSopen X Y Z |
| 130 | (FiberBundle.extend (EuclideanSpace ℝ (Fin n)) w) hXS hYS |
| 131 | (hZ.mono fun _ hy => (hS hy).1) hwS hxS |
| 132 | have hright := curvatureOnFields_pair_skew D hSopen X Y Z' |
| 133 | (FiberBundle.extend (EuclideanSpace ℝ (Fin n)) w) hXS hYS |
| 134 | (hZ'.mono fun _ hy => (hS hy).1) hwS hxS |
| 135 | rw [FiberBundle.extend_apply_self] at hleft hright |
| 136 | rw [hleft, hright, hZZ'] |
| 137 | |
| 138 | theorem curvature_eq_curvatureOnFields {g : RiemannianMetric n M} |
| 139 | (D : LeviCivitaData g) {U : Set M} (hU : IsOpen U) |
| 140 | (X Y Z : (x : M) → TangentSpace (𝓡 n) x) |
| 141 | (hX : ContMDiffOn (𝓡 n) |
| 142 | ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ (T% X) U) |
| 143 | (hY : ContMDiffOn (𝓡 n) |
| 144 | ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ (T% Y) U) |
| 145 | (hZ : ContMDiffOn (𝓡 n) |
| 146 | ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ (T% Z) U) |
| 147 | {x : M} (hx : x ∈ U) : |
| 148 | D.curvature x (X x) (Y x) (Z x) = D.curvatureOnFields X Y Z x := by |
| 149 | obtain ⟨V, hV, hZE⟩ := |
| 150 | FiberBundle.exists_contMDiffOn_extend (k := ∞) (𝓡 n) |
| 151 | (EuclideanSpace ℝ (Fin n)) (Z x) |
| 152 | obtain ⟨S, hS, hSopen, hxS⟩ := mem_nhds_iff.mp (Filter.inter_mem (hU.mem_nhds hx) hV) |
| 153 | have hXS := hX.mono fun _ hy => (hS hy).1 |
| 154 | have hYS := hY.mono fun _ hy => (hS hy).1 |
| 155 | have hZS := hZ.mono fun _ hy => (hS hy).1 |
| 156 | have hZES := hZE.mono fun _ hy => (hS hy).2 |
| 157 | have hXm := (hX.contMDiffAt (hU.mem_nhds hx)).mdifferentiableAt (by simp) |
| 158 | have hYm := (hY.contMDiffAt (hU.mem_nhds hx)).mdifferentiableAt (by simp) |
| 159 | have hXE := FiberBundle.mdifferentiableAt_extend (𝓡 n) |
| 160 | (EuclideanSpace ℝ (Fin n)) (X x) |
| 161 | have hYE := FiberBundle.mdifferentiableAt_extend (𝓡 n) |
| 162 | (EuclideanSpace ℝ (Fin n)) (Y x) |
| 163 | delta LeviCivitaData.curvature |
| 164 | trans D.curvatureOnFields X (FiberBundle.extend (EuclideanSpace ℝ (Fin n)) (Y x)) |
| 165 | (FiberBundle.extend (EuclideanSpace ℝ (Fin n)) (Z x)) x |
| 166 | · exact (curvatureOnFields_tensorial_first D hSopen _ _ hZES hxS).pointwise |
| 167 | hXE hXm (FiberBundle.extend_apply_self _ _) |
| 168 | trans D.curvatureOnFields X Y (FiberBundle.extend (EuclideanSpace ℝ (Fin n)) (Z x)) x |
| 169 | · exact (curvatureOnFields_tensorial_second D hSopen _ _ hZES hxS).pointwise |
| 170 | hYE hYm (FiberBundle.extend_apply_self _ _) |
| 171 | exact curvatureOnFields_pointwise_third D hSopen X Y _ Z hXS hYS hZES hZS hxS |
| 172 | (FiberBundle.extend_apply_self _ _) |
| 173 | |
| 174 | end PoincareMT.RicciFlow.Local |