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.FTaylorSeries |
| 2 | import Mathlib.Topology.MetricSpace.Pseudo.Basic |
| 3 | import Mathlib.Topology.Order.Basic |
| 4 | |
| 5 | /-! |
| 6 | # Combining interior and terminal relative jets |
| 7 | |
| 8 | On a compact time-space set, ordinary interior jets and closed terminal-slab |
| 9 | jets give convergence within the full domain including zero. The original |
| 10 | functions and filter are retained. This is the domain comparison for |
| 11 | Morgan--Tian Definition 5.12 and Proposition 5.14, pp. 90-91, and |
| 12 | Theorem 11.8, pp. 272-279, with the included-terminal-time convention. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open Set Filter |
| 18 | open scoped Topology ContDiff |
| 19 | |
| 20 | namespace Poincare.Analysis.Calculus |
| 21 | |
| 22 | /-- Interior and closed terminal jets converge within their full open-left |
| 23 | time domain, on the original filter and functions (Morgan--Tian Definition |
| 24 | 5.12, Proposition 5.14, pp. 90-91, and Theorem 11.8, pp. 272-279). -/ |
| 25 | theorem tendstoUniformlyOn_iteratedFDerivWithin_of_interior_and_terminal |
| 26 | {X E ι : Type*} [NormedAddCommGroup X] [NormedSpace ℝ X] |
| 27 | [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 28 | {l : Filter ι} {I : Set ℝ} (hI : IsOpen I) |
| 29 | {U : Set X} (hU : IsOpen U) {τ : ℝ} (hτ : 0 < τ) |
| 30 | {f : ι → ℝ × X → E} {g ginterior gterminal : ℝ × X → E} |
| 31 | (hinteriorEq : EqOn g ginterior ((I ∩ Iio 0) ×ˢ U)) |
| 32 | (hterminalEq : EqOn g gterminal (Icc (-τ) 0 ×ˢ U)) |
| 33 | (m : ℕ) |
| 34 | (hinterior : ∀ K : Set (ℝ × X), IsCompact K → |
| 35 | K ⊆ (I ∩ Iio 0) ×ˢ U → TendstoUniformlyOn |
| 36 | (fun k => iteratedFDeriv ℝ m (f k)) |
| 37 | (iteratedFDeriv ℝ m ginterior) l K) |
| 38 | (hterminal : ∀ K : Set (ℝ × X), IsCompact K → |
| 39 | K ⊆ Icc (-τ) 0 ×ˢ U → TendstoUniformlyOn |
| 40 | (fun k => iteratedFDerivWithin ℝ m (f k) (Icc (-τ) 0 ×ˢ U)) |
| 41 | (iteratedFDerivWithin ℝ m gterminal (Icc (-τ) 0 ×ˢ U)) l K) |
| 42 | {K : Set (ℝ × X)} (hK : IsCompact K) |
| 43 | (hKJ : K ⊆ (I ∩ Iic 0) ×ˢ U) : |
| 44 | TendstoUniformlyOn |
| 45 | (fun k => iteratedFDerivWithin ℝ m (f k) ((I ∩ Iic 0) ×ˢ U)) |
| 46 | (iteratedFDerivWithin ℝ m g ((I ∩ Iic 0) ×ˢ U)) l K := by |
| 47 | let V := (I ∩ Iio 0) ×ˢ U |
| 48 | let C := Icc (-τ) 0 ×ˢ U |
| 49 | let Q := (I ∩ Iic 0) ×ˢ U |
| 50 | let a : ℝ := -τ / 2 |
| 51 | let Kminus := K ∩ {z : ℝ × X | z.1 ≤ a} |
| 52 | let Kplus := K ∩ {z : ℝ × X | a ≤ z.1} |
| 53 | have ha0 : a < 0 := div_neg_of_neg_of_pos (neg_lt_zero.mpr hτ) zero_lt_two |
| 54 | have hτa : -τ < a := by |
| 55 | dsimp only [a] |
| 56 | rw [neg_div] |
| 57 | exact neg_lt_neg (half_lt_self hτ) |
| 58 | have hKm : IsCompact Kminus := hK.inter_right (isClosed_le continuous_fst continuous_const) |
| 59 | have hKp : IsCompact Kplus := hK.inter_right (isClosed_le continuous_const continuous_fst) |
| 60 | have hKmV : Kminus ⊆ V := fun z hz => |
| 61 | ⟨⟨(hKJ hz.1).1.1, hz.2.trans_lt ha0⟩, (hKJ hz.1).2⟩ |
| 62 | have hKpC : Kplus ⊆ C := fun z hz => |
| 63 | ⟨⟨(hτa.trans_le hz.2).le, (hKJ hz.1).1.2⟩, (hKJ hz.1).2⟩ |
| 64 | have hV : IsOpen V := (hI.inter isOpen_Iio).prod hU |
| 65 | have hVQ : V ⊆ Q := fun z hz => |
| 66 | ⟨⟨hz.1.1, (show z.1 < (0 : ℝ) from hz.1.2).le⟩, hz.2⟩ |
| 67 | have hminusJet (h : ℝ × X → E) (z : ℝ × X) (hz : z ∈ Kminus) : |
| 68 | iteratedFDerivWithin ℝ m h Q z = iteratedFDeriv ℝ m h z := by |
| 69 | rw [← iteratedFDerivWithin_univ] |
| 70 | exact iteratedFDerivWithin_congr_set |
| 71 | (Filter.eventuallyEq_univ.mpr (mem_of_superset (hV.mem_nhds (hKmV hz)) hVQ)) m |
| 72 | have hminusLimit (z : ℝ × X) (hz : z ∈ Kminus) : |
| 73 | iteratedFDerivWithin ℝ m g Q z = iteratedFDeriv ℝ m ginterior z := by |
| 74 | rw [hminusJet g z hz] |
| 75 | have hnear : g =ᶠ[𝓝 z] ginterior := by |
| 76 | filter_upwards [hV.mem_nhds (hKmV hz)] with y hy |
| 77 | exact hinteriorEq hy |
| 78 | exact (hnear.iteratedFDeriv ℝ m).self_of_nhds |
| 79 | have hminus : TendstoUniformlyOn |
| 80 | (fun k => iteratedFDerivWithin ℝ m (f k) Q) |
| 81 | (iteratedFDerivWithin ℝ m g Q) l Kminus := by |
| 82 | apply ((hinterior Kminus hKm hKmV).congr ?_).congr_right ?_ |
| 83 | · exact Eventually.of_forall fun k z hz => (hminusJet (f k) z hz).symm |
| 84 | · exact fun z hz => (hminusLimit z hz).symm |
| 85 | have hterminalJet (h : ℝ × X → E) (z : ℝ × X) (hz : z ∈ Kplus) : |
| 86 | iteratedFDerivWithin ℝ m h C z = iteratedFDerivWithin ℝ m h Q z := by |
| 87 | apply iteratedFDerivWithin_congr_set _ m |
| 88 | have hnear : (I ∩ Ioi (-τ)) ×ˢ (univ : Set X) ∈ 𝓝 z := |
| 89 | ((hI.inter isOpen_Ioi).prod isOpen_univ).mem_nhds |
| 90 | ⟨⟨(hKJ hz.1).1.1, hτa.trans_le hz.2⟩, mem_univ _⟩ |
| 91 | filter_upwards [hnear] with w hw |
| 92 | apply propext |
| 93 | change ((-τ ≤ w.1 ∧ w.1 ≤ 0) ∧ w.2 ∈ U) ↔ |
| 94 | ((w.1 ∈ I ∧ w.1 ≤ 0) ∧ w.2 ∈ U) |
| 95 | exact ⟨fun h => ⟨⟨hw.1.1, h.1.2⟩, h.2⟩, |
| 96 | fun h => ⟨⟨hw.1.2.le, h.1.2⟩, h.2⟩⟩ |
| 97 | have hplus : TendstoUniformlyOn |
| 98 | (fun k => iteratedFDerivWithin ℝ m (f k) Q) |
| 99 | (iteratedFDerivWithin ℝ m g Q) l Kplus := by |
| 100 | apply ((hterminal Kplus hKp hKpC).congr ?_).congr_right ?_ |
| 101 | · exact Eventually.of_forall fun k z hz => hterminalJet (f k) z hz |
| 102 | · intro z hz |
| 103 | exact (iteratedFDerivWithin_congr hterminalEq (hKpC hz) m).symm.trans |
| 104 | (hterminalJet g z hz) |
| 105 | apply Metric.tendstoUniformlyOn_iff.mpr |
| 106 | intro ε hε |
| 107 | filter_upwards [(Metric.tendstoUniformlyOn_iff.mp hminus) ε hε, |
| 108 | (Metric.tendstoUniformlyOn_iff.mp hplus) ε hε] with k hkm hkp z hz |
| 109 | by_cases hza : z.1 ≤ a |
| 110 | · exact hkm z ⟨hz, hza⟩ |
| 111 | · exact hkp z ⟨hz, (lt_of_not_ge hza).le⟩ |
| 112 | |
| 113 | end Poincare.Analysis.Calculus |