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.Generalized.BoundedDistance.GeometryImports |
| 2 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Analysis.Geometry.SpatialJetsWithin |
| 3 | import Mathlib.Analysis.Calculus.Deriv.Prod |
| 4 | import Mathlib.Analysis.Calculus.Deriv.Comp |
| 5 | |
| 6 | /-! |
| 7 | # Time derivatives from actual mixed within jets |
| 8 | |
| 9 | The first within derivative of a spacetime field evaluates on the time |
| 10 | direction to give its actual one-sided time derivative. Uniform first-jet |
| 11 | convergence therefore controls these derivatives without extending a flow |
| 12 | past its included endpoint. This is used to retain the Ricci equation in |
| 13 | Morgan--Tian Proposition 5.14, pp. 90-91; see task derivation 09. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | |
| 18 | open Set Filter |
| 19 | open scoped ContDiff Topology |
| 20 | |
| 21 | /-- A mixed first within derivative evaluated in the time direction is |
| 22 | the actual within-time derivative, also at a time endpoint |
| 23 | (Morgan--Tian Proposition 5.14; task derivation 09). -/ |
| 24 | theorem derivWithin_time_slice_eq_within |
| 25 | {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 26 | [NormedAddCommGroup F] [NormedSpace ℝ F] |
| 27 | {J : Set ℝ} {U : Set E} {f : ℝ × E → F} |
| 28 | (hJ : UniqueDiffOn ℝ J) (hU : IsOpen U) |
| 29 | (hf : ContDiffOn ℝ ∞ f (J ×ˢ U)) |
| 30 | {t : ℝ} (ht : t ∈ J) {x : E} (hx : x ∈ U) : |
| 31 | derivWithin (fun s => f (s, x)) J t = |
| 32 | iteratedFDerivWithin ℝ 1 f (J ×ˢ U) (t, x) (fun _ => (1, 0)) := by |
| 33 | have hd := (hf.differentiableOn (by simp) (t, x) ⟨ht, hx⟩).hasFDerivWithinAt |
| 34 | have hmap : HasDerivWithinAt (fun s : ℝ => (s, x)) (1, 0) J t := |
| 35 | (hasDerivWithinAt_id t J).prodMk (hasDerivWithinAt_const t J x) |
| 36 | have h := hd.comp_hasDerivWithinAt t hmap |
| 37 | (show MapsTo (fun s : ℝ => (s, x)) J (J ×ˢ U) from fun s hs => ⟨hs, hx⟩) |
| 38 | change derivWithin (f ∘ fun s => (s, x)) J t = _ |
| 39 | rw [h.derivWithin (hJ t ht)] |
| 40 | rw [iteratedFDerivWithin_one_apply ((hJ.prod hU.uniqueDiffOn) (t, x) ⟨ht, hx⟩)] |
| 41 | |
| 42 | /-- Uniform first within-jet convergence implies uniform actual time |
| 43 | derivative convergence on the same spacetime test set, including its |
| 44 | included endpoints (task derivation 09). -/ |
| 45 | theorem TendstoUniformlyOn.derivWithin_time_slice |
| 46 | {E F α : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 47 | [NormedAddCommGroup F] [NormedSpace ℝ F] |
| 48 | {l : Filter α} {J : Set ℝ} {U : Set E} {K : Set (ℝ × E)} |
| 49 | {f : α → ℝ × E → F} {g : ℝ × E → F} |
| 50 | (hjet : TendstoUniformlyOn |
| 51 | (fun k => iteratedFDerivWithin ℝ 1 (f k) (J ×ˢ U)) |
| 52 | (iteratedFDerivWithin ℝ 1 g (J ×ˢ U)) l K) |
| 53 | (hJ : UniqueDiffOn ℝ J) (hU : IsOpen U) (hK : K ⊆ J ×ˢ U) |
| 54 | (hf : ∀ᶠ k in l, ContDiffOn ℝ ∞ (f k) (J ×ˢ U)) |
| 55 | (hg : ContDiffOn ℝ ∞ g (J ×ˢ U)) : |
| 56 | TendstoUniformlyOn |
| 57 | (fun k p => derivWithin (fun s => f k (s, p.2)) J p.1) |
| 58 | (fun p => derivWithin (fun s => g (s, p.2)) J p.1) l K := by |
| 59 | let L := ContinuousMultilinearMap.apply ℝ (fun _ : Fin 1 => ℝ × E) F |
| 60 | (fun _ => (1, 0)) |
| 61 | have h := L.uniformContinuous.comp_tendstoUniformlyOn hjet |
| 62 | apply (h.congr ?_).congr_right ?_ |
| 63 | · filter_upwards [hf] with k hk p hp |
| 64 | exact (derivWithin_time_slice_eq_within hJ hU hk (hK hp).1 (hK hp).2).symm |
| 65 | · intro p hp |
| 66 | exact (derivWithin_time_slice_eq_within hJ hU hg (hK hp).1 (hK hp).2).symm |