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 | import Mathlib.Topology.UniformSpace.UniformConvergence |
| 3 | |
| 4 | /-! |
| 5 | # Assembling smooth limits on an open exhaustion |
| 6 | |
| 7 | Local smooth limits of the same sequence agree on overlaps. Their germs |
| 8 | therefore define one smooth limit, and compact containment transfers |
| 9 | uniform convergence of every derivative to the whole domain. This is |
| 10 | the fixed-coordinate assembly in Morgan-Tian Theorem 12.5, p. 297. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open Set Filter |
| 16 | open scoped ContDiff Topology |
| 17 | |
| 18 | /-- Compatible local smooth limits on an open exhaustion assemble into one |
| 19 | smooth limit with compact-uniform derivative convergence |
| 20 | (Theorem 12.5, p. 297, fixed-coordinate assembly). -/ |
| 21 | theorem exists_contDiffOn_limit_of_open_exhaustion |
| 22 | {𝕜 : Type*} [NontriviallyNormedField 𝕜] |
| 23 | {ι E F : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] |
| 24 | [NormedAddCommGroup F] [NormedSpace 𝕜 F] |
| 25 | {Ω : Set E} {U : ι → Set E} (hU : ∀ i, IsOpen (U i)) |
| 26 | (hsub : ∀ i, U i ⊆ Ω) (hcover : ∀ x ∈ Ω, ∃ i, x ∈ U i) |
| 27 | (hcompact : ∀ K, IsCompact K → K ⊆ Ω → ∃ i, K ⊆ U i) |
| 28 | {f : ℕ → E → F} {g : ι → E → F} |
| 29 | (hg : ∀ i, ContDiffOn 𝕜 ∞ (g i) (U i)) |
| 30 | (hconv : ∀ i m K, IsCompact K → K ⊆ U i → |
| 31 | TendstoUniformlyOn (fun k => iteratedFDeriv 𝕜 m (f k)) |
| 32 | (iteratedFDeriv 𝕜 m (g i)) atTop K) : |
| 33 | ∃ G : E → F, ContDiffOn 𝕜 ∞ G Ω ∧ |
| 34 | ∀ m K, IsCompact K → K ⊆ Ω → |
| 35 | TendstoUniformlyOn (fun k => iteratedFDeriv 𝕜 m (f k)) |
| 36 | (iteratedFDeriv 𝕜 m G) atTop K := by |
| 37 | classical |
| 38 | have hpoint (i : ι) {x : E} (hx : x ∈ U i) : |
| 39 | Tendsto (fun k => f k x) atTop (𝓝 (g i x)) := by |
| 40 | have hev := ContinuousMultilinearMap.uniformContinuous_eval_const |
| 41 | (𝕜 := 𝕜) (F := F) (0 : Fin 0 → E) |
| 42 | have h := hev.comp_tendstoUniformlyOn |
| 43 | (hconv i 0 {x} isCompact_singleton (singleton_subset_iff.mpr hx)) |
| 44 | simpa only [Function.comp_def, iteratedFDeriv_zero_apply] using |
| 45 | h.tendsto_at (mem_singleton x) |
| 46 | have hcompat (i j : ι) {x : E} (hi : x ∈ U i) (hj : x ∈ U j) : g i x = g j x := |
| 47 | tendsto_nhds_unique (hpoint i hi) (hpoint j hj) |
| 48 | let G : E → F := fun x => if hx : x ∈ Ω then g (hcover x hx).choose x else 0 |
| 49 | have heq (i : ι) : EqOn G (g i) (U i) := by |
| 50 | intro x hx |
| 51 | have hxΩ := hsub i hx |
| 52 | simp only [G, dif_pos hxΩ] |
| 53 | exact hcompat _ i (hcover x hxΩ).choose_spec hx |
| 54 | have hgerm (i : ι) {x : E} (hx : x ∈ U i) : G =ᶠ[𝓝 x] g i := by |
| 55 | filter_upwards [(hU i).mem_nhds hx] with y hy |
| 56 | exact heq i hy |
| 57 | refine ⟨G, ?_, ?_⟩ |
| 58 | · intro x hx |
| 59 | obtain ⟨i, hi⟩ := hcover x hx |
| 60 | exact (((hg i).contDiffAt ((hU i).mem_nhds hi)).congr_of_eventuallyEq |
| 61 | (hgerm i hi)).contDiffWithinAt |
| 62 | · intro m K hK hKΩ |
| 63 | obtain ⟨i, hKi⟩ := hcompact K hK hKΩ |
| 64 | apply (hconv i m K hK hKi).congr_right |
| 65 | intro x hx |
| 66 | exact ((hgerm i (hKi hx)).iteratedFDeriv (𝕜 := 𝕜) m).eq_of_nhds.symm |