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.Loop.CapTips |
| 2 | import PoincareLib.Geometry.CurveShortening.Comparison.IntrinsicComparison.Cap.EndpointSeparator |
| 3 | |
| 4 | /-! |
| 5 | # Separators for the whole occupied corner-cap union |
| 6 | |
| 7 | The unique incident cap supplies the actual chord separator. Compactness |
| 8 | excludes every other occupied cap on one common endpoint neighborhood. |
| 9 | |
| 10 | Morgan--Tian context: Proposition 19.35, printed pp. 467-481, including Claim 19.40, |
| 11 | pp. 470-471. These project constructions provide actual fitted boundary pieces and |
| 12 | contacts for the regional Gauss--Bonnet arguments. |
| 13 | -/ |
| 14 | |
| 15 | noncomputable section |
| 16 | set_option autoImplicit false |
| 17 | set_option backward.isDefEq.respectTransparency false |
| 18 | |
| 19 | open Set |
| 20 | open scoped Topology ContDiff |
| 21 | open PoincareMT.Topology.Surface ChartCircleArrangementVertexPatch |
| 22 | |
| 23 | namespace PoincareMT |
| 24 | |
| 25 | /-- The actual triangular cap image is compact. Source: |
| 26 | `proof-work/tasks/M64/reviews/2026-09-27-intrinsic-obstacle-bands-review.md`, round_1, check |
| 27 | 6. -/ |
| 28 | theorem m64Intrinsic_cap_isCompact |
| 29 | (F : OpenPartialHomeomorph (ℝ × ℝ) AnnulusCoordinates) {r : ℝ} |
| 30 | (hsource : {q : ℝ × ℝ | 0 ≤ q.1 ∧ 0 ≤ q.2 ∧ q.1 + q.2 ≤ r} ⊆ F.source) : |
| 31 | IsCompact (F '' {q : ℝ × ℝ | 0 ≤ q.1 ∧ 0 ≤ q.2 ∧ q.1 + q.2 ≤ r}) := by |
| 32 | have hclosed : IsClosed {q : ℝ × ℝ | 0 ≤ q.1 ∧ 0 ≤ q.2 ∧ q.1 + q.2 ≤ r} := |
| 33 | (isClosed_le continuous_const continuous_fst).inter |
| 34 | ((isClosed_le continuous_const continuous_snd).inter |
| 35 | (isClosed_le (continuous_fst.add continuous_snd) continuous_const)) |
| 36 | have hsub : {q : ℝ × ℝ | 0 ≤ q.1 ∧ 0 ≤ q.2 ∧ q.1 + q.2 ≤ r} ⊆ |
| 37 | Icc (0 : ℝ) r ×ˢ Icc (0 : ℝ) r := by |
| 38 | intro q hq |
| 39 | exact ⟨⟨hq.1, by linarith [hq.2.1, hq.2.2]⟩, |
| 40 | ⟨hq.2.1, by linarith [hq.1, hq.2.2]⟩⟩ |
| 41 | exact ((isCompact_Icc.prod isCompact_Icc).of_isClosed_subset hclosed hsub).image_of_continuousOn |
| 42 | (F.continuousOn.mono hsource) |
| 43 | |
| 44 | /-- Construct the actual chord barrier for the full occupied cap union at either endpoint of |
| 45 | the trimmed original loop. Source: |
| 46 | `proof-work/tasks/M64/reviews/2026-09-27-intrinsic-obstacle-bands-review.md`, round_1, check |
| 47 | 6. -/ |
| 48 | theorem m64Intrinsic_exists_loop_cap_union_separator |
| 49 | {gamma : ℝ → AnnulusCoordinates} (hg : ContDiff ℝ ∞ gamma) |
| 50 | {T r : ℝ} (hr : 0 < r) (hrT : r < T) (hinj : InjOn gamma (Ico 0 T)) |
| 51 | (H : OpenPartialHomeomorph (ℝ × ℝ) AnnulusCoordinates) (hbase : H 0 = gamma 0) |
| 52 | (haxis : ∀ s : ℝ, H (s, 0) = gamma s) |
| 53 | (haxis' : ∀ s : ℝ, H (0, s) = gamma (T - s)) |
| 54 | (F : Bool × Bool → OpenPartialHomeomorph (ℝ × ℝ) AnnulusCoordinates) |
| 55 | (hsource : ∀ i, |
| 56 | {q : ℝ × ℝ | 0 ≤ q.1 ∧ 0 ≤ q.2 ∧ q.1 + q.2 ≤ r} ⊆ (F i).source) |
| 57 | (hF : ∀ i, ContDiffOn ℝ ∞ (F i) (F i).source) |
| 58 | (hFi : ∀ i, ContDiffOn ℝ ∞ (F i).symm (F i).target) |
| 59 | (hfirst : ∀ i, ∀ s ∈ Icc (0 : ℝ) r, F i (s, 0) = H (sectorParameterEquiv 0 i (s, 0))) |
| 60 | (hsecond : ∀ i, ∀ s ∈ Icc (0 : ℝ) r, F i (0, s) = H (sectorParameterEquiv 0 i (0, s))) |
| 61 | (hchord : ∀ i, ∀ t : ℝ, F i ((1 - t) * r, t * r) = |
| 62 | (1 - t) • F i (r, 0) + t • F i (0, r)) |
| 63 | (hsector : ∀ i, |
| 64 | F i '' {q : ℝ × ℝ | 0 ≤ q.1 ∧ 0 ≤ q.2 ∧ q.1 + q.2 ≤ r} ⊆ |
| 65 | H '' (H.source ∩ (sectorParameterEquiv 0 i) '' {q : ℝ × ℝ | 0 ≤ q.1 ∧ 0 ≤ q.2})) |
| 66 | (positive terminal : Bool) : |
| 67 | let selected := if terminal then (positive, true) else (true, positive) |
| 68 | let occupied (i : Bool × Bool) := if positive then i = (true, true) else i ≠ (true, true) |
| 69 | let A := ⋃ i, ⋃ (_ : occupied i), |
| 70 | F i '' {q : ℝ × ℝ | 0 ≤ q.1 ∧ 0 ≤ q.2 ∧ q.1 + q.2 ≤ r} |
| 71 | ∃ (ell : AnnulusCoordinates →L[ℝ] ℝ) (W : Set AnnulusCoordinates), |
| 72 | IsOpen W ∧ gamma (if terminal then T - r else r) ∈ W ∧ |
| 73 | ell (deriv gamma (if terminal then T - r else r)) = (if terminal then -1 else 1) ∧ |
| 74 | ell (if terminal then F selected (r, 0) - F selected (0, r) |
| 75 | else F selected (0, r) - F selected (r, 0)) = 0 ∧ |
| 76 | ∀ z ∈ W ∩ A, ell (z - gamma (if terminal then T - r else r)) ≤ 0 := by |
| 77 | classical |
| 78 | let selected := if terminal then (positive, true) else (true, positive) |
| 79 | let occupied (i : Bool × Bool) := if positive then i = (true, true) else i ≠ (true, true) |
| 80 | let C (i : Bool × Bool) := |
| 81 | F i '' {q : ℝ × ℝ | 0 ≤ q.1 ∧ 0 ≤ q.2 ∧ q.1 + q.2 ≤ r} |
| 82 | have hclosed (i : Bool × Bool) : IsClosed (C i) := |
| 83 | (m64Intrinsic_cap_isCompact (F i) (hsource i)).isClosed |
| 84 | have hselected : ∀ s ∈ Icc (0 : ℝ) r, |
| 85 | F selected (if terminal then (0, s) else (s, 0)) = |
| 86 | gamma (if terminal then T - s else s) := by |
| 87 | intro s hs |
| 88 | cases terminal |
| 89 | · simpa [selected, sectorParameterEquiv_apply, haxis] using hfirst (true, positive) s hs |
| 90 | · simpa [selected, sectorParameterEquiv_apply, haxis'] using hsecond (positive, true) s hs |
| 91 | obtain ⟨ell, W0, hW0, hpW0, hnorm, hker, hsep⟩ := |
| 92 | m64Intrinsic_exists_cap_endpoint_separator hg hr (F selected) (hsource selected) |
| 93 | (hF selected) (hFi selected) (hchord selected) terminal terminal hselected |
| 94 | let O : Set AnnulusCoordinates := ⋂ i : Bool × Bool, |
| 95 | if occupied i ∧ i ≠ selected then (C i)ᶜ else univ |
| 96 | have hO : IsOpen O := by |
| 97 | apply isOpen_iInter_of_finite |
| 98 | intro i |
| 99 | split_ifs |
| 100 | · exact (hclosed i).isOpen_compl |
| 101 | · exact isOpen_univ |
| 102 | have hpO : gamma (if terminal then T - r else r) ∈ O := by |
| 103 | apply mem_iInter.mpr |
| 104 | intro i |
| 105 | by_cases hi : occupied i ∧ i ≠ selected |
| 106 | · rw [if_pos hi] |
| 107 | intro hmem |
| 108 | exact hi.2 (m64Intrinsic_loop_cap_tip_unique hr hrT hinj H hbase haxis haxis' |
| 109 | F hfirst hsecond hsector positive terminal i hi.1 hmem) |
| 110 | · rw [if_neg hi] |
| 111 | exact mem_univ _ |
| 112 | refine ⟨ell, W0 ∩ O, hW0.inter hO, ⟨hpW0, hpO⟩, hnorm, hker, ?_⟩ |
| 113 | rintro z ⟨⟨hzW, hzO⟩, hzA⟩ |
| 114 | obtain ⟨i, hzA⟩ := mem_iUnion.mp hzA |
| 115 | obtain ⟨hi, hzC⟩ := mem_iUnion.mp hzA |
| 116 | have heq : i = selected := by |
| 117 | by_contra hne |
| 118 | have hnot := mem_iInter.mp hzO i |
| 119 | rw [if_pos ⟨hi, hne⟩] at hnot |
| 120 | exact hnot hzC |
| 121 | apply hsep z |
| 122 | exact ⟨hzW, heq ▸ hzC⟩ |
| 123 | |
| 124 | end PoincareMT |