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.Generalized.ReducedGeometry.SourceNames.ReducedLength |
| 2 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.SourceNames.Realization |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Calculus.Manifold.OpenSubsetChart |
| 4 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Tensor.LocalCenteredHessian |
| 5 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Variation.Differential.SecondDerivativeComposition |
| 6 | |
| 7 | /-! |
| 8 | # The actual Hessian chain rule on an open spatial subset |
| 9 | |
| 10 | The centered Hessian and scalar second-derivative chain rule retain the |
| 11 | same connection correction. This is the coordinate step in Morgan-Tian |
| 12 | Proposition 6.33 and Lemma 6.40, pp. 120-121, 126-127. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | -- The tangent fibers of an open subset have their ambient model coordinates. |
| 17 | set_option backward.isDefEq.respectTransparency false |
| 18 | |
| 19 | open Set Filter |
| 20 | open scoped Manifold ContDiff Topology |
| 21 | |
| 22 | namespace PoincareMT.M14 |
| 23 | |
| 24 | variable {n : ℕ} (U : TopologicalSpace.Opens (EuclideanSpace ℝ (Fin n))) |
| 25 | |
| 26 | /-- Centered chart fields are the actual constant ambient fields on |
| 27 | an open spatial subset, Lemma 6.40, pp. 126-127. -/ |
| 28 | theorem openSubset_chartVectorField (x y : U) (v : EuclideanSpace ℝ (Fin n)) : |
| 29 | Proofs.M09.chartVectorField x v y = v := by |
| 30 | change (mfderiv (𝓡 n) (𝓡 n) |
| 31 | (Subtype.val : U → EuclideanSpace ℝ (Fin n)) y).inverse v = v |
| 32 | rw [Proofs.M11.mfderiv_openSubtype_val] |
| 33 | change (ContinuousLinearMap.id ℝ (EuclideanSpace ℝ (Fin n))).inverse v = v |
| 34 | simp |
| 35 | |
| 36 | /-- The second derivative along a smooth spatial curve is the actual |
| 37 | Hessian plus the scalar differential on its coordinate acceleration, |
| 38 | Proposition 6.33 and Lemma 6.40, pp. 120-121, 126-127. -/ |
| 39 | theorem openSubset_secondDeriv_comp {g : RiemannianMetric n U} |
| 40 | (D : LeviCivitaData g) (f : U → ℝ) (O : Set U) (hO : IsOpen O) |
| 41 | (hf : ContMDiffOn (𝓡 n) (𝓘(ℝ, ℝ)) ∞ f O) |
| 42 | (y : ℝ → U) {s : ℝ} (hy : ContMDiffAt (𝓘(ℝ, ℝ)) (𝓡 n) ∞ y s) |
| 43 | (hp : y s ∈ O) : |
| 44 | deriv (deriv (fun r => f (y r))) s = |
| 45 | D.hessian f (y s) (deriv (fun r => (y r).val) s) (deriv (fun r => (y r).val) s) + |
| 46 | mvfderiv (𝓡 n) f (y s) |
| 47 | (deriv (deriv (fun r => (y r).val)) s + |
| 48 | (show EuclideanSpace ℝ (Fin n) from |
| 49 | D.connection (fun _ : U => deriv (fun r => (y r).val) s) (y s) |
| 50 | (deriv (fun r => (y r).val) s))) := by |
| 51 | let p := y s |
| 52 | let e := chartAt (EuclideanSpace ℝ (Fin n)) p |
| 53 | let q : ℝ → EuclideanSpace ℝ (Fin n) := fun r => (y r).val |
| 54 | let φ : EuclideanSpace ℝ (Fin n) → ℝ := fun z => f (e.symm z) |
| 55 | have hφ : ContDiffAt ℝ ∞ φ p.val := by |
| 56 | have he : ContMDiffAt (𝓡 n) (𝓡 n) ∞ e.symm p.val := |
| 57 | contMDiffOn_chart_symm.contMDiffAt (e.open_target.mem_nhds (by |
| 58 | rw [U.chartAt_target_eq] |
| 59 | exact p.property)) |
| 60 | have hp' : e.symm p.val ∈ O := by |
| 61 | rw [U.chartAt_symm_apply_val] |
| 62 | exact hp |
| 63 | exact ((hf.contMDiffAt (hO.mem_nhds hp')).comp p.val he).contDiffAt |
| 64 | have hq : ContDiffAt ℝ ∞ q s := (contMDiff_subtype_val.contMDiffAt.comp s hy).contDiffAt |
| 65 | have heq : f =ᶠ[𝓝 p] (fun z => φ (e z)) := Eventually.of_forall (fun z => by |
| 66 | dsimp only [φ, e] |
| 67 | rw [U.chartAt_apply_eq_val, U.chartAt_symm_apply_val]) |
| 68 | have hfirst (v : EuclideanSpace ℝ (Fin n)) : |
| 69 | mvfderiv (𝓡 n) f p v = fderiv ℝ φ p.val v := |
| 70 | Proofs.M09.mvfderiv_centeredChart_of_eventuallyEq p f φ |
| 71 | (hφ.differentiableAt (by simp)) heq v |
| 72 | have hH := Proofs.M09.hessian_centeredCoordinates_local D f p O hO hp hf |
| 73 | (deriv q s) (deriv q s) |
| 74 | have hconst : Proofs.M09.chartVectorField p (deriv q s) = |
| 75 | fun _ : U => deriv q s := funext (fun z => openSubset_chartVectorField U p z _) |
| 76 | have hDφ := ((hφ.fderiv_right (m := ∞) (by simp)).differentiableAt (by simp)).hasFDerivAt |
| 77 | have heval : fderiv ℝ (fun z => fderiv ℝ φ z (deriv q s)) p.val (deriv q s) = |
| 78 | fderiv ℝ (fderiv ℝ φ) p.val (deriv q s) (deriv q s) := by |
| 79 | simpa using congrArg (fun L => L (deriv q s)) |
| 80 | (hDφ.clm_apply (hasFDerivAt_const (deriv q s) p.val)).fderiv |
| 81 | change D.hessian f p (deriv q s) (deriv q s) = |
| 82 | fderiv ℝ (fun z => fderiv ℝ φ z (deriv q s)) p.val (deriv q s) - |
| 83 | fderiv ℝ φ p.val (D.connection (Proofs.M09.chartVectorField p (deriv q s)) p |
| 84 | (deriv q s)) at hH |
| 85 | rw [heval, hconst] at hH |
| 86 | have hcomp : (fun r => f (y r)) = fun r => φ (q r) := funext (fun r => by |
| 87 | dsimp only [φ, q, e] |
| 88 | rw [U.chartAt_symm_apply_val]) |
| 89 | rw [hcomp, Proofs.M09.secondDeriv_comp φ q s hφ hq] |
| 90 | change _ = D.hessian f p (deriv q s) (deriv q s) + |
| 91 | mvfderiv (𝓡 n) f p (deriv (deriv q) s + (show EuclideanSpace ℝ (Fin n) from |
| 92 | D.connection (fun _ : U => deriv q s) p (deriv q s))) |
| 93 | rw [hH, hfirst, map_add] |
| 94 | ring |
| 95 | |
| 96 | end PoincareMT.M14 |