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.Calculus.TimeSpaceDerivative |
| 2 | |
| 3 | /-! |
| 4 | # Actual spatial partials and fixed-time slice derivatives |
| 5 | |
| 6 | The slice chain rule holds on an open neighborhood. Its germ can therefore |
| 7 | be differentiated to identify the partial derivative used in the Jacobi equation. |
| 8 | -/ |
| 9 | |
| 10 | set_option autoImplicit false |
| 11 | set_option maxSynthPendingDepth 3 |
| 12 | |
| 13 | open scoped ContDiff Topology |
| 14 | open Filter |
| 15 | |
| 16 | namespace PoincareMT.ReducedLength |
| 17 | |
| 18 | variable {E V : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 19 | [NormedAddCommGroup V] [NormedSpace ℝ V] |
| 20 | |
| 21 | theorem fderiv_spatialSlice (f : ℝ × E → V) (s : ℝ) (y : E) |
| 22 | (hf : DifferentiableAt ℝ f (s, y)) : |
| 23 | fderiv ℝ (fun x : E ↦ f (s, x)) y = |
| 24 | (fderiv ℝ f (s, y)).comp (ContinuousLinearMap.inr ℝ ℝ E) := by |
| 25 | have h := hf.hasFDerivAt.comp y |
| 26 | ((hasFDerivAt_const s y).prodMk (hasFDerivAt_id y)) |
| 27 | convert h.fderiv using 1 <;> ext u <;> rfl |
| 28 | |
| 29 | set_option backward.isDefEq.respectTransparency false in |
| 30 | theorem fderiv_spatial_bilinear_apply (f : ℝ × E → E →L[ℝ] E →L[ℝ] V) |
| 31 | (s : ℝ) (y u v w : E) (hf : DifferentiableAt ℝ f (s, y)) : |
| 32 | fderiv ℝ (fun x : E ↦ f (s, x) v w) y u = fderiv ℝ f (s, y) (0, u) v w := by |
| 33 | have hi : DifferentiableAt ℝ (fun x : E ↦ (s, x)) y := |
| 34 | (differentiableAt_const s).prodMk differentiableAt_id |
| 35 | have hf' : DifferentiableAt ℝ (fun x : E ↦ f (s, x)) y := hf.comp y hi |
| 36 | have hfirst := hf'.hasFDerivAt.clm_apply (hasFDerivAt_const v y) |
| 37 | have hsecond := hfirst.clm_apply (hasFDerivAt_const w y) |
| 38 | have h := congrArg (fun L : E →L[ℝ] V ↦ L u) hsecond.fderiv |
| 39 | rw [fderiv_spatialSlice f s y hf] at h |
| 40 | simpa using h |
| 41 | |
| 42 | theorem fderiv_spatialPartial_apply (R : ℝ × E → ℝ) (U : Set (ℝ × E)) |
| 43 | (hU : IsOpen U) (hR : ContDiffOn ℝ ∞ R U) (s : ℝ) (y : E) (hz : (s, y) ∈ U) |
| 44 | (v W : E) : |
| 45 | let P : E → E →L[ℝ] ℝ := fun x ↦ |
| 46 | (fderiv ℝ R (s, x)).comp (ContinuousLinearMap.inr ℝ ℝ E) |
| 47 | fderiv ℝ P y v W = fderiv ℝ (fun x ↦ fderiv ℝ (fun q : E ↦ R (s, q)) x W) y v := by |
| 48 | let P : E → E →L[ℝ] ℝ := fun x ↦ |
| 49 | (fderiv ℝ R (s, x)).comp (ContinuousLinearMap.inr ℝ ℝ E) |
| 50 | have hRa := hR.contDiffAt (hU.mem_nhds hz) |
| 51 | have hi : ContDiffAt ℝ ∞ (fun x : E ↦ (s, x)) y := |
| 52 | contDiffAt_const.prodMk contDiffAt_id |
| 53 | have hP : DifferentiableAt ℝ P y := |
| 54 | ((((hRa.fderiv_right (m := ∞) (by simp)).comp y hi).clm_comp |
| 55 | contDiffAt_const).differentiableAt (by simp)) |
| 56 | have heq : (fun x ↦ P x W) =ᶠ[𝓝 y] |
| 57 | (fun x ↦ fderiv ℝ (fun q : E ↦ R (s, q)) x W) := by |
| 58 | filter_upwards [(continuous_const.prodMk continuous_id).continuousAt.preimage_mem_nhds |
| 59 | (hU.mem_nhds hz)] with x hx |
| 60 | rw [fderiv_spatialSlice R s x |
| 61 | ((hR.contDiffAt (hU.mem_nhds hx)).differentiableAt (by simp))] |
| 62 | have h := (hP.hasFDerivAt.clm_apply (hasFDerivAt_const W y)).congr_of_eventuallyEq heq.symm |
| 63 | simpa using (congrArg (fun L : E →L[ℝ] ℝ ↦ L v) h.fderiv).symm |
| 64 | |
| 65 | end PoincareMT.ReducedLength |