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.Region.EdgeIncidence |
| 2 | import PoincareLib.Topology.Surface.Triangulation.Regions.Boundary |
| 3 | |
| 4 | /-! |
| 5 | # Exact exposed boundary of a finite coordinate region |
| 6 | |
| 7 | Regular closedness excludes isolated frontier points in the plane. |
| 8 | The paired open sides are interior, so removing the finite corner set |
| 9 | leaves only unpaired sides on the frontier. Closure restores every corner. |
| 10 | |
| 11 | Morgan--Tian context: Proposition 19.35, printed pp. 467-481, especially Claim 19.40, pp. |
| 12 | 470-471. The explicit coordinate-mesh and regional Gauss--Bonnet constructions are project |
| 13 | derivations. |
| 14 | -/ |
| 15 | |
| 16 | noncomputable section |
| 17 | set_option autoImplicit false |
| 18 | set_option backward.isDefEq.respectTransparency false |
| 19 | |
| 20 | open Set Filter Metric |
| 21 | open scoped Topology ContDiff Manifold |
| 22 | open PoincareMT.Topology.Surface |
| 23 | |
| 24 | namespace PoincareMT |
| 25 | |
| 26 | /-- A finite set cannot isolate a frontier point of a regular closed planar region. Both its |
| 27 | interior and its open complement approach every frontier point, while a punctured coordinate |
| 28 | disk remains connected. Source: Morgan--Tian Proposition 19.35, printed pp. 467-481, |
| 29 | including the Gauss--Bonnet argument in Lemma 19.45, p. 474; the explicit regional |
| 30 | construction is reviewed in |
| 31 | `proof-work/tasks/M64/reviews/2026-09-27-round1-intrinsic-euler-turning.md`, Mathematical |
| 32 | Checks. -/ |
| 33 | theorem m64Intrinsic_regularClosed_frontier_dense_off_finite |
| 34 | {R V : Set AnnulusCoordinates} (hR : IsClosed R) |
| 35 | (hreg : closure (interior R) = R) (hV : V.Finite) : |
| 36 | frontier R ⊆ closure (frontier R \ V) := by |
| 37 | have hdense : Dense Vᶜ := by |
| 38 | simpa only [compl_eq_univ_sdiff] using (dense_univ.sdiff_finite hV) |
| 39 | intro p hp |
| 40 | apply _root_.mem_closure_iff.mpr |
| 41 | intro N hN hpN |
| 42 | by_contra hnone |
| 43 | have hfrontN : N ∩ frontier R ⊆ V := by |
| 44 | intro x hx |
| 45 | by_contra hxV |
| 46 | exact hnone ⟨x, hx.1, hx.2, hxV⟩ |
| 47 | let c := chartAt AnnulusCoordinates p |
| 48 | have hpc : p ∈ c.source := mem_chart_source _ p |
| 49 | have hnbhd : c.target ∩ c.symm ⁻¹' N ∈ 𝓝 (c p) := by |
| 50 | refine inter_mem (c.open_target.mem_nhds (c.map_source hpc)) ?_ |
| 51 | apply (c.continuousAt_symm (c.map_source hpc)).preimage_mem_nhds |
| 52 | simpa only [c.left_inv hpc] using hN.mem_nhds hpN |
| 53 | obtain ⟨r, hr, hball⟩ := Metric.mem_nhds_iff.mp hnbhd |
| 54 | let D := c.symm '' ball (c p) r |
| 55 | have htarget : ball (c p) r ⊆ c.target := fun _ hz => (hball hz).1 |
| 56 | have hDopen : IsOpen D := c.isOpen_image_symm_of_subset_target isOpen_ball htarget |
| 57 | have hpD : p ∈ D := ⟨c p, mem_ball_self hr, c.left_inv hpc⟩ |
| 58 | have hDN : D ⊆ N := by |
| 59 | rintro _ ⟨z, hz, rfl⟩ |
| 60 | exact (hball hz).2 |
| 61 | have hDconn : IsPreconnected (D \ V) := |
| 62 | isPreconnected_chart_ball_sdiff_finite p hr htarget hV |
| 63 | have hdisjoint : Disjoint (D \ V) (frontier R) := by |
| 64 | apply disjoint_left.mpr |
| 65 | intro z hz hzfront |
| 66 | exact hz.2 (hfrontN ⟨hDN hz.1, hzfront⟩) |
| 67 | have hpcl : p ∈ closure (interior R) := hreg.symm ▸ hR.frontier_subset hp |
| 68 | obtain ⟨z, hzD, hzR⟩ := _root_.mem_closure_iff.mp hpcl D hDopen hpD |
| 69 | obtain ⟨w, hwV, hwD, hwR⟩ := hdense.exists_mem_open |
| 70 | (hDopen.inter isOpen_interior) ⟨z, hzD, hzR⟩ |
| 71 | have hinside : D \ V ⊆ interior R := |
| 72 | Poincare.Topology.preconnected_subset_interior_of_disjoint_frontier hDconn hdisjoint |
| 73 | ⟨w, ⟨hwD, hwV⟩, hwR⟩ |
| 74 | have hpout : p ∈ closure Rᶜ := by |
| 75 | rw [frontier_eq_closure_inter_closure] at hp |
| 76 | exact hp.2 |
| 77 | obtain ⟨z, hzD, hzR⟩ := _root_.mem_closure_iff.mp hpout D hDopen hpD |
| 78 | obtain ⟨w, hwV, hwD, hwR⟩ := hdense.exists_mem_open |
| 79 | (hDopen.inter hR.isOpen_compl) ⟨z, hzD, hzR⟩ |
| 80 | exact hwR (interior_subset (hinside ⟨hwD, hwV⟩)) |
| 81 | |
| 82 | /-- The complete frontier of an actual compatible finite coordinate family is exactly the |
| 83 | union of its unpaired complete side images. No boundary-edge listing or vertex coverage |
| 84 | assumption is supplied. Source: Morgan--Tian Proposition 19.35, printed pp. 467-481, |
| 85 | including the Gauss--Bonnet argument in Lemma 19.45, p. 474; the explicit regional |
| 86 | construction is reviewed in |
| 87 | `proof-work/tasks/M64/reviews/2026-09-27-round1-intrinsic-euler-turning.md`, Mathematical |
| 88 | Checks. -/ |
| 89 | theorem m64Intrinsic_region_frontier_eq_unpaired_sides |
| 90 | {I : Type*} [Finite I] (face : I → SmoothFace AnnulusCoordinates) |
| 91 | (F : I → OpenPartialHomeomorph AnnulusCoordinates AnnulusCoordinates) |
| 92 | (b : I → AffineBasis (Fin 3) ℝ AnnulusCoordinates) |
| 93 | (hsource : ∀ i, convexHull ℝ (range (b i)) ⊆ (F i).source) |
| 94 | (hcarrier : ∀ i, (face i).carrier = F i '' convexHull ℝ (range (b i))) |
| 95 | (hboundary : ∀ i k, ((face i).boundary k).map = F i ∘ |
| 96 | affineChartSegment (b i (k.succAbove 0)) (b i (k.succAbove 1))) |
| 97 | (hinter : ∀ i j, i ≠ j → |
| 98 | (∃ k l : Fin 3, (face i).carrier ∩ (face j).carrier = |
| 99 | ((face i).boundary k).map '' Icc (0 : ℝ) 1 ∧ |
| 100 | ((face i).boundary k).map '' Icc (0 : ℝ) 1 = |
| 101 | ((face j).boundary l).map '' Icc (0 : ℝ) 1) ∨ |
| 102 | ∃ v : Fin 3, (face i).carrier ∩ (face j).carrier ⊆ {F i (b i v)}) |
| 103 | (hfront : ∀ i j, i ≠ j → (face i).carrier ∩ (face j).carrier ⊆ frontier (face i).carrier) : |
| 104 | frontier (⋃ i, (face i).carrier) = |
| 105 | ⋃ p : {p : I × Fin 3 // ∀ q : I × Fin 3, |
| 106 | faceBoundaryIndex face q.1 q.2 = faceBoundaryIndex face p.1 p.2 → q = p}, |
| 107 | ((face p.1.1).boundary p.1.2).map '' Icc (0 : ℝ) 1 := by |
| 108 | classical |
| 109 | let R := ⋃ i, (face i).carrier |
| 110 | let V := range (fun p : I × Fin 3 => F p.1 (b p.1 p.2)) |
| 111 | let A := {p : I × Fin 3 // ∀ q : I × Fin 3, |
| 112 | faceBoundaryIndex face q.1 q.2 = faceBoundaryIndex face p.1 p.2 → q = p} |
| 113 | let B := ⋃ p : A, ((face p.1.1).boundary p.1.2).map '' Icc (0 : ℝ) 1 |
| 114 | have hR : IsClosed R := isClosed_iUnion_of_finite (fun i => (face i).isClosed_carrier) |
| 115 | have hreg : closure (interior R) = R := by |
| 116 | apply Poincare.Topology.closure_interior_iUnion_of_regular_closed _ |
| 117 | (fun i => (face i).isClosed_carrier) |
| 118 | intro i |
| 119 | rw [hcarrier] |
| 120 | exact coordinate_triangle_closure_interior (F i) (b i) (hsource i) |
| 121 | have hB : IsClosed B := isClosed_iUnion_of_finite (fun p => |
| 122 | (isCompact_Icc.image_of_continuousOn |
| 123 | ((face p.1.1).boundary p.1.2).smooth.continuousOn).isClosed) |
| 124 | have hsub : frontier R \ V ⊆ B := by |
| 125 | rintro x ⟨hx, hxV⟩ |
| 126 | obtain ⟨i, hxi⟩ := mem_iUnion.mp (hR.frontier_subset hx) |
| 127 | have hxfront : x ∈ frontier (face i).carrier := by |
| 128 | refine ⟨subset_closure hxi, ?_⟩ |
| 129 | intro hint |
| 130 | exact hx.2 (interior_mono (subset_iUnion (fun j => (face j).carrier) i) hint) |
| 131 | rw [(face i).boundary_carrier] at hxfront |
| 132 | obtain ⟨k, t, ht, htx⟩ := mem_iUnion.mp hxfront |
| 133 | have ht0 : t ≠ 0 := by |
| 134 | intro heq |
| 135 | apply hxV |
| 136 | refine ⟨(i, k.succAbove 0), ?_⟩ |
| 137 | simpa only [heq, hboundary, Function.comp_apply, affineChartSegment, |
| 138 | zero_smul, sub_zero, one_smul, add_zero] using htx |
| 139 | have ht1 : t ≠ 1 := by |
| 140 | intro heq |
| 141 | apply hxV |
| 142 | refine ⟨(i, k.succAbove 1), ?_⟩ |
| 143 | simpa only [heq, hboundary, Function.comp_apply, affineChartSegment, |
| 144 | one_smul, sub_self, zero_smul, zero_add, ← add_sub_assoc, add_sub_cancel_left] using htx |
| 145 | have htopen : t ∈ Ioo (0 : ℝ) 1 := |
| 146 | ⟨lt_of_le_of_ne ht.1 (Ne.symm ht0), lt_of_le_of_ne ht.2 ht1⟩ |
| 147 | have hunpaired : ∀ q : I × Fin 3, |
| 148 | faceBoundaryIndex face q.1 q.2 = faceBoundaryIndex face i k → q = (i, k) := by |
| 149 | intro q hq |
| 150 | by_contra hne |
| 151 | have hxint := m64Intrinsic_paired_side_subset_region_interior face F b hsource |
| 152 | hcarrier hboundary hfront (i, k) q (Ne.symm hne) hq.symm ⟨t, htopen, htx⟩ |
| 153 | exact hx.2 hxint |
| 154 | exact mem_iUnion.mpr ⟨⟨(i, k), hunpaired⟩, t, ht, htx⟩ |
| 155 | change frontier R = B |
| 156 | apply Subset.antisymm |
| 157 | · exact (m64Intrinsic_regularClosed_frontier_dense_off_finite hR hreg |
| 158 | (finite_range _)).trans (closure_minimal hsub hB) |
| 159 | · rintro x hx |
| 160 | obtain ⟨p, hp⟩ := mem_iUnion.mp hx |
| 161 | exact m64Intrinsic_unpaired_side_subset_region_frontier face F b hsource hboundary |
| 162 | hinter p.1 p.2 hp |
| 163 | |
| 164 | end PoincareMT |