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.Exposed.EdgeVertices |
| 2 | |
| 3 | /-! |
| 4 | # Whole-side classification at retained boundary joins |
| 5 | |
| 6 | An unpaired coordinate side cannot pass through any retained vertex in |
| 7 | its open part. If two closed boundary arcs meet only at retained joins, |
| 8 | the connected open side lies wholly in one arc, and closedness restores |
| 9 | its endpoints. This supplies the side classification for Morgan--Tian, |
| 10 | Claim 19.39 and Lemma 19.46, pp. 470 and 474-475. See |
| 11 | `proof-work/tasks/M64/derivations/2026-09-25-boundary-arc-turning.md`. |
| 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 |
| 21 | |
| 22 | namespace PoincareMT |
| 23 | |
| 24 | /-- An actual unpaired coordinate side covered by two closed arc images |
| 25 | lies wholly in one of them when their intersections are retained vertices. |
| 26 | This proves the whole-side classification used in Morgan--Tian, |
| 27 | Claim 19.39 and Lemma 19.46, pp. 470 and 474-475. -/ |
| 28 | theorem m64Intrinsic_unpaired_side_subset_one_of_two_arcs |
| 29 | {I : Type*} (face : I → SmoothFace AnnulusCoordinates) |
| 30 | (F : I → OpenPartialHomeomorph AnnulusCoordinates AnnulusCoordinates) |
| 31 | (b : I → AffineBasis (Fin 3) ℝ AnnulusCoordinates) |
| 32 | (hsource : ∀ i, convexHull ℝ (range (b i)) ⊆ (F i).source) |
| 33 | (hcarrier : ∀ i, (face i).carrier = F i '' convexHull ℝ (range (b i))) |
| 34 | (hboundary : ∀ i k, ((face i).boundary k).map = F i ∘ |
| 35 | affineChartSegment (b i (k.succAbove 0)) (b i (k.succAbove 1))) |
| 36 | (hinter : ∀ i j, i ≠ j → |
| 37 | (∃ k l : Fin 3, (face i).carrier ∩ (face j).carrier = |
| 38 | ((face i).boundary k).map '' Icc (0 : ℝ) 1 ∧ |
| 39 | ((face i).boundary k).map '' Icc (0 : ℝ) 1 = |
| 40 | ((face j).boundary l).map '' Icc (0 : ℝ) 1) ∨ |
| 41 | ∃ v : Fin 3, (face i).carrier ∩ (face j).carrier ⊆ {F i (b i v)}) |
| 42 | (p : I × Fin 3) |
| 43 | (hunpaired : ∀ q : I × Fin 3, |
| 44 | faceBoundaryIndex face q.1 q.2 = faceBoundaryIndex face p.1 p.2 → q = p) |
| 45 | {A B : Set AnnulusCoordinates} (hA : IsClosed A) (hB : IsClosed B) |
| 46 | (himage : ((face p.1).boundary p.2).map '' Icc (0 : ℝ) 1 ⊆ A ∪ B) |
| 47 | (v0 v1 : Euler.CoordinateVertex F b) (hAB : A ∩ B ⊆ {v0.1, v1.1}) : |
| 48 | ((face p.1).boundary p.2).map '' Icc (0 : ℝ) 1 ⊆ A ∨ |
| 49 | ((face p.1).boundary p.2).map '' Icc (0 : ℝ) 1 ⊆ B := by |
| 50 | let eta := ((face p.1).boundary p.2).map |
| 51 | let e := faceBoundaryIndex face p.1 p.2 |
| 52 | have hout : e.out = p := hunpaired e.out (Quotient.out_eq e) |
| 53 | have hcanonical : faceBoundaryEdge face e = (face p.1).boundary p.2 := by |
| 54 | change (face e.out.1).boundary e.out.2 = _ |
| 55 | rw [hout] |
| 56 | have he : Nat.card {q : I × Fin 3 // faceBoundaryIndex face q.1 q.2 = e} = 1 := by |
| 57 | apply Nat.card_eq_one_iff_unique.mpr |
| 58 | refine ⟨⟨?_⟩, ⟨⟨p, rfl⟩⟩⟩ |
| 59 | intro q r |
| 60 | exact Subtype.ext ((hunpaired q.1 q.2).trans (hunpaired r.1 r.2).symm) |
| 61 | have hinj : InjOn eta (Icc (0 : ℝ) 1) := |
| 62 | m64Intrinsic_coordinate_boundary_injective face F b hsource hboundary p.1 p.2 |
| 63 | have hvertex (v : Euler.CoordinateVertex F b) {t : ℝ} |
| 64 | (ht : t ∈ Ioo (0 : ℝ) 1) : eta t ≠ v.1 := by |
| 65 | intro htv |
| 66 | have hmem : v.1 ∈ (faceBoundaryEdge face e).map '' Icc (0 : ℝ) 1 := by |
| 67 | rw [hcanonical] |
| 68 | exact ⟨t, Ioo_subset_Icc_self ht, htv⟩ |
| 69 | have hv := (m64Intrinsic_vertex_on_one_face_edge_iff_endpoint face F b hsource hcarrier |
| 70 | hboundary hinter e he v).mp hmem |
| 71 | rw [hcanonical] at hv |
| 72 | rcases hv with hv | hv |
| 73 | · exact ht.1.ne' (hinj (Ioo_subset_Icc_self ht) (by simp) (htv.trans hv)) |
| 74 | · exact ht.2.ne (hinj (Ioo_subset_Icc_self ht) (by simp) (htv.trans hv)) |
| 75 | have havoid (t : ℝ) (ht : t ∈ Ioo (0 : ℝ) 1) : eta t ∉ A ∩ B := by |
| 76 | intro h |
| 77 | rcases mem_insert_iff.mp (hAB h) with h0 | h1 |
| 78 | · exact hvertex v0 ht h0 |
| 79 | · exact hvertex v1 ht (mem_singleton_iff.mp h1) |
| 80 | have hcont : ContinuousOn eta (Icc (0 : ℝ) 1) := |
| 81 | ((face p.1).boundary p.2).smooth.continuousOn |
| 82 | have hconnected : IsPreconnected (eta '' Ioo (0 : ℝ) 1) := |
| 83 | isPreconnected_Ioo.image eta (hcont.mono Ioo_subset_Icc_self) |
| 84 | have hcover : eta '' Ioo (0 : ℝ) 1 ⊆ A ∪ B := |
| 85 | (image_mono Ioo_subset_Icc_self).trans himage |
| 86 | have hside : eta '' Ioo (0 : ℝ) 1 ⊆ A ∨ eta '' Ioo (0 : ℝ) 1 ⊆ B := by |
| 87 | by_cases hmeet : (eta '' Ioo (0 : ℝ) 1 ∩ A).Nonempty |
| 88 | · left |
| 89 | intro z hz |
| 90 | by_contra hzA |
| 91 | have hzB := (hcover hz).resolve_left hzA |
| 92 | obtain ⟨w, ⟨t, ht, rfl⟩, hwA, hwB⟩ := |
| 93 | isPreconnected_closed_iff.mp hconnected A B hA hB hcover hmeet ⟨z, hz, hzB⟩ |
| 94 | exact havoid t ht ⟨hwA, hwB⟩ |
| 95 | · right |
| 96 | intro z hz |
| 97 | exact (hcover hz).resolve_left (fun hzA => hmeet ⟨z, hz, hzA⟩) |
| 98 | have hfull {C : Set AnnulusCoordinates} (hC : IsClosed C) |
| 99 | (hsub : eta '' Ioo (0 : ℝ) 1 ⊆ C) : eta '' Icc (0 : ℝ) 1 ⊆ C := by |
| 100 | rintro z ⟨t, ht, rfl⟩ |
| 101 | have htclosure : t ∈ closure (Ioo (0 : ℝ) 1) := by |
| 102 | rw [closure_Ioo zero_ne_one] |
| 103 | exact ht |
| 104 | have h := ((hcont t ht).mono Ioo_subset_Icc_self).mem_closure htclosure |
| 105 | (fun s hs => hsub ⟨s, hs, rfl⟩) |
| 106 | simpa only [hC.closure_eq] using h |
| 107 | exact hside.elim (fun h => Or.inl (hfull hA h)) (fun h => Or.inr (hfull hB h)) |
| 108 | |
| 109 | end PoincareMT |