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.AlgebraicTopology.HomotopyGroup.LoopSpace.Comparison.Lefschetz.OrderComplexRestriction |
| 2 | |
| 3 | /-! |
| 4 | # Open covers for minimal-vertex induction |
| 5 | |
| 6 | For a minimal selected vertex, its deletion and upper cone define an open |
| 7 | cover of the selected coordinate neighborhood. Their intersection is the |
| 8 | strict upper-link neighborhood. The identities take place in one fixed |
| 9 | geometric realization, so inverse images under a covering give the exact |
| 10 | open sets required by singular Mayer-Vietoris. |
| 11 | Source: Hatcher, Theorem 2.27, printed pp. 128-130. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | |
| 16 | noncomputable section |
| 17 | |
| 18 | universe u |
| 19 | |
| 20 | namespace PoincareMT.Proofs.M59 |
| 21 | |
| 22 | open M02.Topology |
| 23 | |
| 24 | variable {J : Type u} [PartialOrder J] [Fintype J] |
| 25 | |
| 26 | /-- Positive selected total weight is equivalent to a positive selected |
| 27 | coordinate. Source: Hatcher, Theorem 2.27, pp. 128-130. -/ |
| 28 | theorem mem_orderComplexNeighborhood_iff (s : Finset J) |
| 29 | (z : (finiteOrderComplex J).space) : |
| 30 | z ∈ orderComplexNeighborhood s ↔ ∃ i ∈ s, 0 < z.val i := by |
| 31 | exact Finset.sum_pos_iff_of_nonneg |
| 32 | (fun i _ => ((finiteOrderComplex_space J z.val).mp z.property).1 i) |
| 33 | |
| 34 | /-- Vertex-set inclusion gives inclusion of the actual open coordinate |
| 35 | neighborhoods. Source: Hatcher, Theorem 2.27, pp. 128-130. -/ |
| 36 | theorem orderComplexNeighborhood_mono {s t : Finset J} (h : s ⊆ t) : |
| 37 | orderComplexNeighborhood s ⊆ orderComplexNeighborhood t := by |
| 38 | intro z hz |
| 39 | obtain ⟨i, hi, hpos⟩ := (mem_orderComplexNeighborhood_iff s z).mp hz |
| 40 | exact (mem_orderComplexNeighborhood_iff t z).mpr ⟨i, h hi, hpos⟩ |
| 41 | |
| 42 | open scoped Classical in |
| 43 | /-- Vertex-set unions give literal open-neighborhood unions. |
| 44 | Source: Hatcher, Theorem 2.27, pp. 128-130. -/ |
| 45 | theorem orderComplexNeighborhood_union (s t : Finset J) : |
| 46 | orderComplexNeighborhood (s ∪ t) = |
| 47 | orderComplexNeighborhood s ∪ orderComplexNeighborhood t := by |
| 48 | ext z |
| 49 | simp only [mem_orderComplexNeighborhood_iff, Finset.mem_union, Set.mem_union, |
| 50 | or_and_right, exists_or] |
| 51 | |
| 52 | /-- The full selected vertex set gives the entire realization. |
| 53 | Source: Hatcher, Theorem 2.27, pp. 128-130. -/ |
| 54 | theorem orderComplexNeighborhood_univ : |
| 55 | orderComplexNeighborhood (Finset.univ : Finset J) = Set.univ := by |
| 56 | apply Set.eq_univ_of_forall |
| 57 | intro z |
| 58 | change 0 < ∑ i : J, z.val i |
| 59 | rw [((finiteOrderComplex_space J z.val).mp z.property).2.1] |
| 60 | exact zero_lt_one |
| 61 | |
| 62 | open scoped Classical in |
| 63 | /-- A selected vertex's deletion and upper cone cover the original |
| 64 | selected neighborhood. Source: Hatcher, Theorem 2.27, pp. 128-130. -/ |
| 65 | theorem orderComplexNeighborhood_minimal_union (s : Finset J) (v : J) : |
| 66 | orderComplexNeighborhood (s.erase v) ∪ |
| 67 | orderComplexNeighborhood (s.filter (v ≤ ·)) = orderComplexNeighborhood s := by |
| 68 | rw [← orderComplexNeighborhood_union] |
| 69 | congr 1 |
| 70 | ext j |
| 71 | simp only [Finset.mem_union, Finset.mem_erase, Finset.mem_filter] |
| 72 | constructor |
| 73 | · rintro (⟨_, hj⟩ | ⟨hj, _⟩) <;> exact hj |
| 74 | · intro hj |
| 75 | by_cases h : j = v |
| 76 | · exact Or.inr ⟨hj, h.ge⟩ |
| 77 | · exact Or.inl ⟨h, hj⟩ |
| 78 | |
| 79 | open scoped Classical in |
| 80 | /-- The overlap is precisely the strict upper-link neighborhood; the |
| 81 | proof retains the actual chain support of each point. |
| 82 | Source: Hatcher, Theorem 2.27, pp. 128-130. -/ |
| 83 | theorem orderComplexNeighborhood_minimal_inter (s : Finset J) (v : J) |
| 84 | (hminimal : ∀ j ∈ s, j ≤ v → j = v) : |
| 85 | orderComplexNeighborhood (s.erase v) ∩ |
| 86 | orderComplexNeighborhood (s.filter (v ≤ ·)) = |
| 87 | orderComplexNeighborhood (s.filter (v < ·)) := by |
| 88 | ext z |
| 89 | constructor |
| 90 | · rintro ⟨ha, hb⟩ |
| 91 | obtain ⟨i, hi, hzi⟩ := (mem_orderComplexNeighborhood_iff _ z).mp ha |
| 92 | obtain ⟨j, hj, hzj⟩ := (mem_orderComplexNeighborhood_iff _ z).mp hb |
| 93 | obtain ⟨his, hiv⟩ := Finset.mem_filter.mp hj |
| 94 | by_cases hvj : v = j |
| 95 | · subst j |
| 96 | have hc := ((finiteOrderComplex_space J z.val).mp z.property).2.2 i v |
| 97 | (ne_of_gt hzi) (ne_of_gt hzj) |
| 98 | have hne := (Finset.mem_erase.mp hi).1 |
| 99 | have hsi := (Finset.mem_erase.mp hi).2 |
| 100 | rcases hc with hiv | hvi |
| 101 | · exact (hne (hminimal i hsi hiv)).elim |
| 102 | · exact (mem_orderComplexNeighborhood_iff _ z).mpr |
| 103 | ⟨i, Finset.mem_filter.mpr ⟨hsi, lt_of_le_of_ne hvi hne.symm⟩, hzi⟩ |
| 104 | · exact (mem_orderComplexNeighborhood_iff _ z).mpr |
| 105 | ⟨j, Finset.mem_filter.mpr ⟨his, lt_of_le_of_ne hiv hvj⟩, hzj⟩ |
| 106 | · intro hz |
| 107 | obtain ⟨j, hj, hzj⟩ := (mem_orderComplexNeighborhood_iff _ z).mp hz |
| 108 | obtain ⟨hsj, hvj⟩ := Finset.mem_filter.mp hj |
| 109 | exact ⟨(mem_orderComplexNeighborhood_iff _ z).mpr |
| 110 | ⟨j, Finset.mem_erase.mpr ⟨ne_of_gt hvj, hsj⟩, hzj⟩, |
| 111 | (mem_orderComplexNeighborhood_iff _ z).mpr |
| 112 | ⟨j, Finset.mem_filter.mpr ⟨hsj, hvj.le⟩, hzj⟩⟩ |
| 113 | |
| 114 | end PoincareMT.Proofs.M59 |