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.Soliton.TwoDimensional.Compact.Gradient |
| 2 | import PoincareLib.Geometry.Riemannian.ScalarOperators.Hessian.Pullback |
| 3 | |
| 4 | /-! |
| 5 | # Pulling back a twice differentiable soliton potential |
| 6 | |
| 7 | The Hessian naturality proof needs only a continuously differentiable |
| 8 | gradient, so it applies to the frozen `C2` soliton potential. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | set_option backward.isDefEq.respectTransparency false |
| 13 | |
| 14 | open scoped Manifold ContDiff Bundle Topology |
| 15 | open Bundle Filter VectorField |
| 16 | |
| 17 | namespace PoincareMT.LeviCivitaData |
| 18 | |
| 19 | universe u v |
| 20 | |
| 21 | variable {n : ℕ} {M : Type u} {N : Type v} |
| 22 | [TopologicalSpace M] [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 23 | [IsManifold (𝓡 n) ∞ M] |
| 24 | [TopologicalSpace N] [ChartedSpace (EuclideanSpace ℝ (Fin n)) N] |
| 25 | [IsManifold (𝓡 n) ∞ N] |
| 26 | {g : RiemannianMetric n M} {h : RiemannianMetric n N} |
| 27 | {f : M → N} {x : M} {u : N → ℝ} |
| 28 | |
| 29 | theorem hessian_comp_of_metric_pullback_of_C2 |
| 30 | (D : LeviCivitaData g) (D' : LeviCivitaData h) |
| 31 | (hf : ContMDiffAt (𝓡 n) (𝓡 n) ∞ f x) |
| 32 | (hinv : ∀ᶠ y in 𝓝 x, (mfderiv (𝓡 n) (𝓡 n) f y).IsInvertible) |
| 33 | (hmetric : ∀ᶠ y in 𝓝 x, ∀ a b : TangentSpace (𝓡 n) y, |
| 34 | g.inner y a b = h.inner (f y) |
| 35 | (mfderiv (𝓡 n) (𝓡 n) f y a) (mfderiv (𝓡 n) (𝓡 n) f y b)) |
| 36 | (hu : ContMDiffAt (𝓡 n) 𝓘(ℝ, ℝ) 2 u (f x)) |
| 37 | (v w : TangentSpace (𝓡 n) x) : |
| 38 | D.hessian (u ∘ f) x v w = D'.hessian u (f x) |
| 39 | (mfderiv (𝓡 n) (𝓡 n) f x v) (mfderiv (𝓡 n) (𝓡 n) f x w) := by |
| 40 | have hf1 := (contMDiffAt_iff_contMDiffAt_nhds (by simp : (1 : ℕ∞ω) ≠ ∞)).mp |
| 41 | (hf.of_le (by norm_cast : (1 : ℕ∞ω) ≤ ∞)) |
| 42 | have hu1 := (contMDiffAt_iff_contMDiffAt_nhds (by simp : (1 : ℕ∞ω) ≠ ∞)).mp |
| 43 | (hu.of_le (by norm_num : (1 : ℕ∞ω) ≤ 2)) |
| 44 | have hgrad : D.gradient (u ∘ f) =ᶠ[𝓝 x] |
| 45 | mpullback (𝓡 n) (𝓡 n) f (D'.gradient u) := by |
| 46 | filter_upwards [hf1, hf.continuousAt.eventually hu1, hinv, hmetric] |
| 47 | with y hfy huy hiy hmy |
| 48 | exact D.gradient_comp_eq_mpullback D' (hfy.mdifferentiableAt (by simp)) |
| 49 | (huy.mdifferentiableAt (by simp)) hiy hmy |
| 50 | have hcomp := hu.comp x (hf.of_le (by norm_cast : (2 : ℕ∞ω) ≤ ∞)) |
| 51 | have hsource := (D.contMDiffAt_one_gradient_of_C2 hcomp).mdifferentiableAt (by norm_num) |
| 52 | have hpull : MDifferentiableAt (𝓡 n) |
| 53 | ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) |
| 54 | (T% (mpullback (𝓡 n) (𝓡 n) f (D'.gradient u))) x := by |
| 55 | apply hsource.congr_of_eventuallyEq |
| 56 | filter_upwards [hgrad] with y hy |
| 57 | simp only [← hy] |
| 58 | have hc := D.connection.isCovariantDerivativeOnUniv.congr_of_eventuallyEq |
| 59 | hsource hpull (by simp) hgrad |
| 60 | rw [D.hessian_eq_inner_connection_gradient_of_C2 hcomp, |
| 61 | D'.hessian_eq_inner_connection_gradient_of_C2 hu, congrArg (fun L ↦ L v) hc, |
| 62 | D.connection_mpullback_of_metric_pullback D' hf hinv hmetric |
| 63 | ((D'.contMDiffAt_one_gradient_of_C2 hu).mdifferentiableAt (by norm_num)), |
| 64 | hmetric.self_of_nhds] |
| 65 | simp only [hinv.self_of_nhds.self_apply_inverse] |
| 66 | |
| 67 | end PoincareMT.LeviCivitaData |