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/Existence/ConjugatorLieDerivativeNative.lean` at |
| 2 | f927d9e1f0810042766d3b5f64d3f4da02ee93cc. See |
| 3 | `references/ricci-flow/mapher/local-theory/port.json`. -/ |
| 4 | |
| 5 | import PoincareLib.Geometry.RicciFlow.Local.DeTurck.Construction.IntrinsicLieMetric |
| 6 | import Mathlib.Analysis.Calculus.FDeriv.Symmetric |
| 7 | import Mathlib.Analysis.Calculus.Deriv.Mul |
| 8 | import Mathlib.Analysis.Calculus.Deriv.Prod |
| 9 | |
| 10 | /-! |
| 11 | # Differentiating the conjugating flow |
| 12 | |
| 13 | The spatial differential of a smooth flow satisfies the variational equation |
| 14 | by symmetry of its mixed derivatives. The orbit equation is only required as |
| 15 | a derivative within the time set, so this argument retains its initial point. |
| 16 | -/ |
| 17 | |
| 18 | set_option autoImplicit false |
| 19 | set_option maxHeartbeats 1600000 |
| 20 | |
| 21 | noncomputable section |
| 22 | |
| 23 | open scoped ContDiff Topology |
| 24 | |
| 25 | namespace PoincareMT.ConjugatorLieDerivativeNative |
| 26 | |
| 27 | section Euclidean |
| 28 | |
| 29 | variable {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 30 | [NormedAddCommGroup F] [NormedSpace ℝ F] |
| 31 | |
| 32 | private theorem spatial_fderiv_eq {f : ℝ × E → F} {t : ℝ} {x : E} |
| 33 | (hf : DifferentiableAt ℝ f (t, x)) : |
| 34 | fderiv ℝ (fun z => f (t, z)) x = |
| 35 | (fderiv ℝ f (t, x)).comp (ContinuousLinearMap.inr ℝ ℝ E) := by |
| 36 | exact (hf.hasFDerivAt.comp x (hasFDerivAt_prodMk_right t x)).fderiv |
| 37 | |
| 38 | /-- Differentiate the actual orbit equation in space, then interchange the |
| 39 | two derivatives. Only the orbit equation, not its conclusion, is a premise. -/ |
| 40 | theorem hasDerivAt_spatial_fderiv_of_orbit |
| 41 | {f : ℝ × E → F} {V : F → F} {J : Set ℝ} {t : ℝ} {x : E} |
| 42 | (hf : ContDiffAt ℝ 2 f (t, x)) |
| 43 | (hJ : UniqueDiffWithinAt ℝ J t) |
| 44 | (hV : DifferentiableAt ℝ V (f (t, x))) |
| 45 | (horbit : ∀ᶠ z in 𝓝 x, |
| 46 | HasDerivWithinAt (fun s => f (s, z)) (V (f (t, z))) J t) |
| 47 | (u : E) : |
| 48 | HasDerivAt (fun s => fderiv ℝ (fun z => f (s, z)) x u) |
| 49 | (fderiv ℝ V (f (t, x)) (fderiv ℝ (fun z => f (t, z)) x u)) t := by |
| 50 | have hfd : DifferentiableAt ℝ (fderiv ℝ f) (t, x) := |
| 51 | (hf.fderiv_right (m := 1) (by norm_num)).differentiableAt one_ne_zero |
| 52 | have hlocal : ∀ᶠ q in 𝓝 (t, x), DifferentiableAt ℝ f q := |
| 53 | (hf.eventually (by norm_num)).mono fun _ h => h.differentiableAt two_ne_zero |
| 54 | have htx : ContinuousAt (fun s : ℝ => (s, x)) t := by fun_prop |
| 55 | have htz : ContinuousAt (fun z : E => (t, z)) x := by fun_prop |
| 56 | have htime : (fun z => fderiv ℝ f (t, z) (1, 0)) =ᶠ[𝓝 x] |
| 57 | (fun z => V (f (t, z))) := by |
| 58 | filter_upwards [htz hlocal, horbit] with z hz hode |
| 59 | have hcurve : HasDerivAt (fun s => f (s, z)) |
| 60 | (fderiv ℝ f (t, z) (1, 0)) t := by |
| 61 | have hline : HasDerivAt (fun s : ℝ => (s, z)) (1, 0) t := by |
| 62 | simpa using HasDerivAt.prodMk (hasDerivAt_id t) (hasDerivAt_const t z) |
| 63 | exact HasFDerivAt.comp_hasDerivAt t (f := fun s : ℝ => (s, z)) |
| 64 | hz.hasFDerivAt hline |
| 65 | exact hJ.eq_deriv _ hcurve.hasDerivWithinAt hode |
| 66 | have hline : HasDerivAt (fun s : ℝ => (s, x)) (1, 0) t := by |
| 67 | simpa using HasDerivAt.prodMk (hasDerivAt_id t) (hasDerivAt_const t x) |
| 68 | have hDtime := (HasFDerivAt.comp_hasDerivAt t (f := fun s : ℝ => (s, x)) |
| 69 | hfd.hasFDerivAt hline).clm_apply |
| 70 | (hasDerivAt_const t ((0, u) : ℝ × E)) |
| 71 | have hspatial : |
| 72 | (fun s => fderiv ℝ (fun z => f (s, z)) x u) =ᶠ[𝓝 t] |
| 73 | (fun s => fderiv ℝ f (s, x) (0, u)) := by |
| 74 | filter_upwards [htx hlocal] with s hs |
| 75 | rw [spatial_fderiv_eq hs] |
| 76 | rfl |
| 77 | have hspush : HasDerivAt (fun s => fderiv ℝ (fun z => f (s, z)) x u) |
| 78 | (fderiv ℝ (fderiv ℝ f) (t, x) (1, 0) (0, u)) t := by |
| 79 | apply HasDerivAt.congr_of_eventuallyEq _ hspatial |
| 80 | simpa only [map_zero, add_zero, Function.comp_apply] using hDtime |
| 81 | have hspaceTime : HasFDerivAt (fun z => fderiv ℝ f (t, z) (1, 0)) |
| 82 | (((fderiv ℝ (fderiv ℝ f) (t, x)).comp |
| 83 | (ContinuousLinearMap.inr ℝ ℝ E)).flip (1, 0)) x := by |
| 84 | have h := (hfd.hasFDerivAt.comp x (hasFDerivAt_prodMk_right t x)).clm_apply |
| 85 | (hasFDerivAt_const ((1, 0) : ℝ × E) x) |
| 86 | simpa using h |
| 87 | have hcomp : HasFDerivAt (fun z => V (f (t, z))) |
| 88 | ((fderiv ℝ V (f (t, x))).comp (fderiv ℝ (fun z => f (t, z)) x)) x := by |
| 89 | exact hV.hasFDerivAt.comp x |
| 90 | ((hf.differentiableAt two_ne_zero).comp x |
| 91 | (hasFDerivAt_prodMk_right t x).differentiableAt).hasFDerivAt |
| 92 | have hderivs := (hspaceTime.congr_of_eventuallyEq htime.symm).unique hcomp |
| 93 | have hmixed := hf.isSymmSndFDerivAt (by |
| 94 | rw [minSmoothness_of_isRCLikeNormedField]) |
| 95 | apply hspush.congr_deriv |
| 96 | calc |
| 97 | fderiv ℝ (fderiv ℝ f) (t, x) (1, 0) (0, u) = |
| 98 | fderiv ℝ (fderiv ℝ f) (t, x) (0, u) (1, 0) := |
| 99 | hmixed.eq (1, 0) (0, u) |
| 100 | _ = _ := congrArg (fun A : E →L[ℝ] F => A u) hderivs |
| 101 | |
| 102 | /-- The ordinary coordinate expression of the Lie derivative of a metric. -/ |
| 103 | def coordinateLieMetric (G : F → F →L[ℝ] F →L[ℝ] ℝ) (V : F → F) |
| 104 | (z u v : F) : ℝ := |
| 105 | fderiv ℝ G z (V z) u v + G z (fderiv ℝ V z u) v + |
| 106 | G z u (fderiv ℝ V z v) |
| 107 | |
| 108 | /-- Product differentiation of the actual moving pullback coefficient. -/ |
| 109 | theorem hasDerivWithinAt_pullback_coefficient |
| 110 | {f : ℝ × E → F} {V : F → F} |
| 111 | {G : F → F →L[ℝ] F →L[ℝ] ℝ} {J : Set ℝ} {t : ℝ} {x : E} |
| 112 | (hf : ContDiffAt ℝ 2 f (t, x)) |
| 113 | (hJ : UniqueDiffWithinAt ℝ J t) |
| 114 | (hV : DifferentiableAt ℝ V (f (t, x))) |
| 115 | (hG : DifferentiableAt ℝ G (f (t, x))) |
| 116 | (horbit : ∀ᶠ z in 𝓝 x, |
| 117 | HasDerivWithinAt (fun s => f (s, z)) (V (f (t, z))) J t) |
| 118 | (u v : E) : |
| 119 | HasDerivWithinAt |
| 120 | (fun s => G (f (s, x)) |
| 121 | (fderiv ℝ (fun z => f (s, z)) x u) |
| 122 | (fderiv ℝ (fun z => f (s, z)) x v)) |
| 123 | (coordinateLieMetric G V (f (t, x)) |
| 124 | (fderiv ℝ (fun z => f (t, z)) x u) |
| 125 | (fderiv ℝ (fun z => f (t, z)) x v)) J t := by |
| 126 | have hbase : HasDerivWithinAt (fun s => G (f (s, x))) |
| 127 | (fderiv ℝ G (f (t, x)) (V (f (t, x)))) J t := |
| 128 | HasFDerivAt.comp_hasDerivWithinAt t (l := G) |
| 129 | (f := fun s : ℝ => f (s, x)) hG.hasFDerivAt horbit.self_of_nhds |
| 130 | have hu := (hasDerivAt_spatial_fderiv_of_orbit hf hJ hV horbit u).hasDerivWithinAt (s := J) |
| 131 | have hv := (hasDerivAt_spatial_fderiv_of_orbit hf hJ hV horbit v).hasDerivWithinAt (s := J) |
| 132 | simpa only [coordinateLieMetric, ContinuousLinearMap.add_apply, Function.comp_apply] |
| 133 | using (hbase.clm_apply hu).clm_apply hv |
| 134 | |
| 135 | theorem coordinateLieMetric_neg |
| 136 | (G : F → F →L[ℝ] F →L[ℝ] ℝ) (W : F → F) (z u v : F) : |
| 137 | coordinateLieMetric G (fun y => -W y) z u v = |
| 138 | -coordinateLieMetric G W z u v := by |
| 139 | have hneg : fderiv ℝ (fun y => -W y) z = -fderiv ℝ W z := fderiv_neg |
| 140 | simp only [coordinateLieMetric, hneg, neg_apply, map_neg] |
| 141 | ring |
| 142 | |
| 143 | end Euclidean |
| 144 | |
| 145 | end PoincareMT.ConjugatorLieDerivativeNative |
| 146 | |
| 147 | end |