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.Joined.PatchData |
| 2 | import PoincareLib.Geometry.CurveShortening.Comparison.IntrinsicComparison.Chain.NestedPatch |
| 3 | |
| 4 | /-! Exact chain contacts with the actual retained replacement patch. |
| 5 | Source: MT Claim 19.40, pp. 470-471; combined-boundary-collar derivation, |
| 6 | Section 2. The proof compares literal physical cuts. -/ |
| 7 | |
| 8 | noncomputable section |
| 9 | set_option autoImplicit false |
| 10 | set_option backward.isDefEq.respectTransparency false |
| 11 | |
| 12 | open Set |
| 13 | open scoped Topology |
| 14 | open PoincareMT.Topology.Surface |
| 15 | |
| 16 | namespace PoincareMT |
| 17 | |
| 18 | /-- Retained patch data with the selected physical length gives the chain's exact cap and |
| 19 | patch contacts, independent of its scalar frames. Source: MT Claim 19.40; |
| 20 | combined-boundary-collar derivation, Section 2. Source: |
| 21 | `proof-work/tasks/M64/derivations/2026-09-27-combined-boundary-collar.md`, Section 2. -/ |
| 22 | theorem m64Intrinsic_joined_patch_chain_contacts |
| 23 | {gamma : Bool → ℝ → AnnulusCoordinates} {T b : Bool → ℝ} |
| 24 | {U C : Set AnnulusCoordinates} (P Q : M64IntrinsicJoinedBandPatch gamma T b U) |
| 25 | (e : Bool) {a d : ℝ} (E : M64IntrinsicArcBandChain (gamma e) a d U) |
| 26 | (hell : E.length ≤ 1) (hattach : b e = if e then a else d) |
| 27 | (hdir : E.direction (if e then a else d) = |
| 28 | (if e then P.right_length else P.left_length) • P.direction) |
| 29 | (hQdir : Q.direction = P.direction) |
| 30 | (hQlength : (if e then Q.right_length else Q.left_length) = |
| 31 | E.length * (if e then P.right_length else P.left_length)) |
| 32 | (hpath : ∀ z ∈ Icc (0 : ℝ) 1, gamma e (if e then d else a) + |
| 33 | z • E.direction (if e then d else a) ∈ C) |
| 34 | (hC : Disjoint C ((P.band e).carrier ∪ (P.band (!e)).carrier)) |
| 35 | (hnew : ∀ j, (Q.band j).carrier ⊆ (P.band j).carrier) |
| 36 | (houter : (Q.band e).carrier ∩ |
| 37 | (if e then (P.band e).rightCut else (P.band e).leftCut) = |
| 38 | (if e then (Q.band e).rightCut else (Q.band e).leftCut)) |
| 39 | (hcontact : ∀ i, (C ∪ ((P.band e).carrier ∪ (P.band (!e)).carrier)) ∩ |
| 40 | (E.band i).carrier = (if E.cut i.castSucc = a then (E.band i).leftCut else ∅) ∪ |
| 41 | (if E.cut i.succ = d then (E.band i).rightCut else ∅)) : |
| 42 | (if e then (Q.band e).rightCut else (Q.band e).leftCut) = |
| 43 | segment ℝ (gamma e (if e then a else d)) |
| 44 | (gamma e (if e then a else d) + E.length • E.direction (if e then a else d)) ∧ |
| 45 | ∀ i, |
| 46 | C ∩ (E.band i).carrier = |
| 47 | (if e then (if E.cut i.succ = d then (E.band i).rightCut else ∅) |
| 48 | else (if E.cut i.castSucc = a then (E.band i).leftCut else ∅)) ∧ |
| 49 | (Q.band e).carrier ∩ (E.band i).carrier = |
| 50 | (if e then (if E.cut i.castSucc = a then (E.band i).leftCut else ∅) |
| 51 | else (if E.cut i.succ = d then (E.band i).rightCut else ∅)) ∧ |
| 52 | Disjoint (Q.band (!e)).carrier (E.band i).carrier := by |
| 53 | have hcut : (if e then (Q.band e).rightCut else (Q.band e).leftCut) = |
| 54 | segment ℝ (gamma e (if e then a else d)) |
| 55 | (gamma e (if e then a else d) + E.length • E.direction (if e then a else d)) := by |
| 56 | rw [Q.outer_cut, hattach, hQdir, hQlength, hdir, smul_smul] |
| 57 | have hBZ : (P.band e).carrier ∩ (P.band (!e)).carrier ⊆ |
| 58 | if e then (P.band e).leftCut else (P.band e).rightCut := by |
| 59 | cases e |
| 60 | · exact (P.intersection.trans (P.inner_cut false).symm).subset |
| 61 | · exact ((inter_comm _ _).trans (P.intersection.trans (P.inner_cut true).symm)).subset |
| 62 | have hnewCut : (if e then (Q.band e).rightCut else (Q.band e).leftCut) ⊆ |
| 63 | if e then (P.band e).rightCut else (P.band e).leftCut := |
| 64 | fun _ hp => (houter.symm.subset hp).2 |
| 65 | have hcutCarrier : (if e then (Q.band e).rightCut else (Q.band e).leftCut) ⊆ |
| 66 | (Q.band e).carrier := by |
| 67 | rw [← (Q.band e).endpointEdge_image e] |
| 68 | exact ((Q.band e).endpointEdge_subset_frontier e).trans |
| 69 | (Q.band e).isClosed_carrier.frontier_subset |
| 70 | have hcapSegment : segment ℝ (gamma e (if e then d else a)) |
| 71 | (gamma e (if e then d else a) + E.length • E.direction (if e then d else a)) ⊆ C := by |
| 72 | rw [← m64Intrinsic_ray_image_eq_segment _ _ E.length_pos.le] |
| 73 | rintro p ⟨z, hz, rfl⟩ |
| 74 | exact hpath z ⟨hz.1, hz.2.trans hell⟩ |
| 75 | refine ⟨hcut, ?_⟩ |
| 76 | intro i |
| 77 | let S := if e then (if E.cut i.succ = d then (E.band i).rightCut else ∅) |
| 78 | else (if E.cut i.castSucc = a then (E.band i).leftCut else ∅) |
| 79 | let R := if e then (if E.cut i.castSucc = a then (E.band i).leftCut else ∅) |
| 80 | else (if E.cut i.succ = d then (E.band i).rightCut else ∅) |
| 81 | have hS : S ⊆ C := by |
| 82 | intro p hp |
| 83 | cases e |
| 84 | · change p ∈ (if E.cut i.castSucc = a then (E.band i).leftCut else ∅) at hp |
| 85 | split_ifs at hp with he |
| 86 | · rw [E.left_cut, he] at hp |
| 87 | exact hcapSegment hp |
| 88 | · exact hp.elim |
| 89 | · change p ∈ (if E.cut i.succ = d then (E.band i).rightCut else ∅) at hp |
| 90 | split_ifs at hp with he |
| 91 | · rw [E.right_cut, he] at hp |
| 92 | exact hcapSegment hp |
| 93 | · exact hp.elim |
| 94 | have hRcut : R ⊆ (if e then (Q.band e).rightCut else (Q.band e).leftCut) := by |
| 95 | intro p hp |
| 96 | rw [hcut] |
| 97 | cases e |
| 98 | · change p ∈ (if E.cut i.succ = d then (E.band i).rightCut else ∅) at hp |
| 99 | split_ifs at hp with he |
| 100 | · rw [E.right_cut, he] at hp |
| 101 | exact hp |
| 102 | · exact hp.elim |
| 103 | · change p ∈ (if E.cut i.castSucc = a then (E.band i).leftCut else ∅) at hp |
| 104 | split_ifs at hp with he |
| 105 | · rw [E.left_cut, he] at hp |
| 106 | exact hp |
| 107 | · exact hp.elim |
| 108 | have hR : R ⊆ (if e then (P.band e).rightCut else (P.band e).leftCut) ∩ |
| 109 | (Q.band e).carrier := subset_inter (hRcut.trans hnewCut) (hRcut.trans hcutCarrier) |
| 110 | have hcontact' : (C ∪ ((P.band e).carrier ∪ (P.band (!e)).carrier)) ∩ |
| 111 | (E.band i).carrier = S ∪ R := by |
| 112 | rw [hcontact] |
| 113 | cases e |
| 114 | · rfl |
| 115 | · exact union_comm _ _ |
| 116 | exact m64Intrinsic_nested_patch_obstacle_contacts (P.band e) e hBZ hC |
| 117 | (hnew e) (hnew (!e)) hS hR hcontact' |
| 118 | |
| 119 | end PoincareMT |