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.ReducedGeometry.ReducedLength.Tensor.CenteredHessian |
| 2 | |
| 3 | /-! |
| 4 | # The centered Hessian with local scalar smoothness |
| 5 | |
| 6 | Only the specified open scalar neighborhood is used in differentiating |
| 7 | the actual chart germ and its first directional derivative. |
| 8 | -/ |
| 9 | |
| 10 | set_option autoImplicit false |
| 11 | set_option maxSynthPendingDepth 3 |
| 12 | |
| 13 | open scoped Manifold ContDiff Bundle Topology |
| 14 | open Filter |
| 15 | |
| 16 | universe u |
| 17 | |
| 18 | namespace PoincareMT.ReducedLength |
| 19 | |
| 20 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 21 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 22 | [IsManifold (𝓡 n) ∞ M] |
| 23 | |
| 24 | local notation "E" => EuclideanSpace ℝ (Fin n) |
| 25 | |
| 26 | set_option backward.isDefEq.respectTransparency false in |
| 27 | theorem hessian_centeredCoordinates_local {g : RiemannianMetric n M} |
| 28 | (D : LeviCivitaData g) (f : M → ℝ) (p : M) (O : Set M) |
| 29 | (hO : IsOpen O) (hpO : p ∈ O) |
| 30 | (hf : ContMDiffOn (𝓡 n) (𝓘(ℝ, ℝ)) ∞ f O) |
| 31 | (U W : TangentSpace (𝓡 n) p) : |
| 32 | let φ : E → ℝ := fun y ↦ f ((chartAt E p).symm y) |
| 33 | D.hessian f p U W = fderiv ℝ (fun y ↦ fderiv ℝ φ y W) ((chartAt E p) p) U - |
| 34 | fderiv ℝ φ ((chartAt E p) p) (D.connection (chartVectorField p W) p U) := by |
| 35 | let e := chartAt E p |
| 36 | let V := e.target ∩ e.symm ⁻¹' O |
| 37 | have he : ContMDiffOn (𝓡 n) (𝓡 n) ∞ e.symm e.target := contMDiffOn_chart_symm |
| 38 | have hV : IsOpen V := he.continuousOn.isOpen_inter_preimage e.open_target hO |
| 39 | have hp : e p ∈ V := ⟨e.map_source (mem_chart_source E p), by |
| 40 | change e.symm (e p) ∈ O |
| 41 | rwa [e.left_inv (mem_chart_source E p)]⟩ |
| 42 | let φ : E → ℝ := fun y ↦ f (e.symm y) |
| 43 | let ψ : E → ℝ := fun y ↦ fderiv ℝ φ y W |
| 44 | have hφ : ContDiffOn ℝ ∞ φ V := |
| 45 | (hf.comp (he.mono Set.inter_subset_left) (fun y hy ↦ hy.2)).contDiffOn |
| 46 | have hψ : ContDiffOn ℝ ∞ ψ V := |
| 47 | (hφ.fderiv_of_isOpen hV (by simp)).clm_apply contDiffOn_const |
| 48 | have heq : f =ᶠ[𝓝 p] (fun q ↦ φ (e q)) := by |
| 49 | filter_upwards [e.open_source.mem_nhds (mem_chart_source E p)] with q hq |
| 50 | exact congrArg f (e.left_inv hq).symm |
| 51 | have hinner : (fun q ↦ mvfderiv (𝓡 n) f q (chartVectorField p W q)) =ᶠ[𝓝 p] |
| 52 | (fun q ↦ ψ (e q)) := by |
| 53 | filter_upwards [(hO.inter e.open_source).mem_nhds ⟨hpO, mem_chart_source E p⟩] with q hq |
| 54 | have hdiff : MDifferentiableAt (𝓡 n) (𝓘(ℝ, ℝ)) f (e.symm (e q)) := by |
| 55 | rw [e.left_inv hq.2] |
| 56 | exact (hf.contMDiffAt (hO.mem_nhds hq.1)).mdifferentiableAt (by simp) |
| 57 | have h := mvfderiv_chartVectorField p f (e q) W (e.map_source hq.2) hdiff |
| 58 | convert! h using 1 |
| 59 | rw [e.left_inv hq.2] |
| 60 | have hfirst := mvfderiv_centeredChart_of_eventuallyEq p |
| 61 | (fun q ↦ mvfderiv (𝓡 n) f q (chartVectorField p W q)) ψ |
| 62 | ((hψ.contDiffAt (hV.mem_nhds hp)).differentiableAt (by simp)) hinner U |
| 63 | have hsecond := mvfderiv_centeredChart_of_eventuallyEq p f φ |
| 64 | ((hφ.contDiffAt (hV.mem_nhds hp)).differentiableAt (by simp)) heq |
| 65 | (D.connection (chartVectorField p W) p U) |
| 66 | rw [hessian_centeredChart, LeviCivitaData.hessianOnFields, chartVectorField_self, |
| 67 | hfirst, hsecond] |
| 68 | |
| 69 | end PoincareMT.ReducedLength |