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/ScalarCommutator.lean` at |
| 2 | f927d9e1f0810042766d3b5f64d3f4da02ee93cc. See |
| 3 | `references/ricci-flow/mapher/local-theory/port.json`. -/ |
| 4 | |
| 5 | import PoincareLib.Geometry.RicciFlow.Local.Connection.Family |
| 6 | |
| 7 | /-! |
| 8 | # Scalar differentiation along the Lie bracket |
| 9 | |
| 10 | Transport Mathlib's Euclidean commutator identity through the extended chart |
| 11 | at the evaluation point. The local chain-rule identities hold on a whole |
| 12 | neighborhood, so their derivatives agree there. The sign is the convention |
| 13 | used in Morgan-Tian, printed pp. 5-7: [X,Y]f = X(Yf) - Y(Xf). |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | |
| 18 | open scoped Manifold ContDiff Bundle Topology |
| 19 | open Bundle Manifold Set |
| 20 | |
| 21 | universe u |
| 22 | |
| 23 | namespace PoincareMT.RicciFlow.Local |
| 24 | |
| 25 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 26 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 27 | |
| 28 | theorem mvfderiv_mlieBracket_eq_commutator |
| 29 | {U : Set M} (hU : IsOpen U) {f : M → ℝ} |
| 30 | (hf : ContMDiffOn (𝓡 n) 𝓘(ℝ, ℝ) ∞ f U) |
| 31 | (X Y : (x : M) → TangentSpace (𝓡 n) x) |
| 32 | (hX : ContMDiffOn (𝓡 n) |
| 33 | ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ (T% X) U) |
| 34 | (hY : ContMDiffOn (𝓡 n) |
| 35 | ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ (T% Y) U) |
| 36 | {x : M} (hx : x ∈ U) : |
| 37 | mvfderiv (𝓡 n) f x (VectorField.mlieBracket (𝓡 n) X Y x) = |
| 38 | mvfderiv (𝓡 n) (fun y => mvfderiv (𝓡 n) f y (Y y)) x (X x) - |
| 39 | mvfderiv (𝓡 n) (fun y => mvfderiv (𝓡 n) f y (X y)) x (Y x) := by |
| 40 | let : IsManifold (𝓡 n) (∞ + 1) M := by |
| 41 | simpa using (inferInstance : IsManifold (𝓡 n) ∞ M) |
| 42 | let e := extChartAt (𝓡 n) x |
| 43 | have hex : e.symm (e x) = x := e.left_inv (mem_extChartAt_source x) |
| 44 | have he0 : e x ∈ e.target := mem_extChartAt_target x |
| 45 | have he (q : EuclideanSpace ℝ (Fin n)) (hq : q ∈ e.target) : |
| 46 | ContMDiffAt 𝓘(ℝ, EuclideanSpace ℝ (Fin n)) (𝓡 n) ∞ e.symm q := |
| 47 | (contMDiffOn_extChartAt_symm (I := 𝓡 n) x).contMDiffAt |
| 48 | (extChartAt_target_mem_nhds' hq) |
| 49 | have hei (q : EuclideanSpace ℝ (Fin n)) (hq : q ∈ e.target) : |
| 50 | (mfderiv 𝓘(ℝ, EuclideanSpace ℝ (Fin n)) (𝓡 n) e.symm q).IsInvertible := by |
| 51 | simpa only [(𝓡 n).range_eq_univ, mfderivWithin_univ] using |
| 52 | (isInvertible_mfderivWithin_extChartAt_symm (I := 𝓡 n) hq) |
| 53 | have heid : mfderiv 𝓘(ℝ, EuclideanSpace ℝ (Fin n)) (𝓡 n) e.symm (e x) = |
| 54 | ContinuousLinearMap.id ℝ (TangentSpace (𝓡 n) (e x)) := by |
| 55 | simpa only [(𝓡 n).range_eq_univ, mfderivWithin_univ] using! |
| 56 | (mfderivWithin_range_extChartAt_symm (I := 𝓡 n) (x := x)) |
| 57 | have hfx := hf.contMDiffAt (hU.mem_nhds hx) |
| 58 | have hfex : ContMDiffAt (𝓡 n) 𝓘(ℝ, ℝ) ∞ f (e.symm (e x)) := by |
| 59 | simpa only [hex] using hfx |
| 60 | let h : EuclideanSpace ℝ (Fin n) → ℝ := f ∘ e.symm |
| 61 | let V : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin n) := |
| 62 | fun q => VectorField.mpullback 𝓘(ℝ, EuclideanSpace ℝ (Fin n)) (𝓡 n) e.symm X q |
| 63 | let W : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin n) := |
| 64 | fun q => VectorField.mpullback 𝓘(ℝ, EuclideanSpace ℝ (Fin n)) (𝓡 n) e.symm Y q |
| 65 | have hh : ContDiffAt ℝ ∞ h (e x) := (hfex.comp (e x) (he _ he0)).contDiffAt |
| 66 | have hfield (Z : (y : M) → TangentSpace (𝓡 n) y) |
| 67 | (hZ : ContMDiffOn (𝓡 n) |
| 68 | ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ (T% Z) U) : |
| 69 | ContDiffAt ℝ ∞ |
| 70 | (VectorField.mpullback 𝓘(ℝ, EuclideanSpace ℝ (Fin n)) (𝓡 n) e.symm Z) (e x) := by |
| 71 | have hZex : ContMDiffAt (𝓡 n) |
| 72 | ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ (T% Z) (e.symm (e x)) := by |
| 73 | simpa only [hex] using hZ.contMDiffAt (hU.mem_nhds hx) |
| 74 | exact contMDiffAt_vectorSpace_iff_contDiffAt.mp |
| 75 | (hZex.mpullback_vectorField_preimage (he _ he0) (hei _ he0) (by simp)) |
| 76 | have hdir (Z : (y : M) → TangentSpace (𝓡 n) y) |
| 77 | (hZ : ContMDiffOn (𝓡 n) |
| 78 | ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ (T% Z) U) : |
| 79 | ContMDiffAt (𝓡 n) 𝓘(ℝ, ℝ) ∞ |
| 80 | (fun y => mvfderiv (𝓡 n) f y (Z y)) x := by |
| 81 | have hd := ContMDiffAt.clm_apply_of_inCoordinates (b₁ := id) (b₂ := f) |
| 82 | (hfx.mfderiv_const (m := ∞) (n := ∞) (by simp)) |
| 83 | (hZ.contMDiffAt (hU.mem_nhds hx)) hfx |
| 84 | convert (Bundle.contMDiffAt_totalSpace.mp hd).2 using 1 |
| 85 | funext y |
| 86 | simp only [trivializationAt_model_space_apply] |
| 87 | rfl |
| 88 | have hU' : e.symm ⁻¹' U ∈ 𝓝 (e x) := |
| 89 | (he _ he0).continuousAt.preimage_mem_nhds (by simpa only [hex] using hU.mem_nhds hx) |
| 90 | have htransport (Z : (y : M) → TangentSpace (𝓡 n) y) : |
| 91 | (fun q => fderiv ℝ h q |
| 92 | (VectorField.mpullback 𝓘(ℝ, EuclideanSpace ℝ (Fin n)) (𝓡 n) e.symm Z q)) |
| 93 | =ᶠ[𝓝 (e x)] (fun q => mvfderiv (𝓡 n) f (e.symm q) (Z (e.symm q))) := by |
| 94 | filter_upwards [hU', extChartAt_target_mem_nhds (I := 𝓡 n) x] with q hqU hq |
| 95 | have hfd := (hf.contMDiffAt (hU.mem_nhds hqU)).mdifferentiableAt (by simp) |
| 96 | rw [← mfderiv_eq_fderiv] |
| 97 | change mvfderiv 𝓘(ℝ, EuclideanSpace ℝ (Fin n)) (f ∘ e.symm) q _ = _ |
| 98 | rw [mvfderiv_comp q hfd ((he q hq).mdifferentiableAt (by simp)), |
| 99 | VectorField.mpullback_apply, ContinuousLinearMap.comp_apply, |
| 100 | (hei q hq).self_apply_inverse] |
| 101 | have houter (Z : (y : M) → TangentSpace (𝓡 n) y) |
| 102 | (hZ : ContMDiffOn (𝓡 n) |
| 103 | ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ (T% Z) U) |
| 104 | (a : EuclideanSpace ℝ (Fin n)) : |
| 105 | fderiv ℝ (fun q => fderiv ℝ h q |
| 106 | (VectorField.mpullback 𝓘(ℝ, EuclideanSpace ℝ (Fin n)) (𝓡 n) e.symm Z q)) |
| 107 | (e x) a = mvfderiv (𝓡 n) (fun y => mvfderiv (𝓡 n) f y (Z y)) x a := by |
| 108 | rw [(htransport Z).fderiv_eq, ← mfderiv_eq_fderiv] |
| 109 | change mvfderiv 𝓘(ℝ, EuclideanSpace ℝ (Fin n)) |
| 110 | ((fun y => mvfderiv (𝓡 n) f y (Z y)) ∘ e.symm) (e x) a = _ |
| 111 | rw [mvfderiv_comp_apply_of_eq (e x) ((hdir Z hZ).mdifferentiableAt (by simp)) |
| 112 | ((he _ he0).mdifferentiableAt (by simp)) hex a, heid] |
| 113 | rfl |
| 114 | have hval (Z : (y : M) → TangentSpace (𝓡 n) y) : |
| 115 | VectorField.mpullback 𝓘(ℝ, EuclideanSpace ℝ (Fin n)) (𝓡 n) e.symm Z (e x) = Z x := by |
| 116 | have hinv : |
| 117 | ((mfderiv 𝓘(ℝ, EuclideanSpace ℝ (Fin n)) (𝓡 n) e.symm (e x)).inverse |
| 118 | (Z (e.symm (e x))) : EuclideanSpace ℝ (Fin n)) = Z (e.symm (e x)) := by |
| 119 | simpa only [(𝓡 n).range_eq_univ, mfderivWithin_univ] using! |
| 120 | (mfderivWithin_extChartAt_symm_inverse_apply (I := 𝓡 n) |
| 121 | (x := x) (Z (e.symm (e x)))) |
| 122 | have hvalue : (Z (e.symm (e x)) : EuclideanSpace ℝ (Fin n)) = Z x := |
| 123 | congrArg (fun y => (Z y : EuclideanSpace ℝ (Fin n))) hex |
| 124 | exact hinv.trans hvalue |
| 125 | have hdf : fderiv ℝ h (e x) = mvfderiv (𝓡 n) f x := by |
| 126 | rw [← mfderiv_eq_fderiv] |
| 127 | change mvfderiv 𝓘(ℝ, EuclideanSpace ℝ (Fin n)) (f ∘ e.symm) (e x) = _ |
| 128 | rw [mvfderiv_comp (e x) (hfex.mdifferentiableAt (by simp)) |
| 129 | ((he _ he0).mdifferentiableAt (by simp)), heid] |
| 130 | change mvfderiv (𝓡 n) f (e.symm (e x)) = mvfderiv (𝓡 n) f x |
| 131 | rw [hex] |
| 132 | have hbr : VectorField.mlieBracket (𝓡 n) X Y x = |
| 133 | VectorField.lieBracket ℝ V W (e x) := by |
| 134 | delta VectorField.mlieBracket |
| 135 | rw [VectorField.mlieBracketWithin_apply] |
| 136 | simp only [(𝓡 n).range_eq_univ, Set.preimage_univ, Set.inter_univ, |
| 137 | VectorField.mpullbackWithin_univ, mfderiv_extChartAt_self] |
| 138 | change (ContinuousLinearMap.id ℝ (EuclideanSpace ℝ (Fin n))).inverse |
| 139 | (VectorField.lieBracketWithin ℝ V W Set.univ (e x)) = _ |
| 140 | rw [ContinuousLinearMap.inverse_id] |
| 141 | change VectorField.lieBracketWithin ℝ V W Set.univ (e x) = _ |
| 142 | rw [VectorField.lieBracketWithin_univ] |
| 143 | have hEuclid := VectorField.fderiv_apply_lieBracket (V := V) (W := W) hh |
| 144 | (by |
| 145 | rw [minSmoothness_of_isRCLikeNormedField] |
| 146 | exact WithTop.coe_le_coe.mpr (le_top : (2 : ℕ∞) ≤ ⊤)) |
| 147 | ((hfield Y hY).differentiableAt (by simp)) |
| 148 | ((hfield X hX).differentiableAt (by simp)) |
| 149 | have houterY := houter Y hY (V (e x)) |
| 150 | have houterX := houter X hX (W (e x)) |
| 151 | change fderiv ℝ (fun q => fderiv ℝ h q (W q)) (e x) (V (e x)) = _ at houterY |
| 152 | change fderiv ℝ (fun q => fderiv ℝ h q (V q)) (e x) (W (e x)) = _ at houterX |
| 153 | rw [houterY, houterX] at hEuclid |
| 154 | have hV : V (e x) = X x := hval X |
| 155 | have hW : W (e x) = Y x := hval Y |
| 156 | rw [hV, hW] at hEuclid |
| 157 | rw [hbr, ← hdf] |
| 158 | exact hEuclid |
| 159 | |
| 160 | end PoincareMT.RicciFlow.Local |