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.Generalized.BoundedDistance.GeometryImports |
| 2 | import Mathlib.Order.Filter.AtTopBot.Basic |
| 3 | |
| 4 | /-! |
| 5 | # Retaining one label with dependent witnesses |
| 6 | |
| 7 | An eventual family of witnesses has a strictly increasing selection on |
| 8 | which one binary label is fixed. The witness may vary at each selected |
| 9 | index. This is the orientation selection in Morgan--Tian Proposition 10.7, |
| 10 | pp. 253-254; M28 derivation 114. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open Filter |
| 16 | |
| 17 | /-- Choose a strict subsequence, witnesses at every selected index, and |
| 18 | one common binary label. Neither a convergent witness family nor an |
| 19 | eventually constant label is assumed. Source: M28 derivation 114. -/ |
| 20 | theorem Filter.exists_strictMono_constant_label_witness |
| 21 | {Z : ℕ → Type*} (P label : ∀ k, Z k → Prop) |
| 22 | (h : ∀ᶠ k in atTop, ∃ z, P k z) : |
| 23 | ∃ sigma : ℕ → ℕ, StrictMono sigma ∧ ∃ z : ∀ k, Z (sigma k), |
| 24 | (∀ k, P (sigma k) (z k)) ∧ |
| 25 | ((∀ k, label (sigma k) (z k)) ∨ (∀ k, ¬ label (sigma k) (z k))) := by |
| 26 | classical |
| 27 | have hsplit : ∀ᶠ k in atTop, |
| 28 | (∃ z, P k z ∧ label k z) ∨ (∃ z, P k z ∧ ¬ label k z) := by |
| 29 | filter_upwards [h] with k hk |
| 30 | obtain ⟨z, hz⟩ := hk |
| 31 | by_cases hl : label k z |
| 32 | · exact Or.inl ⟨z, hz, hl⟩ |
| 33 | · exact Or.inr ⟨z, hz, hl⟩ |
| 34 | rcases frequently_or_distrib.mp hsplit.frequently with hpos | hneg |
| 35 | · obtain ⟨sigma, hmono, hgood⟩ := extraction_of_frequently_atTop hpos |
| 36 | choose z hP hlabel using hgood |
| 37 | exact ⟨sigma, hmono, z, hP, Or.inl hlabel⟩ |
| 38 | · obtain ⟨sigma, hmono, hgood⟩ := extraction_of_frequently_atTop hneg |
| 39 | choose z hP hlabel using hgood |
| 40 | exact ⟨sigma, hmono, z, hP, Or.inr hlabel⟩ |