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.Volume.LossData |
| 2 | |
| 3 | /-! |
| 4 | Adapted from Mapher `PoincareMT/Proofs/M49/FlowEventCounts.lean` at |
| 5 | revision `f927d9e1f0810042766d3b5f64d3f4da02ee93cc`. |
| 6 | |
| 7 | # Counts attached to the actual raw surgery events |
| 8 | |
| 9 | Morgan-Tian Lemma 17.12, pp. 410-411. The number of inserted caps |
| 10 | counts sphere cuts, while zero-cap and vanishing events contribute |
| 11 | one deletion count. Off the actual event set both counts are zero. |
| 12 | See M49 derivation 32 for the exact dependent selector semantics. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | universe u |
| 18 | |
| 19 | namespace PoincareMT.SurgeryVolume |
| 20 | |
| 21 | /-- The actual cap multiplicity, with zero at vanishing and non-event |
| 22 | times (MT Lemma 17.12, pp. 410-411). -/ |
| 23 | noncomputable def eventCapCount (F : SurgeryFlowData.{u}) (T : ℝ) : ℕ := by |
| 24 | classical |
| 25 | exact if hT : T ∈ F.surgery_times then |
| 26 | if hN : Nonempty (F.slice T).carrier then |
| 27 | letI := hN |
| 28 | (F.event T hT).cap_count |
| 29 | else 0 |
| 30 | else 0 |
| 31 | |
| 32 | /-- Zero-cap actual events, including vanishing events, contribute one |
| 33 | deletion count (MT Lemma 17.12, pp. 410-411). -/ |
| 34 | noncomputable def eventDeletionCount (F : SurgeryFlowData.{u}) (T : ℝ) : ℕ := by |
| 35 | classical |
| 36 | exact if T ∈ F.surgery_times ∧ eventCapCount F T = 0 then 1 else 0 |
| 37 | |
| 38 | /-- At an actual nonempty event the total count is its literal cap_count |
| 39 | (MT Lemma 17.12, pp. 410-411). -/ |
| 40 | theorem eventCapCount_eq (F : SurgeryFlowData.{u}) (T : ℝ) (hT : T ∈ F.surgery_times) |
| 41 | [Nonempty (F.slice T).carrier] : eventCapCount F T = (F.event T hT).cap_count := by |
| 42 | simp only [eventCapCount, dif_pos hT, dif_pos (inferInstance : Nonempty (F.slice T).carrier)] |
| 43 | |
| 44 | /-- Empty slices have no cap count, whether or not the time is an event |
| 45 | (MT Lemma 17.12, pp. 410-411). -/ |
| 46 | theorem eventCapCount_eq_zero_of_isEmpty (F : SurgeryFlowData.{u}) (T : ℝ) |
| 47 | [IsEmpty (F.slice T).carrier] : eventCapCount F T = 0 := by |
| 48 | classical |
| 49 | simp [eventCapCount, not_nonempty_iff.mpr (inferInstance : IsEmpty (F.slice T).carrier)] |
| 50 | |
| 51 | /-- The deletion indicator at an event is exactly its zero-cap test |
| 52 | (MT Lemma 17.12, pp. 410-411). -/ |
| 53 | theorem eventDeletionCount_eq (F : SurgeryFlowData.{u}) (T : ℝ) (hT : T ∈ F.surgery_times) : |
| 54 | eventDeletionCount F T = if eventCapCount F T = 0 then 1 else 0 := by |
| 55 | simp only [eventDeletionCount, hT, true_and] |
| 56 | |
| 57 | /-- Each actual event contributes at least one cut or deletion count |
| 58 | (MT Lemma 17.12, pp. 410-411). -/ |
| 59 | theorem one_le_event_counts (F : SurgeryFlowData.{u}) (T : ℝ) (hT : T ∈ F.surgery_times) : |
| 60 | 1 ≤ eventCapCount F T + eventDeletionCount F T := by |
| 61 | rw [eventDeletionCount_eq F T hT] |
| 62 | split_ifs with h <;> omega |
| 63 | |
| 64 | end PoincareMT.SurgeryVolume |