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.Surgery.CanonicalInduction.Terminal.Common.TerminalCommonIntervalDecision |
| 2 | |
| 3 | /-! |
| 4 | # Radius-independent finite slabs and refinement-stable horizons |
| 5 | |
| 6 | The curvature bound is selected before radius and negative-part error. |
| 7 | Decided rational tests prevent a further strict subsequence from changing |
| 8 | the set of controlled horizons. Source: terminal-common-interval.md, C4-C5. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | |
| 13 | open Set Filter |
| 14 | open scoped Topology ENNReal |
| 15 | |
| 16 | universe u |
| 17 | |
| 18 | namespace PoincareMT.M47 |
| 19 | |
| 20 | /-- The literal finite-slab quantifiers, without compactness or volume. -/ |
| 21 | def TerminalCommonIntervalSlab (V : GeneralizedBlowupSequence.{u}) (T : ℝ) : Prop := |
| 22 | ∃ B : ℝ, 0 ≤ B ∧ ∀ A : ℝ, 0 < A → ∀ eta : ℝ, 0 < eta → |
| 23 | ∀ᶠ k in atTop, Nonempty (ControlledBlowupCylinder V k A T B eta) |
| 24 | |
| 25 | /-- Open-left horizons retain closed cylinders on every smaller slab. -/ |
| 26 | def TerminalCommonIntervalHorizons (V : GeneralizedBlowupSequence.{u}) : Set ℝ≥0∞ := |
| 27 | {H | ∀ T : ℝ, 0 < T → ENNReal.ofReal T < H → TerminalCommonIntervalSlab V T} |
| 28 | |
| 29 | /-- The same curvature bound works on every shorter included slab. -/ |
| 30 | theorem terminalCommonInterval_slab_mono |
| 31 | {V : GeneralizedBlowupSequence.{u}} {T T' : ℝ} |
| 32 | (h : TerminalCommonIntervalSlab V T) (hT : T' ≤ T) : |
| 33 | TerminalCommonIntervalSlab V T' := by |
| 34 | obtain ⟨B, hB, hc⟩ := h |
| 35 | refine ⟨B, hB, fun A hA eta heta => ?_⟩ |
| 36 | filter_upwards [hc A hA eta heta] with k hk |
| 37 | exact hk.map (fun e => terminalCommonInterval_restrict e le_rfl hT le_rfl le_rfl) |
| 38 | |
| 39 | /-- Strict selection retains every actual finite-slab witness. -/ |
| 40 | theorem terminalCommonInterval_slab_reindex |
| 41 | {V : GeneralizedBlowupSequence.{u}} {T : ℝ} |
| 42 | (h : TerminalCommonIntervalSlab V T) {sigma : ℕ → ℕ} (hsigma : StrictMono sigma) : |
| 43 | TerminalCommonIntervalSlab (terminalCommonInterval_reindex V sigma hsigma) T := by |
| 44 | obtain ⟨B, hB, hc⟩ := h |
| 45 | refine ⟨B, hB, fun A hA eta heta => ?_⟩ |
| 46 | filter_upwards [hsigma.tendsto_atTop.eventually (hc A hA eta heta)] with k hk |
| 47 | exact terminalCommonInterval_reindex_cylinder_iff.mpr hk |
| 48 | |
| 49 | /-- A natural bound precedes the countable radius and error tests. -/ |
| 50 | theorem terminalCommonInterval_slab_iff_tests |
| 51 | (V : GeneralizedBlowupSequence.{u}) (T : ℝ) : |
| 52 | TerminalCommonIntervalSlab V T ↔ |
| 53 | ∃ b : ℕ, ∀ a m : ℕ, ∀ᶠ k in atTop, |
| 54 | Nonempty (ControlledBlowupCylinder V k (a + 1) T b (1 / (m + 1))) := by |
| 55 | constructor |
| 56 | · rintro ⟨B, _hB, hc⟩ |
| 57 | obtain ⟨b, hb⟩ := exists_nat_ge B |
| 58 | refine ⟨b, fun a m => ?_⟩ |
| 59 | filter_upwards [hc (a + 1) (by positivity) (1 / (m + 1)) (by positivity)] with k hk |
| 60 | exact hk.map (fun e => terminalCommonInterval_restrict e le_rfl le_rfl hb le_rfl) |
| 61 | · rintro ⟨b, hc⟩ |
| 62 | refine ⟨b, Nat.cast_nonneg b, fun A _hA eta heta => ?_⟩ |
| 63 | obtain ⟨a, ha⟩ := exists_nat_ge A |
| 64 | obtain ⟨m, hm⟩ := exists_nat_one_div_lt heta |
| 65 | filter_upwards [hc a m] with k hk |
| 66 | exact hk.map (fun e => terminalCommonInterval_restrict e |
| 67 | (by linarith : A ≤ (a : ℝ) + 1) le_rfl le_rfl hm.le) |
| 68 | |
| 69 | /-- Decided tests cannot first become true on a further strict subsequence. -/ |
| 70 | theorem terminalCommonInterval_rational_slab_reflect |
| 71 | {V : GeneralizedBlowupSequence.{u}} (hdec : TerminalCommonIntervalDecided V) |
| 72 | {sigma : ℕ → ℕ} (hsigma : StrictMono sigma) (q : ℚ) |
| 73 | (h : TerminalCommonIntervalSlab (terminalCommonInterval_reindex V sigma hsigma) q) : |
| 74 | TerminalCommonIntervalSlab V q := by |
| 75 | obtain ⟨b, hb⟩ := (terminalCommonInterval_slab_iff_tests _ _).mp h |
| 76 | apply (terminalCommonInterval_slab_iff_tests _ _).mpr |
| 77 | refine ⟨b, fun a m => ?_⟩ |
| 78 | rcases hdec q b a m with hyes | hno |
| 79 | · exact hyes |
| 80 | · have htrue : ∀ᶠ k in atTop, |
| 81 | Nonempty (ControlledBlowupCylinder V (sigma k) (a + 1) q b (1 / (m + 1))) := |
| 82 | (hb a m).mono (fun _ hk => terminalCommonInterval_reindex_cylinder_iff.mp hk) |
| 83 | obtain ⟨k, hk, hn⟩ := (htrue.and (hsigma.tendsto_atTop.eventually hno)).exists |
| 84 | exact (hn hk).elim |
| 85 | |
| 86 | /-- A rational buffer is still strictly below a finite or infinite horizon. -/ |
| 87 | theorem terminalCommonInterval_rational_buffer {T : ℝ} {H : ℝ≥0∞} |
| 88 | (hT : 0 < T) (hH : ENNReal.ofReal T < H) : |
| 89 | ∃ q : ℚ, T < (q : ℝ) ∧ ENNReal.ofReal (q : ℝ) < H := by |
| 90 | by_cases htop : H = ⊤ |
| 91 | · obtain ⟨q, hq, _⟩ := exists_rat_btwn (show T < T + 1 by linarith) |
| 92 | exact ⟨q, hq, htop ▸ ENNReal.ofReal_lt_top⟩ |
| 93 | · have hreal : T < H.toReal := (ENNReal.ofReal_lt_iff_lt_toReal hT.le htop).mp hH |
| 94 | obtain ⟨q, hq, hqH⟩ := exists_rat_btwn hreal |
| 95 | exact ⟨q, hq, (ENNReal.ofReal_lt_iff_lt_toReal (hT.trans hq).le htop).mpr hqH⟩ |
| 96 | |
| 97 | /-- All controlled horizons are invariant under subsequent strict selection. -/ |
| 98 | theorem terminalCommonInterval_horizons_reindex |
| 99 | {V : GeneralizedBlowupSequence.{u}} (hdec : TerminalCommonIntervalDecided V) |
| 100 | {sigma : ℕ → ℕ} (hsigma : StrictMono sigma) : |
| 101 | TerminalCommonIntervalHorizons (terminalCommonInterval_reindex V sigma hsigma) = |
| 102 | TerminalCommonIntervalHorizons V := by |
| 103 | ext H |
| 104 | constructor |
| 105 | · intro h T hT hTH |
| 106 | obtain ⟨q, hq, hqH⟩ := terminalCommonInterval_rational_buffer hT hTH |
| 107 | exact terminalCommonInterval_slab_mono |
| 108 | (terminalCommonInterval_rational_slab_reflect hdec hsigma q |
| 109 | (h q (hT.trans hq) hqH)) hq.le |
| 110 | · intro h T hT hTH |
| 111 | exact terminalCommonInterval_slab_reindex (h T hT hTH) hsigma |
| 112 | |
| 113 | end PoincareMT.M47 |