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.Child.BoundaryContacts |
| 2 | |
| 3 | /-! |
| 4 | # Inherited canonical contacts for arbitrary coordinate children |
| 5 | |
| 6 | Children need not have synchronized boundary marks for their contacts to |
| 7 | be canonical closed subintervals. The subsequent common-mark refinement |
| 8 | can therefore be applied to the whole cap-band-core family. |
| 9 | This supplies the subdivision step in the regional Gauss--Bonnet argument |
| 10 | for Morgan--Tian Lemma 19.45, printed p. 474, and Proposition 19.35, pp. 467-481. |
| 11 | |
| 12 | Morgan--Tian context: Proposition 19.35, printed pp. 467-481, especially Claim 19.40, pp. |
| 13 | 470-471. The explicit coordinate-mesh and regional Gauss--Bonnet constructions are project |
| 14 | derivations. |
| 15 | -/ |
| 16 | |
| 17 | noncomputable section |
| 18 | set_option autoImplicit false |
| 19 | set_option backward.isDefEq.respectTransparency false |
| 20 | |
| 21 | open Set |
| 22 | open scoped Topology |
| 23 | open PoincareMT.Topology.Surface Poincare.Topology.Plane.Meshes |
| 24 | |
| 25 | namespace PoincareMT |
| 26 | |
| 27 | private theorem child_parent_frontier |
| 28 | (F : OpenPartialHomeomorph Plane AnnulusCoordinates) |
| 29 | (b c : AffineBasis (Fin 3) ℝ Plane) |
| 30 | (hsource : convexHull ℝ (range b) ⊆ F.source) |
| 31 | (hchild : convexHull ℝ (range c) ⊆ convexHull ℝ (range b)) : |
| 32 | (F '' convexHull ℝ (range c)) ∩ (F '' frontier (convexHull ℝ (range b))) ⊆ |
| 33 | F '' frontier (convexHull ℝ (range c)) := by |
| 34 | rintro x ⟨⟨z, hz, hzx⟩, ⟨w, hw, hwx⟩⟩ |
| 35 | have hwsource : w ∈ F.source := |
| 36 | hsource (((finite_range b).isCompact_convexHull ℝ).isClosed.frontier_subset hw) |
| 37 | have hzw := F.injOn (hsource (hchild hz)) hwsource (hzx.trans hwx.symm) |
| 38 | refine ⟨z, ⟨subset_closure hz, ?_⟩, hzx⟩ |
| 39 | intro hzi |
| 40 | exact (hzw.symm ▸ hw).2 (interior_mono hchild hzi) |
| 41 | |
| 42 | private theorem child_parent_edge |
| 43 | (F : OpenPartialHomeomorph Plane AnnulusCoordinates) |
| 44 | (b c : AffineBasis (Fin 3) ℝ Plane) |
| 45 | (hsource : convexHull ℝ (range b) ⊆ F.source) |
| 46 | (hchild : convexHull ℝ (range c) ⊆ convexHull ℝ (range b)) (i : Fin 3) : |
| 47 | ∃ k : Fin 3, |
| 48 | (F '' convexHull ℝ (range c)) ∩ |
| 49 | (F '' affineSegment ℝ (b (i.succAbove 0)) (b (i.succAbove 1))) ⊆ |
| 50 | F '' affineSegment ℝ (c (k.succAbove 0)) (c (k.succAbove 1)) := by |
| 51 | have hside : ∀ k : Fin 3, 0 ≤ b.coord i (c k) := by |
| 52 | intro k |
| 53 | have h := hchild (subset_convexHull ℝ _ (mem_range_self k)) |
| 54 | rw [b.convexHull_eq_nonneg_coord] at h |
| 55 | exact h i |
| 56 | have hzero : affineSegment ℝ (b (i.succAbove 0)) (b (i.succAbove 1)) ⊆ |
| 57 | {z | b.coord i z = 0} := by |
| 58 | rw [affineSegment_eq_segment, segment_eq_image_lineMap] |
| 59 | rintro z ⟨t, _, rfl⟩ |
| 60 | rw [mem_ofPred_eq, AffineMap.apply_lineMap] |
| 61 | simp only [b.coord_apply_ne (Ne.symm (Fin.succAbove_ne i 0)), |
| 62 | b.coord_apply_ne (Ne.symm (Fin.succAbove_ne i 1)), AffineMap.lineMap_same_apply] |
| 63 | obtain ⟨k, hk⟩ := triangle_inter_zero_subset_edge c (b.coord i) (b.surjective_coord i) |
| 64 | (Or.inl hside) |
| 65 | refine ⟨k, ?_⟩ |
| 66 | rintro x ⟨⟨z, hz, hzx⟩, ⟨w, hw, hwx⟩⟩ |
| 67 | have hzw := F.injOn (hsource (hchild hz)) |
| 68 | (hsource (Euler.coordinate_edge_subset_hull b i hw)) (hzx.trans hwx.symm) |
| 69 | exact ⟨z, hk ⟨hz, hzero (hzw.symm ▸ hw)⟩, hzx⟩ |
| 70 | |
| 71 | private theorem subinterval_subset_edge |
| 72 | (F : OpenPartialHomeomorph Plane AnnulusCoordinates) |
| 73 | (b : AffineBasis (Fin 3) ℝ Plane) (i : Fin 3) |
| 74 | {a d : ℝ} (ha : a ∈ Icc (0 : ℝ) 1) (hd : d ∈ Icc (0 : ℝ) 1) : |
| 75 | (F ∘ affineChartSegment (b (i.succAbove 0)) (b (i.succAbove 1))) '' uIcc a d ⊆ |
| 76 | F '' affineSegment ℝ (b (i.succAbove 0)) (b (i.succAbove 1)) := by |
| 77 | rw [image_comp, ← Euler.affineChartSegment_image] |
| 78 | apply image_mono (image_mono ?_) |
| 79 | exact fun _ ht => ⟨(le_min ha.1 hd.1).trans ht.1, ht.2.trans (max_le ha.2 hd.2)⟩ |
| 80 | |
| 81 | /-- Canonical boundary contacts of coordinate parents induce canonical contacts of arbitrary |
| 82 | nondegenerate coordinate children. Synchronized marks are not needed until the later |
| 83 | whole-edge matching step. Source: Morgan--Tian Proposition 19.35, printed pp. 467-481, |
| 84 | especially the regional Gauss--Bonnet argument of Lemma 19.45, p. 474; the explicit |
| 85 | coordinate construction is reviewed in |
| 86 | `proof-work/tasks/M64/reviews/2026-09-27-round1-intrinsic-contacts.md`, Mathematical Checks. -/ |
| 87 | theorem m64Intrinsic_canonical_contact_children |
| 88 | (F G : OpenPartialHomeomorph Plane AnnulusCoordinates) |
| 89 | (b c d e : AffineBasis (Fin 3) ℝ Plane) |
| 90 | (hF : convexHull ℝ (range b) ⊆ F.source) |
| 91 | (hG : convexHull ℝ (range c) ⊆ G.source) |
| 92 | (hd : convexHull ℝ (range d) ⊆ convexHull ℝ (range b)) |
| 93 | (he : convexHull ℝ (range e) ⊆ convexHull ℝ (range c)) |
| 94 | (hparents : CoordinateTriangleBoundaryIntersection F G b c) : |
| 95 | CoordinateTriangleBoundaryIntersection F G d e := by |
| 96 | have hFd : F '' convexHull ℝ (range d) ⊆ F '' convexHull ℝ (range b) := image_mono hd |
| 97 | have hGe : G '' convexHull ℝ (range e) ⊆ G '' convexHull ℝ (range c) := image_mono he |
| 98 | have hFdcompact := ((finite_range d).isCompact_convexHull ℝ).image_of_continuousOn |
| 99 | (F.continuousOn.mono (hd.trans hF)) |
| 100 | have hGecompact := ((finite_range e).isCompact_convexHull ℝ).image_of_continuousOn |
| 101 | (G.continuousOn.mono (he.trans hG)) |
| 102 | cases hparents with |
| 103 | | disjoint h => |
| 104 | exact CoordinateTriangleBoundaryIntersection.disjoint (h.mono hFd hGe) |
| 105 | | point q hqF hqG hq => |
| 106 | by_cases hne : ((F '' convexHull ℝ (range d)) ∩ (G '' convexHull ℝ (range e))).Nonempty |
| 107 | · obtain ⟨x, hx⟩ := hne |
| 108 | have hxq := mem_singleton_iff.mp (hq ⟨hFd hx.1, hGe hx.2⟩) |
| 109 | apply CoordinateTriangleBoundaryIntersection.point q |
| 110 | · exact child_parent_frontier F b d hF hd ⟨hxq ▸ hx.1, hqF⟩ |
| 111 | · exact child_parent_frontier G c e hG he ⟨hxq ▸ hx.2, hqG⟩ |
| 112 | · exact fun z hz => hq ⟨hFd hz.1, hGe hz.2⟩ |
| 113 | · exact CoordinateTriangleBoundaryIntersection.disjoint |
| 114 | (disjoint_iff_inter_eq_empty.mpr (not_nonempty_iff_eq_empty.mp hne)) |
| 115 | | subsegment i j a s a' s' ha hs ha' hs' hparentF hparentG => |
| 116 | let H := (F '' convexHull ℝ (range b)) ∩ (G '' convexHull ℝ (range c)) |
| 117 | let A := (F '' convexHull ℝ (range d)) ∩ H |
| 118 | let B := (G '' convexHull ℝ (range e)) ∩ H |
| 119 | have hHcompact : IsCompact H := |
| 120 | (((finite_range b).isCompact_convexHull ℝ).image_of_continuousOn |
| 121 | (F.continuousOn.mono hF)).inter |
| 122 | (((finite_range c).isCompact_convexHull ℝ).image_of_continuousOn |
| 123 | (G.continuousOn.mono hG)) |
| 124 | have hHedgeF : H ⊆ F '' affineSegment ℝ (b (i.succAbove 0)) (b (i.succAbove 1)) := by |
| 125 | dsimp only [H] |
| 126 | rw [hparentF] |
| 127 | exact subinterval_subset_edge F b i ha hs |
| 128 | have hHedgeG : H ⊆ G '' affineSegment ℝ (c (j.succAbove 0)) (c (j.succAbove 1)) := by |
| 129 | dsimp only [H] |
| 130 | rw [hparentG] |
| 131 | exact subinterval_subset_edge G c j ha' hs' |
| 132 | have hAconnected : IsPreconnected A := by |
| 133 | dsimp only [A, H] |
| 134 | rw [hparentF] |
| 135 | exact m64Intrinsic_child_parent_subsegment_preconnected F b d hF hd i ha hs |
| 136 | have hBconnected : IsPreconnected B := by |
| 137 | dsimp only [B, H] |
| 138 | rw [hparentG] |
| 139 | exact m64Intrinsic_child_parent_subsegment_preconnected G c e hG he j ha' hs' |
| 140 | have hXeq : (F '' convexHull ℝ (range d)) ∩ (G '' convexHull ℝ (range e)) = A ∩ B := by |
| 141 | ext x |
| 142 | constructor |
| 143 | · intro hx |
| 144 | have hxH : x ∈ H := ⟨hFd hx.1, hGe hx.2⟩ |
| 145 | exact ⟨⟨hx.1, hxH⟩, ⟨hx.2, hxH⟩⟩ |
| 146 | · exact fun hx => ⟨hx.1.1, hx.2.1⟩ |
| 147 | have hconnected : IsPreconnected ((F '' convexHull ℝ (range d)) ∩ |
| 148 | (G '' convexHull ℝ (range e))) := by |
| 149 | rw [hXeq] |
| 150 | exact m64Intrinsic_common_coordinate_edge_inter_preconnected F b hF i |
| 151 | (hFdcompact.inter hHcompact) (hGecompact.inter hHcompact) |
| 152 | hAconnected hBconnected (inter_subset_right.trans hHedgeF) |
| 153 | (inter_subset_right.trans hHedgeF) |
| 154 | obtain ⟨k, hk⟩ := child_parent_edge F b d hF hd i |
| 155 | obtain ⟨l, hl⟩ := child_parent_edge G c e hG he j |
| 156 | apply CoordinateTriangleBoundaryIntersection.of_isPreconnected_inter F G d e |
| 157 | (hd.trans hF) (he.trans hG) hconnected k l |
| 158 | · exact fun x hx => hk ⟨hx.1, hHedgeF ⟨hFd hx.1, hGe hx.2⟩⟩ |
| 159 | · exact fun x hx => hl ⟨hx.2, hHedgeG ⟨hFd hx.1, hGe hx.2⟩⟩ |
| 160 | |
| 161 | end PoincareMT |