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.CurveShortening.Comparison.IntrinsicComparison.Two.ArcCornerCaps |
| 2 | import PoincareLib.Geometry.CurveShortening.Comparison.IntrinsicComparison.Cap.UnionSeparators |
| 3 | |
| 4 | /-! |
| 5 | # Actual attachment barriers for occupied two-arc corner caps |
| 6 | |
| 7 | At a positive axis tip only one occupied cap can occur. The selected |
| 8 | cap supplies the chord separator, while compactness excludes the others. |
| 9 | Incoming and outgoing arcs and either coordinate axis are independent. |
| 10 | |
| 11 | Morgan--Tian context: Proposition 19.35, printed pp. 467-481, including Claim 19.40, |
| 12 | pp. 470-471. These project constructions supply actual occupied boundary collars |
| 13 | and attachment coverage for the regional Gauss--Bonnet argument. |
| 14 | -/ |
| 15 | |
| 16 | noncomputable section |
| 17 | set_option autoImplicit false |
| 18 | set_option backward.isDefEq.respectTransparency false |
| 19 | |
| 20 | open Set |
| 21 | open scoped Topology ContDiff |
| 22 | open PoincareMT.Topology.Surface ChartCircleArrangementVertexPatch |
| 23 | |
| 24 | namespace PoincareMT |
| 25 | |
| 26 | /-- The positive tip on either chart axis belongs to only the incident occupied cap. This is |
| 27 | derived from actual chart injectivity and sector signs. Source: |
| 28 | `proof-work/tasks/M64/reviews/2026-09-27-intrinsic-boundary-coverage-review.md`, round_1, |
| 29 | semantic check 8. -/ |
| 30 | theorem m64Intrinsic_corner_cap_tip_unique |
| 31 | (H : OpenPartialHomeomorph (ℝ × ℝ) AnnulusCoordinates) |
| 32 | {r : ℝ} (hr : 0 < r) (positive vertical : Bool) |
| 33 | (hsource : (if vertical then ((0 : ℝ), r) else (r, 0)) ∈ H.source) |
| 34 | (F : Bool × Bool → OpenPartialHomeomorph (ℝ × ℝ) AnnulusCoordinates) |
| 35 | (hsector : ∀ i, |
| 36 | F i '' {q : ℝ × ℝ | 0 ≤ q.1 ∧ 0 ≤ q.2 ∧ q.1 + q.2 ≤ r} ⊆ |
| 37 | H '' (H.source ∩ (sectorParameterEquiv 0 i) '' {q : ℝ × ℝ | 0 ≤ q.1 ∧ 0 ≤ q.2})) |
| 38 | (i : Bool × Bool) (hi : if positive then i = (true, true) else i ≠ (true, true)) |
| 39 | (hmem : H (if vertical then (0, r) else (r, 0)) ∈ |
| 40 | F i '' {q : ℝ × ℝ | 0 ≤ q.1 ∧ 0 ≤ q.2 ∧ q.1 + q.2 ≤ r}) : |
| 41 | i = if vertical then (positive, true) else (true, positive) := by |
| 42 | obtain ⟨_, ⟨hq, p, hp, rfl⟩, heq⟩ := hsector i hmem |
| 43 | change 0 ≤ p.1 ∧ 0 ≤ p.2 at hp |
| 44 | obtain ⟨hp1, hp2⟩ := hp |
| 45 | have hcoords := H.injOn hq hsource heq |
| 46 | rcases i with ⟨i, j⟩ |
| 47 | cases positive <;> cases vertical <;> cases i <;> cases j <;> |
| 48 | simp_all [sectorParameterEquiv_apply] |
| 49 | all_goals linarith |
| 50 | |
| 51 | /-- The whole actual occupied cap union has a chord barrier at the attachment point of |
| 52 | either incident arc, in its original parametrization. Source: |
| 53 | `proof-work/tasks/M64/reviews/2026-09-27-intrinsic-boundary-coverage-review.md`, round_1, |
| 54 | semantic check 8. -/ |
| 55 | theorem m64Intrinsic_exists_two_arc_cap_union_separator |
| 56 | {gamma : ℝ → AnnulusCoordinates} (hg : ContDiff ℝ ∞ gamma) |
| 57 | {T r : ℝ} (hr : 0 < r) |
| 58 | (H : OpenPartialHomeomorph (ℝ × ℝ) AnnulusCoordinates) |
| 59 | (F : Bool × Bool → OpenPartialHomeomorph (ℝ × ℝ) AnnulusCoordinates) |
| 60 | (hsource : ∀ i, |
| 61 | {q : ℝ × ℝ | 0 ≤ q.1 ∧ 0 ≤ q.2 ∧ q.1 + q.2 ≤ r} ⊆ (F i).source) |
| 62 | (hF : ∀ i, ContDiffOn ℝ ∞ (F i) (F i).source) |
| 63 | (hFi : ∀ i, ContDiffOn ℝ ∞ (F i).symm (F i).target) |
| 64 | (hfirst : ∀ i, ∀ s ∈ Icc (0 : ℝ) r, F i (s, 0) = H (sectorParameterEquiv 0 i (s, 0))) |
| 65 | (hsecond : ∀ i, ∀ s ∈ Icc (0 : ℝ) r, F i (0, s) = H (sectorParameterEquiv 0 i (0, s))) |
| 66 | (hchord : ∀ i, ∀ t : ℝ, F i ((1 - t) * r, t * r) = |
| 67 | (1 - t) • F i (r, 0) + t • F i (0, r)) |
| 68 | (hsector : ∀ i, |
| 69 | F i '' {q : ℝ × ℝ | 0 ≤ q.1 ∧ 0 ≤ q.2 ∧ q.1 + q.2 ≤ r} ⊆ |
| 70 | H '' (H.source ∩ (sectorParameterEquiv 0 i) '' {q : ℝ × ℝ | 0 ≤ q.1 ∧ 0 ≤ q.2})) |
| 71 | (positive terminal vertical : Bool) |
| 72 | (haxis : ∀ s : ℝ, H (if vertical then (0, s) else (s, 0)) = |
| 73 | gamma (if terminal then T - s else s)) |
| 74 | (htip : (if vertical then ((0 : ℝ), r) else (r, 0)) ∈ H.source) : |
| 75 | let selected := if vertical then (positive, true) else (true, positive) |
| 76 | let occupied (i : Bool × Bool) := if positive then i = (true, true) else i ≠ (true, true) |
| 77 | let D := ⋃ i, ⋃ (_ : occupied i), |
| 78 | F i '' {q : ℝ × ℝ | 0 ≤ q.1 ∧ 0 ≤ q.2 ∧ q.1 + q.2 ≤ r} |
| 79 | ∃ (ell : AnnulusCoordinates →L[ℝ] ℝ) (W : Set AnnulusCoordinates), |
| 80 | IsOpen W ∧ gamma (if terminal then T - r else r) ∈ W ∧ |
| 81 | ell (deriv gamma (if terminal then T - r else r)) = (if terminal then -1 else 1) ∧ |
| 82 | ell (if vertical then F selected (r, 0) - F selected (0, r) |
| 83 | else F selected (0, r) - F selected (r, 0)) = 0 ∧ |
| 84 | ∀ z ∈ W ∩ D, ell (z - gamma (if terminal then T - r else r)) ≤ 0 := by |
| 85 | classical |
| 86 | let selected := if vertical then (positive, true) else (true, positive) |
| 87 | let occupied (i : Bool × Bool) := if positive then i = (true, true) else i ≠ (true, true) |
| 88 | let C (i : Bool × Bool) := |
| 89 | F i '' {q : ℝ × ℝ | 0 ≤ q.1 ∧ 0 ≤ q.2 ∧ q.1 + q.2 ≤ r} |
| 90 | have hclosed (i : Bool × Bool) : IsClosed (C i) := |
| 91 | (m64Intrinsic_cap_isCompact (F i) (hsource i)).isClosed |
| 92 | have hselected : ∀ s ∈ Icc (0 : ℝ) r, |
| 93 | F selected (if vertical then (0, s) else (s, 0)) = |
| 94 | gamma (if terminal then T - s else s) := by |
| 95 | intro s hs |
| 96 | cases vertical |
| 97 | · calc |
| 98 | F selected (s, 0) = H (s, 0) := by |
| 99 | simpa [selected, sectorParameterEquiv_apply] using hfirst (true, positive) s hs |
| 100 | _ = gamma (if terminal then T - s else s) := haxis s |
| 101 | · calc |
| 102 | F selected (0, s) = H (0, s) := by |
| 103 | simpa [selected, sectorParameterEquiv_apply] using hsecond (positive, true) s hs |
| 104 | _ = gamma (if terminal then T - s else s) := haxis s |
| 105 | obtain ⟨ell, W0, hW0, hpW0, hnorm, hker, hsep⟩ := |
| 106 | m64Intrinsic_exists_cap_endpoint_separator hg hr (F selected) (hsource selected) |
| 107 | (hF selected) (hFi selected) (hchord selected) terminal vertical hselected |
| 108 | let O : Set AnnulusCoordinates := ⋂ i : Bool × Bool, |
| 109 | if occupied i ∧ i ≠ selected then (C i)ᶜ else univ |
| 110 | have hO : IsOpen O := by |
| 111 | apply isOpen_iInter_of_finite |
| 112 | intro i |
| 113 | split_ifs |
| 114 | · exact (hclosed i).isOpen_compl |
| 115 | · exact isOpen_univ |
| 116 | have hpO : gamma (if terminal then T - r else r) ∈ O := by |
| 117 | apply mem_iInter.mpr |
| 118 | intro i |
| 119 | by_cases hi : occupied i ∧ i ≠ selected |
| 120 | · rw [if_pos hi] |
| 121 | intro hmem |
| 122 | apply hi.2 |
| 123 | apply m64Intrinsic_corner_cap_tip_unique H hr positive vertical htip F hsector i hi.1 |
| 124 | rwa [haxis] |
| 125 | · rw [if_neg hi] |
| 126 | exact mem_univ _ |
| 127 | refine ⟨ell, W0 ∩ O, hW0.inter hO, ⟨hpW0, hpO⟩, hnorm, hker, ?_⟩ |
| 128 | rintro z ⟨⟨hzW, hzO⟩, hzD⟩ |
| 129 | obtain ⟨i, hzD⟩ := mem_iUnion.mp hzD |
| 130 | obtain ⟨hi, hzC⟩ := mem_iUnion.mp hzD |
| 131 | have heq : i = selected := by |
| 132 | by_contra hne |
| 133 | have hnot := mem_iInter.mp hzO i |
| 134 | rw [if_pos ⟨hi, hne⟩] at hnot |
| 135 | exact hnot hzC |
| 136 | exact hsep z ⟨hzW, heq ▸ hzC⟩ |
| 137 | |
| 138 | end PoincareMT |