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.Ancestry.Finite.ComponentTrace |
| 2 | import PoincareLib.Geometry.RicciFlow.Surgery.Ancestry.Finite.EventOverlap |
| 3 | |
| 4 | /-! |
| 5 | # Extending a component trace through a surgery |
| 6 | |
| 7 | Continue the stored-reference trace along the ordinary pre-flow, then enter |
| 8 | the prescribed child through an actual interior retention point. The event |
| 9 | gap and event/slab compatibility give MT Definition 18.2, pp. 419--420. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | open Set |
| 15 | open scoped Manifold ContDiff Topology |
| 16 | |
| 17 | universe u |
| 18 | |
| 19 | namespace PoincareMT |
| 20 | |
| 21 | /-- Append one surgery using the actual stored reference and retention map |
| 22 | of MT Definition 18.2, pp. 419--420. -/ |
| 23 | noncomputable def m56Trace_eventExtension {F : SurgeryFlowData.{u}} {T : ℝ} |
| 24 | (hT : T ∈ F.surgery_times) [Nonempty (F.slice T).carrier] |
| 25 | (P : M56ComponentTrace F (F.event T hT).tMinus) |
| 26 | (z : (F.slice (F.event T hT).tMinus).carrier) |
| 27 | (hz : z ∈ connectedComponent (P.point |
| 28 | ⟨(F.event T hT).tMinus, (F.event T hT).tMinus_nonnegative, le_rfl⟩)) |
| 29 | (y : (F.slice T).carrier) (hret : z ∈ interior (F.event T hT).retained_pre) |
| 30 | (hchild : (F.event T hT).retention.map z ∈ connectedComponent y) : |
| 31 | M56ComponentTrace F T := by |
| 32 | classical |
| 33 | let E := F.event T hT |
| 34 | let p : ∀ s : Icc (0 : ℝ) T, (F.slice s.1).carrier := fun s => |
| 35 | if hsT : s.1 = T then hsT.symm ▸ y |
| 36 | else if hsa : s.1 ≤ E.tMinus then P.point ⟨s.1, s.2.1, hsa⟩ |
| 37 | else E.pre_identify ⟨s.1, (lt_of_not_ge hsa).le, lt_of_le_of_ne s.2.2 hsT⟩ z |
| 38 | have old (s : Icc (0 : ℝ) T) (hsa : s.1 ≤ E.tMinus) : |
| 39 | p s = P.point ⟨s.1, s.2.1, hsa⟩ := by |
| 40 | simp only [p, dif_neg (ne_of_lt (hsa.trans_lt E.tMinus_lt)), dif_pos hsa] |
| 41 | have pre (s : Icc (0 : ℝ) T) (hsT : s.1 ≠ T) (hsa : ¬ s.1 ≤ E.tMinus) : |
| 42 | p s = E.pre_identify |
| 43 | ⟨s.1, (lt_of_not_ge hsa).le, lt_of_le_of_ne s.2.2 hsT⟩ z := by |
| 44 | simp only [p, dif_neg hsT, dif_neg hsa] |
| 45 | have terminal : p ⟨T, E.tMinus_nonnegative.trans E.tMinus_lt.le, le_rfl⟩ = y := by |
| 46 | simp only [p, ↓reduceDIte] |
| 47 | refine { |
| 48 | time_subset := F.time_domain_interval.out F.zero_mem (F.surgery_times_subset hT) |
| 49 | point := p |
| 50 | regular := ?_ |
| 51 | inherited := ?_ } |
| 52 | · intro c d hcd hK hfree s t hs ht |
| 53 | let B := F.regular_slabs c d hcd hK hfree |
| 54 | by_cases hsT : s.1 = T |
| 55 | · have htT : t.1 = T := by |
| 56 | by_contra htT |
| 57 | exact Set.disjoint_left.mp hfree hT |
| 58 | ⟨ht.1.trans_lt (lt_of_le_of_ne t.2.2 htT), hsT ▸ hs.2⟩ |
| 59 | have hst : s = t := Subtype.ext (hsT.trans htT.symm) |
| 60 | subst t |
| 61 | rfl |
| 62 | by_cases htT : t.1 = T |
| 63 | · exact False.elim (Set.disjoint_left.mp hfree hT |
| 64 | ⟨hs.1.trans_lt (lt_of_le_of_ne s.2.2 hsT), htT ▸ ht.2⟩) |
| 65 | have cross (s t : Icc (0 : ℝ) T) (hs : s.1 ∈ Icc c d) (ht : t.1 ∈ Icc c d) |
| 66 | (htT : t.1 ≠ T) (hsa : s.1 ≤ E.tMinus) (hta : ¬ t.1 ≤ E.tMinus) : |
| 67 | ConnectedComponents.mk ((B.identify ⟨s.1, hs⟩).symm (p s)) = |
| 68 | ConnectedComponents.mk ((B.identify ⟨t.1, ht⟩).symm (p t)) := by |
| 69 | have hacd : E.tMinus ∈ Icc c d := |
| 70 | ⟨hs.1.trans hsa, (lt_of_not_ge hta).le.trans ht.2⟩ |
| 71 | have hP := P.regular c d hcd hK hfree |
| 72 | ⟨s.1, s.2.1, hsa⟩ ⟨E.tMinus, E.tMinus_nonnegative, le_rfl⟩ hs hacd |
| 73 | have hZ := m56ComponentClass_map (B.identify ⟨E.tMinus, hacd⟩).symm.continuous |
| 74 | (ConnectedComponents.coe_eq_coe'.mpr hz) |
| 75 | have hE := m56Event_pullback_eq F hT hcd hK hfree E.tMinus t.1 hacd ht |
| 76 | ⟨le_rfl, E.tMinus_lt⟩ ⟨(lt_of_not_ge hta).le, lt_of_le_of_ne t.2.2 htT⟩ z |
| 77 | change (B.identify ⟨E.tMinus, hacd⟩).symm |
| 78 | (E.pre_identify ⟨E.tMinus, le_rfl, E.tMinus_lt⟩ z) = |
| 79 | (B.identify ⟨t.1, ht⟩).symm |
| 80 | (E.pre_identify ⟨t.1, (lt_of_not_ge hta).le, lt_of_le_of_ne t.2.2 htT⟩ z) at hE |
| 81 | rw [E.pre_initial z] at hE |
| 82 | rw [old s hsa, pre t htT hta] |
| 83 | exact hP.trans (hZ.symm.trans (congrArg ConnectedComponents.mk hE)) |
| 84 | by_cases hsa : s.1 ≤ E.tMinus |
| 85 | · by_cases hta : t.1 ≤ E.tMinus |
| 86 | · rw [old s hsa, old t hta] |
| 87 | exact P.regular c d hcd hK hfree |
| 88 | ⟨s.1, s.2.1, hsa⟩ ⟨t.1, t.2.1, hta⟩ hs ht |
| 89 | · exact cross s t hs ht htT hsa hta |
| 90 | · by_cases hta : t.1 ≤ E.tMinus |
| 91 | · exact (cross t s ht hs hsT hta hsa).symm |
| 92 | · rw [pre s hsT hsa, pre t htT hta] |
| 93 | exact congrArg ConnectedComponents.mk |
| 94 | (m56Event_pullback_eq F hT hcd hK hfree s.1 t.1 hs ht |
| 95 | ⟨(lt_of_not_ge hsa).le, lt_of_le_of_ne s.2.2 hsT⟩ |
| 96 | ⟨(lt_of_not_ge hta).le, lt_of_le_of_ne t.2.2 htT⟩ z) |
| 97 | · intro s hs hpost |
| 98 | let := hpost |
| 99 | by_cases hsT : s.1 = T |
| 100 | · have hsEq : s = ⟨T, E.tMinus_nonnegative.trans E.tMinus_lt.le, le_rfl⟩ := |
| 101 | Subtype.ext hsT |
| 102 | subst s |
| 103 | refine ⟨z, ?_, hret, ?_⟩ |
| 104 | · rwa [old _ le_rfl] |
| 105 | · rwa [terminal] |
| 106 | · have hsa : s.1 ≤ E.tMinus := by |
| 107 | by_contra hsa |
| 108 | exact Set.disjoint_left.mp (m56Event_gap F hT) hs |
| 109 | ⟨lt_of_not_ge hsa, lt_of_le_of_ne s.2.2 hsT⟩ |
| 110 | have hpre : (F.event s.1 hs).tMinus ≤ E.tMinus := |
| 111 | (F.event s.1 hs).tMinus_lt.le.trans hsa |
| 112 | obtain ⟨x, hx, hxi, hxr⟩ := P.inherited ⟨s.1, s.2.1, hsa⟩ hs hpost |
| 113 | refine ⟨x, ?_, hxi, ?_⟩ |
| 114 | · rwa [old _ hpre] |
| 115 | · rwa [old _ hsa] |
| 116 | |
| 117 | /-- The appended surgery trace reaches the prescribed actual child point |
| 118 | (MT Definition 18.2, pp. 419--420). -/ |
| 119 | theorem m56Trace_eventExtension_terminal {F : SurgeryFlowData.{u}} {T : ℝ} |
| 120 | (hT : T ∈ F.surgery_times) [Nonempty (F.slice T).carrier] |
| 121 | (P : M56ComponentTrace F (F.event T hT).tMinus) |
| 122 | (z : (F.slice (F.event T hT).tMinus).carrier) |
| 123 | (hz : z ∈ connectedComponent (P.point |
| 124 | ⟨(F.event T hT).tMinus, (F.event T hT).tMinus_nonnegative, le_rfl⟩)) |
| 125 | (y : (F.slice T).carrier) (hret : z ∈ interior (F.event T hT).retained_pre) |
| 126 | (hchild : (F.event T hT).retention.map z ∈ connectedComponent y) : |
| 127 | (m56Trace_eventExtension hT P z hz y hret hchild).point |
| 128 | ⟨T, F.time_domain_nonnegative (F.surgery_times_subset hT), le_rfl⟩ = y := by |
| 129 | simp only [m56Trace_eventExtension, ↓reduceDIte] |
| 130 | |
| 131 | end PoincareMT |