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.Cap.CoreMatching |
| 2 | |
| 3 | /-! |
| 4 | # Synchronized coordinate triangles for a region with boundary |
| 5 | |
| 6 | The lower finite-cover subdivision constructs its shared boundary marks |
| 7 | before using the hypothesis that the covered set is the whole surface. |
| 8 | Here that construction is carried out for the actual finite union. The |
| 9 | original parent maps and mesh ancestry are retained; no ambient covering |
| 10 | or boundary pairing is assumed. This is the regional assembly used for |
| 11 | the return-region argument of MT Lemma 19.45. |
| 12 | -/ |
| 13 | |
| 14 | noncomputable section |
| 15 | set_option autoImplicit false |
| 16 | set_option backward.isDefEq.respectTransparency false |
| 17 | |
| 18 | open Set |
| 19 | open scoped Topology ContDiff Manifold |
| 20 | open PoincareMT.Topology.Surface Poincare.Topology.Plane.Meshes |
| 21 | |
| 22 | namespace PoincareMT |
| 23 | |
| 24 | private theorem region_segment_image (p q : AnnulusCoordinates) : |
| 25 | affineChartSegment p q '' Icc (0 : ℝ) 1 = affineSegment ℝ p q := by |
| 26 | unfold affineSegment |
| 27 | congr 1 |
| 28 | funext t |
| 29 | simp [affineChartSegment, AffineMap.lineMap_apply, add_comm] |
| 30 | |
| 31 | private theorem region_vertex_frontier (b : AffineBasis (Fin 3) ℝ AnnulusCoordinates) : |
| 32 | range b ⊆ frontier (convexHull ℝ (range b)) := by |
| 33 | rintro z ⟨i, rfl⟩ |
| 34 | rw [frontier_convexHull_affineBasis_fin3_segments] |
| 35 | have hedge (k : Fin 3) (t : ℝ) (ht : t ∈ Icc (0 : ℝ) 1) : |
| 36 | affineChartSegment (b (k.succAbove 0)) (b (k.succAbove 1)) t ∈ |
| 37 | ⋃ j : Fin 3, affineSegment ℝ (b (j.succAbove 0)) (b (j.succAbove 1)) := by |
| 38 | apply mem_iUnion.mpr |
| 39 | refine ⟨k, ?_⟩ |
| 40 | rw [← region_segment_image] |
| 41 | exact mem_image_of_mem _ ht |
| 42 | fin_cases i |
| 43 | · simpa [affineChartSegment] using hedge 1 0 (by simp) |
| 44 | · simpa [affineChartSegment] using hedge 0 0 (by simp) |
| 45 | · simpa [affineChartSegment] using hedge 0 1 (by simp) |
| 46 | |
| 47 | private theorem region_subdivision_intersections |
| 48 | {F : OpenPartialHomeomorph AnnulusCoordinates AnnulusCoordinates} |
| 49 | {b : AffineBasis (Fin 3) ℝ AnnulusCoordinates} {S : Finset AnnulusCoordinates} |
| 50 | (R : SmoothTriangleBoundarySubdivision F b S) (t u : R.mesh.Triangle) (htu : t ≠ u) : |
| 51 | (∃ k l : Fin 3, (R.face t).carrier ∩ (R.face u).carrier = |
| 52 | ((R.face t).boundary k).map '' Icc (0 : ℝ) 1 ∧ |
| 53 | ((R.face t).boundary k).map '' Icc (0 : ℝ) 1 = |
| 54 | ((R.face u).boundary l).map '' Icc (0 : ℝ) 1) ∨ |
| 55 | ∃ v : Fin 3, (R.face t).carrier ∩ (R.face u).carrier ⊆ |
| 56 | {F (meshTriangleBasis R.mesh t v)} := by |
| 57 | have hedge (s : R.mesh.Triangle) (k : Fin 3) : |
| 58 | ((R.face s).boundary k).map '' Icc (0 : ℝ) 1 = |
| 59 | F '' affineSegment ℝ (meshTriangleBasis R.mesh s (k.succAbove 0)) |
| 60 | (meshTriangleBasis R.mesh s (k.succAbove 1)) := by |
| 61 | rw [R.boundary_map, image_comp, region_segment_image] |
| 62 | rw [R.carrier_eq, R.carrier_eq, ← F.injOn.image_inter (R.source_subset t) (R.source_subset u)] |
| 63 | rcases meshTriangleBasis_pair_intersections R.mesh t u htu with ⟨k, l, hk, hl⟩ | ⟨v, hvt, hv⟩ |
| 64 | · exact Or.inl ⟨k, l, by rw [hk, hedge], by rw [hedge, hedge, hl]⟩ |
| 65 | · obtain ⟨j, hj⟩ : v ∈ range (R.mesh.orderedVertex t) := by |
| 66 | rw [R.mesh.range_orderedVertex] |
| 67 | exact hvt |
| 68 | refine Or.inr ⟨j, ?_⟩ |
| 69 | rintro q ⟨z, hz, rfl⟩ |
| 70 | rw [mem_singleton_iff.mp (hv hz), ← hj] |
| 71 | exact mem_singleton _ |
| 72 | |
| 73 | /-- Every finite family with the derived canonical parent contacts has actual synchronized |
| 74 | children with whole-edge or vertex intersections. Their union is exactly the original |
| 75 | region, including its boundary. Source: Morgan--Tian Proposition 19.35, printed pp. 467-481, |
| 76 | especially the regional Gauss--Bonnet argument of Lemma 19.45, p. 474; the explicit |
| 77 | coordinate construction is reviewed in |
| 78 | `proof-work/tasks/M64/reviews/2026-09-27-round1-intrinsic-contacts.md`, Mathematical Checks. -/ |
| 79 | theorem m64Intrinsic_exists_compatible_region_refinement |
| 80 | {I : Type*} [Finite I] |
| 81 | (F : I → OpenPartialHomeomorph AnnulusCoordinates AnnulusCoordinates) |
| 82 | (b : I → AffineBasis (Fin 3) ℝ AnnulusCoordinates) |
| 83 | (hF : ∀ i, ContMDiffOn (𝓡 2) (𝓡 2) ∞ (F i) (F i).source) |
| 84 | (hFi : ∀ i, ContMDiffOn (𝓡 2) (𝓡 2) ∞ (F i).symm (F i).target) |
| 85 | (hsource : ∀ i, convexHull ℝ (range (b i)) ⊆ (F i).source) |
| 86 | (hparents : ∀ i j, i ≠ j → CoordinateTriangleBoundaryIntersection (F i) (F j) (b i) (b j)) : |
| 87 | ∃ (S : I → Finset AnnulusCoordinates) |
| 88 | (R : ∀ i, SmoothTriangleBoundarySubdivisionWithRefinement (F i) (b i) (S i)), |
| 89 | (∀ (a d : (i : I) × (R i).mesh.Triangle), a ≠ d → |
| 90 | (((∃ k l : Fin 3, ((R a.1).face a.2).carrier ∩ ((R d.1).face d.2).carrier = |
| 91 | (((R a.1).face a.2).boundary k).map '' Icc (0 : ℝ) 1 ∧ |
| 92 | (((R a.1).face a.2).boundary k).map '' Icc (0 : ℝ) 1 = |
| 93 | (((R d.1).face d.2).boundary l).map '' Icc (0 : ℝ) 1) ∨ |
| 94 | ∃ v : Fin 3, ((R a.1).face a.2).carrier ∩ ((R d.1).face d.2).carrier ⊆ |
| 95 | {F a.1 (meshTriangleBasis (R a.1).mesh a.2 v)}) ∧ |
| 96 | ((R a.1).face a.2).carrier ∩ ((R d.1).face d.2).carrier ⊆ |
| 97 | frontier ((R a.1).face a.2).carrier)) ∧ |
| 98 | (⋃ a : (i : I) × (R i).mesh.Triangle, ((R a.1).face a.2).carrier) = |
| 99 | ⋃ i, F i '' convexHull ℝ (range (b i)) := by |
| 100 | classical |
| 101 | let J := {ij : I × I // ij.1 ≠ ij.2} |
| 102 | choose P hP using fun ij : J => (hparents ij.1.1 ij.1.2 ij.2).exists_marks |
| 103 | let V : Set AnnulusCoordinates := |
| 104 | (⋃ i, F i '' range (b i)) ∪ ⋃ ij : J, (P ij : Set AnnulusCoordinates) |
| 105 | have hV : V.Finite := |
| 106 | (finite_iUnion (fun i => (finite_range (b i)).image (F i))).union |
| 107 | (finite_iUnion (fun ij => (P ij).finite_toSet)) |
| 108 | let allmarks := hV.toFinset |
| 109 | let S (i : I) := allmarks.filter |
| 110 | (fun q => q ∈ F i '' frontier (convexHull ℝ (range (b i)))) |
| 111 | have hS (i : I) : (S i : Set AnnulusCoordinates) ⊆ |
| 112 | F i '' frontier (convexHull ℝ (range (b i))) := |
| 113 | fun _ hq => (Finset.mem_filter.mp hq).2 |
| 114 | have hvertices (i : I) : F i '' range (b i) ⊆ (S i : Set AnnulusCoordinates) := by |
| 115 | intro q hq |
| 116 | refine Finset.mem_filter.mpr ⟨?_, image_mono (region_vertex_frontier (b i)) hq⟩ |
| 117 | exact (Set.Finite.mem_toFinset hV).mpr (Or.inl (mem_iUnion.mpr ⟨i, hq⟩)) |
| 118 | have hpairmarks (ij : J) : (P ij : Set AnnulusCoordinates) ⊆ S ij.1.1 ∧ |
| 119 | (P ij : Set AnnulusCoordinates) ⊆ S ij.1.2 := by |
| 120 | have hglobal {q : AnnulusCoordinates} (hq : q ∈ (P ij : Set AnnulusCoordinates)) : |
| 121 | q ∈ allmarks := (Set.Finite.mem_toFinset hV).mpr (Or.inr (mem_iUnion.mpr ⟨ij, hq⟩)) |
| 122 | exact ⟨fun _ hq => Finset.mem_filter.mpr ⟨hglobal hq, ((hP ij).1 hq).1⟩, |
| 123 | fun _ hq => Finset.mem_filter.mpr ⟨hglobal hq, ((hP ij).1 hq).2⟩⟩ |
| 124 | have hfrontsub (i : I) : F i '' frontier (convexHull ℝ (range (b i))) ⊆ |
| 125 | F i '' convexHull ℝ (range (b i)) := |
| 126 | image_mono ((finite_range (b i)).isCompact_convexHull ℝ).isClosed.frontier_subset |
| 127 | have hsync (i j : I) (hij : i ≠ j) : |
| 128 | (S i : Set AnnulusCoordinates) ∩ (F j '' convexHull ℝ (range (b j))) = |
| 129 | (S j : Set AnnulusCoordinates) ∩ (F i '' convexHull ℝ (range (b i))) := by |
| 130 | ext q |
| 131 | constructor |
| 132 | · rintro ⟨hqi, hqj⟩ |
| 133 | have hqKi := hfrontsub i (hS i hqi) |
| 134 | exact ⟨Finset.mem_filter.mpr ⟨(Finset.mem_filter.mp hqi).1, |
| 135 | ((hparents i j hij).subset_frontiers ⟨hqKi, hqj⟩).2⟩, hqKi⟩ |
| 136 | · rintro ⟨hqj, hqi⟩ |
| 137 | have hqKj := hfrontsub j (hS j hqj) |
| 138 | exact ⟨Finset.mem_filter.mpr ⟨(Finset.mem_filter.mp hqj).1, |
| 139 | ((hparents i j hij).subset_frontiers ⟨hqi, hqKj⟩).1⟩, hqKj⟩ |
| 140 | choose R _ using fun i => exists_smoothTriangleBoundarySubdivision_with_refinement |
| 141 | (F i) (hF i) (hFi i) (b i) (hsource i) (S i) (hS i) (hvertices i) |
| 142 | (0 : AnnulusCoordinates) (by simp) |
| 143 | refine ⟨S, R, ?_, ?_⟩ |
| 144 | · rintro ⟨i, t⟩ ⟨j, u⟩ had |
| 145 | by_cases hij : i = j |
| 146 | · subst j |
| 147 | have htu : t ≠ u := fun h => had (h ▸ rfl) |
| 148 | exact ⟨region_subdivision_intersections (R i).toSmoothTriangleBoundarySubdivision t u htu, |
| 149 | (R i).intersection_frontier t u htu⟩ |
| 150 | · let ij : J := ⟨(i, j), hij⟩ |
| 151 | have h := (hP ij).2 (S i) (S j) (hpairmarks ij).1 (hpairmarks ij).2 |
| 152 | (R i).toSmoothTriangleBoundarySubdivision (R j).toSmoothTriangleBoundarySubdivision |
| 153 | (hsync i j hij) t u |
| 154 | exact ⟨h.1, h.2.trans inter_subset_left⟩ |
| 155 | · ext q |
| 156 | constructor |
| 157 | · intro hq |
| 158 | obtain ⟨a, ha⟩ := mem_iUnion.mp hq |
| 159 | apply mem_iUnion.mpr |
| 160 | refine ⟨a.1, ?_⟩ |
| 161 | rw [← (R a.1).cover] |
| 162 | exact mem_iUnion.mpr ⟨a.2, ha⟩ |
| 163 | · intro hq |
| 164 | obtain ⟨i, hi⟩ := mem_iUnion.mp hq |
| 165 | rw [← (R i).cover] at hi |
| 166 | obtain ⟨t, ht⟩ := mem_iUnion.mp hi |
| 167 | exact mem_iUnion.mpr ⟨⟨i, t⟩, ht⟩ |
| 168 | |
| 169 | end PoincareMT |