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.Analysis.Calculus.SmoothCompactness.Pullback |
| 2 | |
| 3 | /-! |
| 4 | # Vanishing errors under bounded coordinate changes |
| 5 | |
| 6 | Smooth compact-uniform convergence to zero survives composition by maps |
| 7 | whose derivatives are locally bounded and whose compact images stay in a |
| 8 | fixed compact subset of the target domain. The coordinate maps need not |
| 9 | converge. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | open Set Filter |
| 14 | open scoped ContDiff Topology |
| 15 | |
| 16 | namespace Poincare.Analysis.Calculus |
| 17 | |
| 18 | theorem smooth_zero_convergence_comp_of_bounded |
| 19 | {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 20 | [FiniteDimensional ℝ E] [NormedAddCommGroup F] [NormedSpace ℝ F] |
| 21 | {U V : Set E} (hV : IsOpen V) |
| 22 | {f : ℕ → E → F} |
| 23 | {g : ℕ → E → E} |
| 24 | (hflocal : ∀ x ∈ U, ∃ W, IsOpen W ∧ x ∈ W ∧ |
| 25 | ∀ᶠ k in atTop, ContDiffOn ℝ ∞ (f k) W) |
| 26 | (hglocal : ∀ x ∈ V, ∃ W, IsOpen W ∧ x ∈ W ∧ |
| 27 | ∀ᶠ k in atTop, ContDiffOn ℝ ∞ (g k) W) |
| 28 | (hfjet : ∀ m K, IsCompact K → K ⊆ U → TendstoUniformlyOn |
| 29 | (fun k => iteratedFDeriv ℝ m (f k)) |
| 30 | (iteratedFDeriv ℝ m (fun _ => (0 : F))) atTop K) |
| 31 | (hgbound : ∀ K, IsCompact K → K ⊆ V → ∀ m, ∃ B : ℝ, |
| 32 | ∀ᶠ i in atTop, ∀ x ∈ K, ‖iteratedFDeriv ℝ m (g i) x‖ ≤ B) |
| 33 | (htarget : ∀ K, IsCompact K → K ⊆ V → ∃ T, |
| 34 | IsCompact T ∧ T ⊆ U ∧ ∀ᶠ k in atTop, MapsTo (g k) K T) : |
| 35 | (∀ x ∈ V, ∃ W, IsOpen W ∧ x ∈ W ∧ W ⊆ V ∧ |
| 36 | ∀ᶠ k in atTop, ContDiffOn ℝ ∞ (f k ∘ g k) W) ∧ |
| 37 | ∀ m K, IsCompact K → K ⊆ V → TendstoUniformlyOn |
| 38 | (fun k => iteratedFDeriv ℝ m (f k ∘ g k)) |
| 39 | (iteratedFDeriv ℝ m (fun _ => (0 : F))) atTop K := by |
| 40 | have hlocal : ∀ x ∈ V, ∃ W, IsOpen W ∧ x ∈ W ∧ W ⊆ V ∧ |
| 41 | ∀ᶠ k in atTop, ContDiffOn ℝ ∞ (f k ∘ g k) W := by |
| 42 | intro x hx |
| 43 | obtain ⟨K, hK, hxK, hKV⟩ := exists_compact_between isCompact_singleton hV |
| 44 | (singleton_subset_iff.mpr hx) |
| 45 | obtain ⟨T, hT, hTU, hmap⟩ := htarget K hK hKV |
| 46 | refine ⟨interior K, isOpen_interior, hxK (mem_singleton x), interior_subset.trans hKV, ?_⟩ |
| 47 | filter_upwards [hmap, eventually_contDiffAt_on_compact hT hTU hflocal, |
| 48 | eventually_contDiffAt_on_compact hK hKV hglocal] with k hkmap hkf hkg y hy |
| 49 | exact ((hkf _ (hkmap (interior_subset hy))).comp y |
| 50 | (hkg y (interior_subset hy))).contDiffWithinAt |
| 51 | refine ⟨hlocal, ?_⟩ |
| 52 | intro m K hK hKV |
| 53 | obtain ⟨T, hT, hTU, hmap⟩ := htarget K hK hKV |
| 54 | choose A hA using fun j : Fin (m + 1) => hgbound K hK hKV j |
| 55 | let D : ℝ := ∑ j : Fin (m + 1), max (A j) 0 |
| 56 | have hD : 0 ≤ D := Finset.sum_nonneg fun j _ => le_max_right _ _ |
| 57 | have hgb : ∀ᶠ i in atTop, ∀ j, j ≤ m → ∀ x ∈ K, |
| 58 | ‖iteratedFDeriv ℝ j (g i) x‖ ≤ D := by |
| 59 | filter_upwards [eventually_all.mpr hA] with i hi j hj x hx |
| 60 | let a : Fin (m + 1) := ⟨j, Nat.lt_succ_of_le hj⟩ |
| 61 | exact (hi a x hx).trans ((le_max_left _ _).trans |
| 62 | (Finset.single_le_sum (fun b _ => le_max_right (A b) 0) (Finset.mem_univ a))) |
| 63 | let C : ℝ := m.factorial * (max D 1) ^ m |
| 64 | have hC : 0 ≤ C := by dsimp [C]; positivity |
| 65 | apply Metric.tendstoUniformlyOn_iff.mpr |
| 66 | intro ε hε |
| 67 | let δ : ℝ := ε / (C + 1) |
| 68 | have hC1 : 0 < C + 1 := by linarith |
| 69 | have hδ : 0 < δ := div_pos hε hC1 |
| 70 | have hfsmall : ∀ᶠ i in atTop, ∀ j : Fin (m + 1), ∀ x ∈ T, |
| 71 | ‖iteratedFDeriv ℝ (j : ℕ) (f i) x‖ < δ := by |
| 72 | apply eventually_all.mpr |
| 73 | intro j |
| 74 | simpa using Metric.tendstoUniformlyOn_iff.mp (hfjet j T hT hTU) δ hδ |
| 75 | filter_upwards [hmap, hgb, hfsmall, eventually_contDiffAt_on_compact hT hTU hflocal, |
| 76 | eventually_contDiffAt_on_compact hK hKV hglocal] with i himap hig hif hisf hisg x hx |
| 77 | have hnorm : ‖iteratedFDeriv ℝ m (f i ∘ g i) x‖ ≤ C * δ := by |
| 78 | calc |
| 79 | _ ≤ m.factorial * δ * (max D 1) ^ m := |
| 80 | norm_iteratedFDeriv_comp_le_of_contDiffAt (hisg x hx) (hisf _ (himap hx)) m |
| 81 | (fun j hj => (hif ⟨j, Nat.lt_succ_of_le hj⟩ _ (himap hx)).le) |
| 82 | (fun j hj hjm => (hig j hjm x hx).trans ((le_max_left _ _).trans |
| 83 | (le_self_pow₀ (le_max_right D 1) (Nat.ne_of_gt hj)))) |
| 84 | _ = C * δ := by dsimp [C]; ring |
| 85 | have hsmall : ‖iteratedFDeriv ℝ m (f i ∘ g i) x‖ < ε := calc |
| 86 | _ ≤ C * δ := hnorm |
| 87 | _ < (C + 1) * δ := mul_lt_mul_of_pos_right (lt_add_one C) hδ |
| 88 | _ = ε := by dsimp [δ]; field_simp |
| 89 | simpa using hsmall |
| 90 | |
| 91 | end Poincare.Analysis.Calculus |