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.ContDiff.Operations |
| 2 | |
| 3 | /-! |
| 4 | # Fixed-parameter derivatives of a scalar family |
| 5 | |
| 6 | The parameter remains fixed in both the spatial and time slices. |
| 7 | -/ |
| 8 | |
| 9 | set_option autoImplicit false |
| 10 | |
| 11 | open scoped ContDiff Topology |
| 12 | open Filter |
| 13 | |
| 14 | namespace PoincareMT.ReducedLength |
| 15 | |
| 16 | variable {P E : Type*} [NormedAddCommGroup P] [NormedSpace ℝ P] |
| 17 | [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 18 | |
| 19 | def parametricSpatialInjection : E →L[ℝ] (P × E) × ℝ := |
| 20 | ((0 : E →L[ℝ] P).prod (ContinuousLinearMap.id ℝ E)).prod 0 |
| 21 | |
| 22 | noncomputable def parametricSpatialCovector (C : (P × E) × ℝ → ℝ) |
| 23 | (z : (P × E) × ℝ) : E →L[ℝ] ℝ := |
| 24 | (fderiv ℝ C z).comp parametricSpatialInjection |
| 25 | |
| 26 | noncomputable def parametricSpatialSecond (C : (P × E) × ℝ → ℝ) |
| 27 | (z : (P × E) × ℝ) : E →L[ℝ] E →L[ℝ] ℝ := |
| 28 | (fderiv ℝ (parametricSpatialCovector C) z).comp parametricSpatialInjection |
| 29 | |
| 30 | theorem parametricSpatialCovector_smooth (C : (P × E) × ℝ → ℝ) |
| 31 | (U : Set ((P × E) × ℝ)) (hU : IsOpen U) (hC : ContDiffOn ℝ ∞ C U) : |
| 32 | ContDiffOn ℝ ∞ (parametricSpatialCovector C) U := |
| 33 | (hC.fderiv_of_isOpen hU (m := ∞) (by simp)).clm_comp contDiffOn_const |
| 34 | |
| 35 | theorem parametricSpatialSecond_smooth (C : (P × E) × ℝ → ℝ) |
| 36 | (U : Set ((P × E) × ℝ)) (hU : IsOpen U) (hC : ContDiffOn ℝ ∞ C U) : |
| 37 | ContDiffOn ℝ ∞ (parametricSpatialSecond C) U := |
| 38 | ((parametricSpatialCovector_smooth C U hU hC).fderiv_of_isOpen hU |
| 39 | (m := ∞) (by simp)).clm_comp contDiffOn_const |
| 40 | |
| 41 | theorem fderiv_parametric_spatial_slice (C : (P × E) × ℝ → ℝ) |
| 42 | (a : P) (y : E) (t : ℝ) (hC : DifferentiableAt ℝ C ((a, y), t)) : |
| 43 | fderiv ℝ (fun v ↦ C ((a, v), t)) y = parametricSpatialCovector C ((a, y), t) := by |
| 44 | exact (hC.hasFDerivAt.comp y |
| 45 | (((hasFDerivAt_const a y).prodMk (hasFDerivAt_id y)).prodMk |
| 46 | (hasFDerivAt_const t y))).fderiv |
| 47 | |
| 48 | theorem fderiv_parametric_spatial_second (C : (P × E) × ℝ → ℝ) |
| 49 | (U : Set ((P × E) × ℝ)) (hU : IsOpen U) (hC : ContDiffOn ℝ ∞ C U) |
| 50 | (a : P) (y : E) (t : ℝ) (hz : ((a, y), t) ∈ U) : |
| 51 | fderiv ℝ (fderiv ℝ (fun v ↦ C ((a, v), t))) y = |
| 52 | parametricSpatialSecond C ((a, y), t) := by |
| 53 | have hi : Continuous (fun v : E ↦ ((a, v), t)) := |
| 54 | (continuous_const.prodMk continuous_id).prodMk continuous_const |
| 55 | have heq : fderiv ℝ (fun v ↦ C ((a, v), t)) =ᶠ[𝓝 y] |
| 56 | (fun v ↦ parametricSpatialCovector C ((a, v), t)) := by |
| 57 | filter_upwards [hi.continuousAt.preimage_mem_nhds (hU.mem_nhds hz)] with v hv |
| 58 | exact fderiv_parametric_spatial_slice C a v t |
| 59 | ((hC.contDiffAt (hU.mem_nhds hv)).differentiableAt (by simp)) |
| 60 | rw [heq.fderiv_eq] |
| 61 | have hD := ((parametricSpatialCovector_smooth C U hU hC).contDiffAt |
| 62 | (hU.mem_nhds hz)).differentiableAt (by simp) |
| 63 | have hslice : HasFDerivAt (fun v : E ↦ ((a, v), t)) |
| 64 | parametricSpatialInjection y := |
| 65 | ((hasFDerivAt_const a y).prodMk (hasFDerivAt_id y)).prodMk |
| 66 | (hasFDerivAt_const t y) |
| 67 | exact (hD.hasFDerivAt.comp y hslice).fderiv |
| 68 | |
| 69 | theorem deriv_parametric_time_slice (C : (P × E) × ℝ → ℝ) |
| 70 | (a : P) (y : E) (t : ℝ) (hC : DifferentiableAt ℝ C ((a, y), t)) : |
| 71 | deriv (fun s ↦ C ((a, y), s)) t = fderiv ℝ C ((a, y), t) ((0, 0), 1) := by |
| 72 | have h := (hC.hasFDerivAt.comp t |
| 73 | ((hasFDerivAt_const (a, y) t).prodMk (hasFDerivAt_id t))).hasDerivAt |
| 74 | exact h.deriv |
| 75 | |
| 76 | end PoincareMT.ReducedLength |