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.LocalHessianTrace |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Coordinates.CoordinateCompatibility |
| 3 | import Mathlib.Analysis.Calculus.FDeriv.Symmetric |
| 4 | |
| 5 | /-! |
| 6 | # Symmetry of the actual Hessian under local smoothness |
| 7 | |
| 8 | The scalar second derivative and the connection correction are both |
| 9 | identified in the same centered chart before their symmetries are used. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | set_option maxSynthPendingDepth 3 |
| 14 | |
| 15 | open scoped Manifold ContDiff Bundle Topology |
| 16 | open Filter |
| 17 | |
| 18 | universe u |
| 19 | |
| 20 | namespace PoincareMT.ReducedLength |
| 21 | |
| 22 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 23 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 24 | |
| 25 | local notation "E" => EuclideanSpace ℝ (Fin n) |
| 26 | |
| 27 | set_option backward.isDefEq.respectTransparency false in |
| 28 | theorem squareTime_hessian_symmetric_local {J : Set ℝ} (F : RicciFlow n M J) |
| 29 | (T b : ℝ) (hb : 0 < b) (hwindow : Set.Icc (T - b) T ⊆ J) |
| 30 | (p : M) (s : ℝ) (hs : s ∈ Set.Ioo (-Real.sqrt b) (Real.sqrt b)) |
| 31 | (f : M → ℝ) (O : Set M) (hO : IsOpen O) (hpO : p ∈ O) |
| 32 | (hf : ContMDiffOn (𝓡 n) (𝓘(ℝ, ℝ)) ∞ f O) |
| 33 | (v w : TangentSpace (𝓡 n) p) : |
| 34 | (F.connection (T - s ^ 2)).hessian f p v w = |
| 35 | (F.connection (T - s ^ 2)).hessian f p w v := by |
| 36 | let e := chartAt E p |
| 37 | let φ : E → ℝ := fun y ↦ f (e.symm y) |
| 38 | let V := e.target ∩ e.symm ⁻¹' O |
| 39 | have he : ContMDiffOn (𝓡 n) (𝓡 n) ∞ e.symm e.target := contMDiffOn_chart_symm |
| 40 | have hV : IsOpen V := he.continuousOn.isOpen_inter_preimage e.open_target hO |
| 41 | have hy : e p ∈ V := ⟨e.map_source (mem_chart_source E p), by |
| 42 | change e.symm (e p) ∈ O |
| 43 | rwa [e.left_inv (mem_chart_source E p)]⟩ |
| 44 | have hφ : ContDiffAt ℝ ∞ φ (e p) := |
| 45 | ((hf.comp (he.mono Set.inter_subset_left) (fun y hy ↦ hy.2)).contDiffOn).contDiffAt |
| 46 | (hV.mem_nhds hy) |
| 47 | have hD := ((hφ.fderiv_right (m := ∞) (by simp)).differentiableAt (by simp)) |
| 48 | have hd (u z : E) : fderiv ℝ (fun y ↦ fderiv ℝ φ y z) (e p) u = |
| 49 | fderiv ℝ (fderiv ℝ φ) (e p) u z := by |
| 50 | have h := hD.hasFDerivAt.clm_apply (hasFDerivAt_const z (e p)) |
| 51 | simpa using congrArg (fun L : E →L[ℝ] ℝ ↦ L u) h.fderiv |
| 52 | have hG : DifferentiableAt ℝ (squareChartMetric F T p) (s, e p) := |
| 53 | ((squareChartMetric_smooth F T b hb hwindow p).contDiffAt |
| 54 | ((isOpen_Ioo.prod e.open_target).mem_nhds ⟨hs, e.map_source (mem_chart_source E p)⟩)).differentiableAt |
| 55 | (by simp) |
| 56 | have hconn := coordinateConnection_symm (squareChartMetric F T p) (s, e p) hG |
| 57 | (Filter.Eventually.of_forall fun z ↦ squareChartMetric_symm F T p z) v w |
| 58 | rw [hessian_centeredCoordinates_local (F.connection (T - s ^ 2)) f p O hO hpO hf v w, |
| 59 | hessian_centeredCoordinates_local (F.connection (T - s ^ 2)) f p O hO hpO hf w v] |
| 60 | change fderiv ℝ (fun y ↦ fderiv ℝ φ y w) (e p) v - _ = |
| 61 | fderiv ℝ (fun y ↦ fderiv ℝ φ y v) (e p) w - _ |
| 62 | rw [hd v w, hd w v, ← squareChartConnection_at_center F T b hb hwindow p s hs v w, |
| 63 | ← squareChartConnection_at_center F T b hb hwindow p s hs w v, hconn] |
| 64 | congr 1 |
| 65 | have htwo : (2 : ℕ∞ω) ≤ ∞ := ENat.natCast_le_of_coe_top_le_withTop le_rfl 2 |
| 66 | exact hφ.isSymmSndFDerivAt (by simpa using htwo) v w |
| 67 | |
| 68 | end PoincareMT.ReducedLength |