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.Continuation.Branch |
| 2 | import PoincareLib.Geometry.RicciFlow.Surgery.Control.Basic |
| 3 | |
| 4 | /-! |
| 5 | # Observe the retained maximal ordinary tail |
| 6 | |
| 7 | Morgan--Tian Section 17.2, pp. 409-410. The domain and final slab come from |
| 8 | the actual M33 restart. An epoch boundary changes only the observation; |
| 9 | it does not truncate the raw surgery flow. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | open Set |
| 15 | |
| 16 | universe u |
| 17 | |
| 18 | namespace PoincareMT.M51 |
| 19 | |
| 20 | /-- The actual flow is global, or has a positive excluded endpoint with its |
| 21 | maximal final ordinary slab. This is output data of the retained restart. -/ |
| 22 | def MaximalTail (F : SurgeryFlowData.{u}) : Prop := |
| 23 | F.time_domain = Ici 0 ∨ |
| 24 | ∃ T : ℝ, 0 < T ∧ F.time_domain = Ico 0 T ∧ |
| 25 | Nonempty (RepairedPreterminalSlab F T) |
| 26 | |
| 27 | /-- Keep the maximal-domain alternative of this literal M33 continuation. -/ |
| 28 | theorem maximalTail_of_restart |
| 29 | {F : SurgeryFlowData.{u}} {T : ℝ} {I : RepairedContinuationInput F T} |
| 30 | (C : RepairedContinuationConclusion I) : MaximalTail C.extension.extended := by |
| 31 | by_cases htop : C.end_time = ⊤ |
| 32 | · left |
| 33 | rw [C.time_domain_eq, htop] |
| 34 | ext t |
| 35 | simp |
| 36 | · right |
| 37 | have hT : T < C.end_time.toReal := |
| 38 | (ENNReal.ofReal_lt_iff_lt_toReal I.terminal_pos.le htop).mp C.extends_past |
| 39 | refine ⟨C.end_time.toReal, I.terminal_pos.trans hT, ?_, ?_⟩ |
| 40 | · rw [C.time_domain_eq] |
| 41 | ext t |
| 42 | constructor |
| 43 | · rintro ⟨ht, hend⟩ |
| 44 | exact ⟨ht, (ENNReal.ofReal_lt_iff_lt_toReal ht htop).mp hend⟩ |
| 45 | · rintro ⟨ht, hend⟩ |
| 46 | exact ⟨ht, (ENNReal.ofReal_lt_iff_lt_toReal ht htop).mpr hend⟩ |
| 47 | · obtain ⟨L, _⟩ := C.finite_end_slab htop |
| 48 | exact ⟨L⟩ |
| 49 | |
| 50 | /-- At an excluded endpoint, recover the final slab of the same raw flow. -/ |
| 51 | theorem MaximalTail.slab_of_domain_eq {F : SurgeryFlowData.{u}} |
| 52 | (hF : MaximalTail F) {H : ℝ} (hH : 0 < H) |
| 53 | (hJ : F.time_domain = Ico 0 H) : Nonempty (RepairedPreterminalSlab F H) := by |
| 54 | rcases hF with hglobal | ⟨T, hT, hdomain, hslab⟩ |
| 55 | · have hmem : H ∈ F.time_domain := hglobal ▸ hH.le |
| 56 | rw [hJ] at hmem |
| 57 | exact (lt_irrefl H hmem.2).elim |
| 58 | · have hTH : T = H := by |
| 59 | apply le_antisymm |
| 60 | · by_contra h |
| 61 | have hmem : H ∈ F.time_domain := hdomain ▸ ⟨hH.le, lt_of_not_ge h⟩ |
| 62 | rw [hJ] at hmem |
| 63 | exact lt_irrefl H hmem.2 |
| 64 | · by_contra h |
| 65 | have hmem : T ∈ F.time_domain := hJ ▸ ⟨hT.le, lt_of_not_ge h⟩ |
| 66 | rw [hdomain] at hmem |
| 67 | exact lt_irrefl T hmem.2 |
| 68 | simpa only [hTH] using hslab |
| 69 | |
| 70 | /-- Advance the observation to the actual endpoint or B. Equality with the |
| 71 | old horizon is allowed when it is already a singular epoch boundary. -/ |
| 72 | theorem MaximalTail.observeBefore {F : SurgeryFlowData.{u}} |
| 73 | (hF : MaximalTail F) (O : SurgeryObservation F) {B : ℝ} (hB : O.H ≤ B) : |
| 74 | ∃ O' : SurgeryObservation F, |
| 75 | O.H ≤ O'.H ∧ O'.H ≤ B ∧ O'.standard_flow = O.standard_flow ∧ |
| 76 | (O'.H < B → F.time_domain = Ico 0 O'.H) ∧ |
| 77 | (F.time_domain = Ico 0 O'.H → Nonempty (RepairedPreterminalSlab F O'.H)) := by |
| 78 | have hBpos : 0 < B := O.H_pos.trans_le hB |
| 79 | rcases hF with hglobal | ⟨T, hT, hdomain, hslab⟩ |
| 80 | · let O' : SurgeryObservation F := { |
| 81 | H := B |
| 82 | H_pos := hBpos |
| 83 | interval_subset := by rw [hglobal]; exact fun _ ht => ht.1 |
| 84 | standard_flow := O.standard_flow } |
| 85 | exact ⟨O', hB, le_rfl, rfl, fun h => (lt_irrefl B h).elim, |
| 86 | MaximalTail.slab_of_domain_eq (Or.inl hglobal) O'.H_pos⟩ |
| 87 | · have hOT : O.H ≤ T := by |
| 88 | by_contra h |
| 89 | have hmem := O.interval_subset ⟨hT.le, lt_of_not_ge h⟩ |
| 90 | rw [hdomain] at hmem |
| 91 | exact lt_irrefl T hmem.2 |
| 92 | let O' : SurgeryObservation F := { |
| 93 | H := min T B |
| 94 | H_pos := lt_min hT hBpos |
| 95 | interval_subset := by |
| 96 | intro t ht |
| 97 | rw [hdomain] |
| 98 | exact ⟨ht.1, ht.2.trans_le (min_le_left _ _)⟩ |
| 99 | standard_flow := O.standard_flow } |
| 100 | refine ⟨O', le_min hOT hB, min_le_right _ _, rfl, ?_, |
| 101 | MaximalTail.slab_of_domain_eq (Or.inr ⟨T, hT, hdomain, hslab⟩) O'.H_pos⟩ |
| 102 | intro hlt |
| 103 | have hTB : T < B := (min_lt_iff.mp hlt).resolve_right (lt_irrefl B) |
| 104 | change F.time_domain = Ico 0 (min T B) |
| 105 | rw [min_eq_left hTB.le] |
| 106 | exact hdomain |
| 107 | |
| 108 | end PoincareMT.M51 |