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 Mathlib.Analysis.Calculus.FDeriv.Symmetric |
| 2 | import Mathlib.Analysis.Calculus.FDeriv.CompCLM |
| 3 | import Mathlib.Analysis.Calculus.Deriv.Prod |
| 4 | |
| 5 | /-! |
| 6 | # Time and spatial differentiation of a smooth family |
| 7 | |
| 8 | Schwarz's theorem identifies the derivative of an actual spatial |
| 9 | directional derivative with the spatial derivative of the time partial. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | set_option maxSynthPendingDepth 3 |
| 14 | set_option maxHeartbeats 800000 |
| 15 | |
| 16 | open scoped ContDiff |
| 17 | |
| 18 | namespace PoincareMT.ReducedLength |
| 19 | |
| 20 | variable {E V : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 21 | [NormedAddCommGroup V] [NormedSpace ℝ V] |
| 22 | |
| 23 | theorem hasDerivAt_spatialDerivative_time (G : ℝ × E → V) (s : ℝ) (y v : E) |
| 24 | (hG : ContDiffAt ℝ ∞ G (s, y)) : |
| 25 | HasDerivAt (fun r ↦ fderiv ℝ G (r, y) (0, v)) |
| 26 | (fderiv ℝ (fun x ↦ fderiv ℝ G (s, x) (1, 0)) y v) s := by |
| 27 | have hDG : DifferentiableAt ℝ (fderiv ℝ G) (s, y) := |
| 28 | (hG.fderiv_right (m := ∞) (by simp)).differentiableAt (by simp) |
| 29 | have htime : HasDerivAt (fun r ↦ fderiv ℝ G (r, y) (0, v)) |
| 30 | (fderiv ℝ (fderiv ℝ G) (s, y) (1, 0) (0, v)) s := by |
| 31 | simpa using (hDG.hasFDerivAt.comp_hasDerivAt s |
| 32 | ((hasDerivAt_id s).prodMk (hasDerivAt_const s y))).clm_apply |
| 33 | (hasDerivAt_const s ((0, v) : ℝ × E)) |
| 34 | have hspace := (hDG.hasFDerivAt.comp y |
| 35 | ((hasFDerivAt_const s y).prodMk (hasFDerivAt_id y))).clm_apply |
| 36 | (hasFDerivAt_const ((1, 0) : ℝ × E) y) |
| 37 | have hvalue : fderiv ℝ (fun x ↦ fderiv ℝ G (s, x) (1, 0)) y v = |
| 38 | fderiv ℝ (fderiv ℝ G) (s, y) (0, v) (1, 0) := by |
| 39 | simpa using congrArg (fun L : E →L[ℝ] V ↦ L v) hspace.fderiv |
| 40 | have htwo : (2 : ℕ∞ω) ≤ ∞ := ENat.natCast_le_of_coe_top_le_withTop le_rfl 2 |
| 41 | rw [(hG.isSymmSndFDerivAt (by simpa using htwo)) ((1, 0) : ℝ × E) (0, v)] at htime |
| 42 | exact htime.congr_deriv hvalue.symm |
| 43 | |
| 44 | end PoincareMT.ReducedLength |