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.RicciFlow.Compactness.Coordinates.SpacetimeBounds.TimeDerivative |
| 2 | import Mathlib.Analysis.Calculus.FDeriv.Symmetric |
| 3 | |
| 4 | /-! |
| 5 | # Time differentiation of fixed-chart spatial jets |
| 6 | |
| 7 | Schwarz symmetry commutes one time derivative with every spatial derivative |
| 8 | on the original open product domain. Applying this to the actual Ricci-flow |
| 9 | equation identifies the variation of every spatial metric jet. |
| 10 | |
| 11 | The analytic argument is adapted from AxelWorkspace revision |
| 12 | `f1cdb30cabdc8781d2d3dec86d3d99ab1820f30e`, |
| 13 | `formalized-sources/riemannian/MorganTian/MorganTianLib/Ch11/SingularTimeGeometry/TimeJets/Mixed.lean`. |
| 14 | The application uses the retained PoincareLib metric and flow definitions. |
| 15 | Reference: Morgan--Tian, Proposition 5.14, pp. 90--91. |
| 16 | -/ |
| 17 | |
| 18 | set_option autoImplicit false |
| 19 | set_option maxHeartbeats 800000 |
| 20 | set_option backward.isDefEq.respectTransparency false |
| 21 | |
| 22 | open Set Filter |
| 23 | open scoped ContDiff Topology Manifold Bundle |
| 24 | |
| 25 | namespace PoincareMT.SpacetimeBounds |
| 26 | |
| 27 | variable {V E : Type*} [NormedAddCommGroup V] [NormedSpace ℝ V] |
| 28 | [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 29 | |
| 30 | private theorem spatial_fderiv_eq {f : ℝ × V → E} {t : ℝ} {x : V} |
| 31 | (hf : DifferentiableAt ℝ f (t, x)) : |
| 32 | fderiv ℝ (fun y => f (t, y)) x = |
| 33 | (fderiv ℝ f (t, x)).comp (ContinuousLinearMap.inr ℝ ℝ V) := by |
| 34 | exact (hf.hasFDerivAt.comp x |
| 35 | ((hasFDerivAt_const t x).prodMk (hasFDerivAt_id x))).fderiv |
| 36 | |
| 37 | theorem contDiffOn_spatialFDeriv {f : ℝ × V → E} {J : Set ℝ} {U : Set V} |
| 38 | (hf : ContDiffOn ℝ ∞ f (J ×ˢ U)) (hJ : IsOpen J) (hU : IsOpen U) : |
| 39 | ContDiffOn ℝ ∞ (fun z : ℝ × V => fderiv ℝ (fun x => f (z.1, x)) z.2) |
| 40 | (J ×ˢ U) := by |
| 41 | have hd := (hf.fderiv_of_isOpen (hJ.prod hU) (m := ∞) (by simp)).clm_comp |
| 42 | (contDiffOn_const (c := ContinuousLinearMap.inr ℝ ℝ V)) |
| 43 | apply hd.congr |
| 44 | intro z hz |
| 45 | exact spatial_fderiv_eq ((hf.contDiffAt ((hJ.prod hU).mem_nhds hz)).differentiableAt |
| 46 | (by simp)) |
| 47 | |
| 48 | /-- Time differentiation also preserves joint smoothness on the original |
| 49 | open product domain. -/ |
| 50 | theorem contDiffOn_timeDeriv {f : ℝ × V → E} {J : Set ℝ} {U : Set V} |
| 51 | (hf : ContDiffOn ℝ ∞ f (J ×ˢ U)) (hJ : IsOpen J) (hU : IsOpen U) : |
| 52 | ContDiffOn ℝ ∞ (fun z : ℝ × V => deriv (fun t => f (t, z.2)) z.1) |
| 53 | (J ×ˢ U) := by |
| 54 | have hd := (hf.fderiv_of_isOpen (hJ.prod hU) (m := ∞) (by simp)).clm_apply |
| 55 | (contDiffOn_const (c := ((1 : ℝ), (0 : V)))) |
| 56 | apply hd.congr |
| 57 | intro z hz |
| 58 | exact (((hf.contDiffAt ((hJ.prod hU).mem_nhds hz)).differentiableAt |
| 59 | (by simp)).hasFDerivAt.comp_hasDerivAt z.1 |
| 60 | ((hasDerivAt_id z.1).prodMk (hasDerivAt_const z.1 z.2))).deriv |
| 61 | |
| 62 | theorem hasDerivAt_spatialFDeriv {f : ℝ × V → E} {k : V → E} |
| 63 | {J : Set ℝ} {U : Set V} (hf : ContDiffOn ℝ ∞ f (J ×ˢ U)) |
| 64 | (hJ : IsOpen J) (hU : IsOpen U) {t : ℝ} (ht : t ∈ J) |
| 65 | (hk : ∀ x ∈ U, HasDerivAt (fun s => f (s, x)) (k x) t) |
| 66 | {y : V} (hy : y ∈ U) : |
| 67 | HasDerivAt (fun s => fderiv ℝ (fun x => f (s, x)) y) (fderiv ℝ k y) t := by |
| 68 | have hsmooth : ContDiffAt ℝ 2 f (t, y) := |
| 69 | (contDiffOn_infty.mp hf 2).contDiffAt ((hJ.prod hU).mem_nhds ⟨ht, hy⟩) |
| 70 | have hD := ((hsmooth.fderiv_right (m := 1) (by norm_num)).differentiableAt |
| 71 | (by norm_num)).hasFDerivAt |
| 72 | have htline : HasDerivAt (fun s : ℝ => (s, y)) ((1 : ℝ), (0 : V)) t := |
| 73 | (hasDerivAt_id t).prodMk (hasDerivAt_const t y) |
| 74 | have hd := (hD.comp_hasDerivAt t htline).clm_comp |
| 75 | (hasDerivAt_const t (ContinuousLinearMap.inr ℝ ℝ V)) |
| 76 | have heq : (fun s => fderiv ℝ (fun x => f (s, x)) y) =ᶠ[𝓝 t] |
| 77 | (fun s => (fderiv ℝ f (s, y)).comp (ContinuousLinearMap.inr ℝ ℝ V)) := by |
| 78 | filter_upwards [hJ.mem_nhds ht] with s hs |
| 79 | exact spatial_fderiv_eq |
| 80 | ((hf.contDiffAt ((hJ.prod hU).mem_nhds ⟨hs, hy⟩)).differentiableAt (by simp)) |
| 81 | have hkEq : k =ᶠ[𝓝 y] (fun x => fderiv ℝ f (t, x) (1, 0)) := by |
| 82 | filter_upwards [hU.mem_nhds hy] with x hx |
| 83 | have hfx : DifferentiableAt ℝ f (t, x) := |
| 84 | (hf.contDiffAt ((hJ.prod hU).mem_nhds ⟨ht, hx⟩)).differentiableAt (by simp) |
| 85 | exact (hk x hx).unique (hfx.hasFDerivAt.comp_hasDerivAt t |
| 86 | ((hasDerivAt_id t).prodMk (hasDerivAt_const t x))) |
| 87 | have hspace := hD.comp y ((hasFDerivAt_const t y).prodMk (hasFDerivAt_id y)) |
| 88 | have hK := hspace.clm_apply (hasFDerivAt_const ((1 : ℝ), (0 : V)) y) |
| 89 | dsimp only [Function.comp_def] at hK |
| 90 | apply (hd.congr_of_eventuallyEq heq).congr_deriv |
| 91 | rw [hkEq.fderiv_eq, hK.fderiv] |
| 92 | ext v |
| 93 | simpa using (hsmooth.isSymmSndFDerivAt (by norm_num)).eq |
| 94 | ((1 : ℝ), (0 : V)) ((0 : ℝ), v) |
| 95 | |
| 96 | theorem contDiffOn_spatialJet {f : ℝ × V → E} {J : Set ℝ} {U : Set V} |
| 97 | (hf : ContDiffOn ℝ ∞ f (J ×ˢ U)) (hJ : IsOpen J) (hU : IsOpen U) (m : ℕ) : |
| 98 | ContDiffOn ℝ ∞ (fun z : ℝ × V => iteratedFDeriv ℝ m (fun x => f (z.1, x)) z.2) |
| 99 | (J ×ˢ U) := by |
| 100 | induction m with |
| 101 | | zero => |
| 102 | let e := (continuousMultilinearCurryFin0 ℝ V E).symm.toContinuousLinearEquiv |
| 103 | exact e.toContinuousLinearMap.contDiff.comp_contDiffOn hf |
| 104 | | succ m ih => |
| 105 | let e := (continuousMultilinearCurryLeftEquiv ℝ (fun _ : Fin (m + 1) => V) E).symm |
| 106 | convert! e.toContinuousLinearEquiv.toContinuousLinearMap.contDiff.comp_contDiffOn |
| 107 | (contDiffOn_spatialFDeriv ih hJ hU) using 1 |
| 108 | |
| 109 | /-- One time derivative commutes with every spatial jet. -/ |
| 110 | theorem hasDerivAt_spatialJet {f : ℝ × V → E} {k : V → E} |
| 111 | {J : Set ℝ} {U : Set V} (hf : ContDiffOn ℝ ∞ f (J ×ˢ U)) |
| 112 | (hJ : IsOpen J) (hU : IsOpen U) {t : ℝ} (ht : t ∈ J) |
| 113 | (hk : ∀ x ∈ U, HasDerivAt (fun s => f (s, x)) (k x) t) |
| 114 | (m : ℕ) {y : V} (hy : y ∈ U) : |
| 115 | HasDerivAt (fun s => iteratedFDeriv ℝ m (fun x => f (s, x)) y) |
| 116 | (iteratedFDeriv ℝ m k y) t := by |
| 117 | induction m generalizing y with |
| 118 | | zero => |
| 119 | let e := (continuousMultilinearCurryFin0 ℝ V E).symm.toContinuousLinearEquiv |
| 120 | exact e.toContinuousLinearMap.hasFDerivAt.comp_hasDerivAt t (hk y hy) |
| 121 | | succ m ih => |
| 122 | have hd := hasDerivAt_spatialFDeriv (contDiffOn_spatialJet hf hJ hU m) |
| 123 | hJ hU ht (fun x hx => ih hx) hy |
| 124 | let e := (continuousMultilinearCurryLeftEquiv ℝ (fun _ : Fin (m + 1) => V) E).symm |
| 125 | convert! e.toContinuousLinearEquiv.toContinuousLinearMap.hasFDerivAt.comp_hasDerivAt t hd |
| 126 | using 1 |
| 127 | |
| 128 | end PoincareMT.SpacetimeBounds |
| 129 | |
| 130 | namespace PoincareMT.RicciFlow |
| 131 | |
| 132 | variable {n : ℕ} {M : Type*} [TopologicalSpace M] |
| 133 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 134 | {J : Set ℝ} |
| 135 | |
| 136 | /-- The actual Ricci-flow equation differentiated to every spatial order in |
| 137 | one fixed smooth chart, with no derivative identity assumed as input. -/ |
| 138 | theorem hasDerivAt_spatialJet_pullbackCoefficients_apply (F : RicciFlow n M J) |
| 139 | (hJ : IsOpen J) {U : Set (EuclideanSpace ℝ (Fin n))} (hU : IsOpen U) |
| 140 | {e : EuclideanSpace ℝ (Fin n) → M} |
| 141 | (he : ContMDiffOn (𝓡 n) (𝓡 n) ∞ e U) |
| 142 | {t : ℝ} (ht : t ∈ J) (m : ℕ) |
| 143 | {x : EuclideanSpace ℝ (Fin n)} (hx : x ∈ U) |
| 144 | (u v : EuclideanSpace ℝ (Fin n)) : |
| 145 | HasDerivAt (fun s => iteratedFDeriv ℝ m |
| 146 | (fun y => (F.metric s).pullbackCoefficients e y u v) x) |
| 147 | (iteratedFDeriv ℝ m (fun y => -2 * (F.connection t).ricci (e y) |
| 148 | (mfderiv (𝓡 n) (𝓡 n) e y u) (mfderiv (𝓡 n) (𝓡 n) e y v)) x) t := by |
| 149 | apply SpacetimeBounds.hasDerivAt_spatialJet |
| 150 | (((F.contDiffOn_pullbackCoefficients hJ hU he).clm_apply contDiffOn_const).clm_apply |
| 151 | contDiffOn_const) hJ hU ht _ m hx |
| 152 | intro y _ |
| 153 | exact (F.equation t ht (e y) (mfderiv (𝓡 n) (𝓡 n) e y u) |
| 154 | (mfderiv (𝓡 n) (𝓡 n) e y v)).hasDerivAt (hJ.mem_nhds ht) |
| 155 | |
| 156 | end PoincareMT.RicciFlow |