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 Mathlib.Analysis.Calculus.ContDiff.Basic |
| 3 | import Mathlib.Analysis.Calculus.ContDiff.Operations |
| 4 | import Mathlib.Analysis.Calculus.ContDiff.FTaylorSeries |
| 5 | import Mathlib.Analysis.Calculus.TangentCone.Prod |
| 6 | import Mathlib.Topology.UniformSpace.UniformConvergence |
| 7 | |
| 8 | /-! |
| 9 | # Spatial derivatives at included times |
| 10 | |
| 11 | The spatial derivatives of a function smooth within a time-space product |
| 12 | are restrictions of its within derivatives, even at an included endpoint. |
| 13 | This is the analytic bridge used for Morgan--Tian Proposition 9.79(4), |
| 14 | printed pp. 233-234, with the convergence of Proposition 5.14, pp. 90-91. |
| 15 | See task derivation `05-persistence-spatial-jets.md`. |
| 16 | -/ |
| 17 | |
| 18 | set_option autoImplicit false |
| 19 | |
| 20 | open Set Filter |
| 21 | open scoped ContDiff Topology Pointwise |
| 22 | |
| 23 | variable {𝕜 T E F : Type*} [NontriviallyNormedField 𝕜] |
| 24 | [NormedAddCommGroup T] [NormedSpace 𝕜 T] |
| 25 | [NormedAddCommGroup E] [NormedSpace 𝕜 E] |
| 26 | [NormedAddCommGroup F] [NormedSpace 𝕜 F] |
| 27 | |
| 28 | /-- Spatial jets are restrictions of within jets on a product, including at |
| 29 | time endpoints; Morgan--Tian Proposition 9.79(4), printed pp. 233-234. -/ |
| 30 | theorem iteratedFDeriv_spatial_slice_eq_within |
| 31 | {J : Set T} {U : Set E} {f : T × E → F} {n : ℕ∞ω} |
| 32 | (hJ : UniqueDiffOn 𝕜 J) (hU : IsOpen U) |
| 33 | (hf : ContDiffOn 𝕜 n f (J ×ˢ U)) |
| 34 | {t : T} (ht : t ∈ J) {x : E} (hx : x ∈ U) |
| 35 | {r : ℕ} (hr : r ≤ n) : |
| 36 | iteratedFDeriv 𝕜 r (fun y => f (t, y)) x = |
| 37 | (iteratedFDerivWithin 𝕜 r f (J ×ˢ U) (t, x)).compContinuousLinearMap |
| 38 | (fun _ => ContinuousLinearMap.inr 𝕜 T E) := by |
| 39 | let a : T × E := (t, 0) |
| 40 | let ι : E →L[𝕜] T × E := ContinuousLinearMap.inr 𝕜 T E |
| 41 | let S : Set (T × E) := (fun z => a + z) ⁻¹' (J ×ˢ U) |
| 42 | have hSimage : S = (fun z => -a + z) '' (J ×ˢ U) := by |
| 43 | ext z |
| 44 | constructor |
| 45 | · intro hz |
| 46 | exact ⟨a + z, hz, by simp⟩ |
| 47 | · rintro ⟨y, hy, rfl⟩ |
| 48 | simpa [S] using hy |
| 49 | have hS : UniqueDiffOn 𝕜 S := by |
| 50 | rw [hSimage] |
| 51 | exact (hJ.prod hU.uniqueDiffOn).image |
| 52 | (fun z _ => ((hasFDerivAt_id (𝕜 := 𝕜) z).const_add (-a)).hasFDerivWithinAt) |
| 53 | (fun _ _ => Function.surjective_id.denseRange) |
| 54 | have hshift : ContDiffOn 𝕜 n (fun z : T × E => f (a + z)) S := |
| 55 | hf.comp (contDiff_const.add contDiff_id).contDiffOn (fun _ hz => hz) |
| 56 | have hpre : ι ⁻¹' S = U := by |
| 57 | ext y |
| 58 | simp [S, a, ι, ht] |
| 59 | have hmem : ι x ∈ S := by |
| 60 | simpa [S, a, ι, ht] using hx |
| 61 | have htranslate : a +ᵥ S = J ×ˢ U := by |
| 62 | ext y |
| 63 | rw [Set.mem_vadd_set_iff_neg_vadd_mem] |
| 64 | simp [S] |
| 65 | have hcomp := ι.iteratedFDerivWithin_comp_right hshift hS |
| 66 | (hpre.symm ▸ hU.uniqueDiffOn) hmem hr |
| 67 | rw [hpre, iteratedFDerivWithin_of_isOpen _ hU hx, |
| 68 | iteratedFDerivWithin_comp_add_left, htranslate] at hcomp |
| 69 | simpa [a, ι, Function.comp_def] using hcomp |
| 70 | |
| 71 | /-- Uniform within-jet convergence gives uniform spatial-jet convergence |
| 72 | on the same tested set; Morgan--Tian Proposition 9.79(4), pp. 233-234. -/ |
| 73 | theorem TendstoUniformlyOn.iteratedFDeriv_spatial_slice |
| 74 | {α : Type*} {l : Filter α} {J : Set T} {U : Set E} {K : Set (T × E)} |
| 75 | {f : α → T × E → F} {g : T × E → F} {n : ℕ∞ω} {r : ℕ} |
| 76 | (hjet : TendstoUniformlyOn |
| 77 | (fun k => iteratedFDerivWithin 𝕜 r (f k) (J ×ˢ U)) |
| 78 | (iteratedFDerivWithin 𝕜 r g (J ×ˢ U)) l K) |
| 79 | (hJ : UniqueDiffOn 𝕜 J) (hU : IsOpen U) (hK : K ⊆ J ×ˢ U) |
| 80 | (hf : ∀ᶠ k in l, ContDiffOn 𝕜 n (f k) (J ×ˢ U)) |
| 81 | (hg : ContDiffOn 𝕜 n g (J ×ˢ U)) (hr : r ≤ n) : |
| 82 | TendstoUniformlyOn |
| 83 | (fun k p => iteratedFDeriv 𝕜 r (fun y => f k (p.1, y)) p.2) |
| 84 | (fun p => iteratedFDeriv 𝕜 r (fun y => g (p.1, y)) p.2) l K := by |
| 85 | let R := ContinuousMultilinearMap.compContinuousLinearMapL |
| 86 | (F := F) (fun _ : Fin r => ContinuousLinearMap.inr 𝕜 T E) |
| 87 | have h := R.uniformContinuous.comp_tendstoUniformlyOn hjet |
| 88 | apply (h.congr ?_).congr_right ?_ |
| 89 | · filter_upwards [hf] with k hk p hp |
| 90 | exact (iteratedFDeriv_spatial_slice_eq_within hJ hU hk |
| 91 | (hK hp).1 (hK hp).2 hr).symm |
| 92 | · intro p hp |
| 93 | exact (iteratedFDeriv_spatial_slice_eq_within hJ hU hg |
| 94 | (hK hp).1 (hK hp).2 hr).symm |