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.Cross.RayRegion |
| 2 | import Mathlib.Combinatorics.SimpleGraph.Paths |
| 3 | |
| 4 | /-! |
| 5 | # Embedded realization of graph paths in the annulus plane |
| 6 | |
| 7 | Nontrivial simple paths in a graph of embedded coordinate arcs have embedded |
| 8 | unit-interval realizations with exactly the union of their chosen edge |
| 9 | images. This is a step in the disk Euler repair for Morgan--Tian, |
| 10 | Proposition 19.35, pp. 467--481; see the derivation |
| 11 | `proof-work/tasks/M64/derivations/2026-09-25-euler-path-realization.md`. |
| 12 | -/ |
| 13 | |
| 14 | noncomputable section |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open Set Function |
| 18 | open scoped Topology |
| 19 | |
| 20 | namespace PoincareMT |
| 21 | |
| 22 | /-- An embedded coordinate arc with the prescribed unordered endpoints can be oriented from |
| 23 | the first endpoint to the second without changing its image. This selects actual mesh-edge |
| 24 | witnesses for the path-realization step of the MT2007 Proposition 19.35 disk Euler repair. |
| 25 | Source: Morgan--Tian Proposition 19.35, printed pp. 467-481, including the Gauss--Bonnet |
| 26 | argument in Lemma 19.45, p. 474; the explicit regional construction is reviewed in |
| 27 | `proof-work/tasks/M64/reviews/2026-09-27-round1-intrinsic-euler-turning.md`, Mathematical |
| 28 | Checks. -/ |
| 29 | theorem m64Intrinsic_exists_oriented_embedded_arc |
| 30 | {alpha : ℝ → AnnulusCoordinates} {a b : AnnulusCoordinates} |
| 31 | (hcont : ContinuousOn alpha (Icc 0 1)) (hinj : InjOn alpha (Icc 0 1)) |
| 32 | (hends : (alpha 0 = a ∧ alpha 1 = b) ∨ (alpha 0 = b ∧ alpha 1 = a)) : |
| 33 | ∃ beta : ℝ → AnnulusCoordinates, |
| 34 | ContinuousOn beta (Icc 0 1) ∧ InjOn beta (Icc 0 1) ∧ |
| 35 | beta 0 = a ∧ beta 1 = b ∧ beta '' Icc 0 1 = alpha '' Icc 0 1 := by |
| 36 | rcases hends with hab | hba |
| 37 | · exact ⟨alpha, hcont, hinj, hab.1, hab.2, rfl⟩ |
| 38 | · let beta : ℝ → AnnulusCoordinates := fun t => alpha (1 - t) |
| 39 | have hparam (t : ℝ) (ht : t ∈ Icc 0 1) : 1 - t ∈ Icc 0 1 := |
| 40 | ⟨by linarith [ht.2], by linarith [ht.1]⟩ |
| 41 | have hbc : ContinuousOn beta (Icc 0 1) := |
| 42 | hcont.comp (continuous_const.sub continuous_id).continuousOn hparam |
| 43 | have hbi : InjOn beta (Icc 0 1) := by |
| 44 | intro s hs t ht hst |
| 45 | have heq := hinj (hparam s hs) (hparam t ht) hst |
| 46 | linarith |
| 47 | refine ⟨beta, hbc, hbi, ?_, ?_, ?_⟩ |
| 48 | · simpa only [beta, sub_zero] using hba.2 |
| 49 | · simpa only [beta, sub_self] using hba.1 |
| 50 | · change (alpha ∘ fun t => 1 - t) '' Icc (0 : ℝ) 1 = _ |
| 51 | rw [image_comp, image_const_sub_Icc] |
| 52 | norm_num |
| 53 | |
| 54 | private theorem m64_dart_image_union_cons {V : Type*} {G : SimpleGraph V} |
| 55 | (arc : G.Dart → ℝ → AnnulusCoordinates) {u v w : V} (h : G.Adj u v) |
| 56 | (p : G.Walk v w) : |
| 57 | (⋃ d ∈ (SimpleGraph.Walk.cons h p).darts, arc d '' Icc 0 1) = |
| 58 | arc ⟨(u, v), h⟩ '' Icc 0 1 ∪ ⋃ d ∈ p.darts, arc d '' Icc 0 1 := by |
| 59 | ext z |
| 60 | simp |
| 61 | |
| 62 | /-- A nontrivial simple path of embedded coordinate arcs is an embedded unit-interval arc |
| 63 | with the exact chosen dart-image union. Distinct graph edges may meet only at shared |
| 64 | endpoint points. This is the path-realization step of the disk Euler repair for MT2007, |
| 65 | Proposition 19.35, pp. 467--481; see `2026-09-25-euler-path-realization.md`. Source: |
| 66 | Morgan--Tian Proposition 19.35, printed pp. 467-481, including the Gauss--Bonnet argument in |
| 67 | Lemma 19.45, p. 474; the explicit regional construction is reviewed in |
| 68 | `proof-work/tasks/M64/reviews/2026-09-27-round1-intrinsic-euler-turning.md`, Mathematical |
| 69 | Checks. -/ |
| 70 | theorem m64Intrinsic_exists_embedded_graph_path |
| 71 | {V : Type*} {G : SimpleGraph V} |
| 72 | (point : V → AnnulusCoordinates) (hpoint : Injective point) |
| 73 | (arc : G.Dart → ℝ → AnnulusCoordinates) |
| 74 | (hcont : ∀ d, ContinuousOn (arc d) (Icc 0 1)) |
| 75 | (hinj : ∀ d, InjOn (arc d) (Icc 0 1)) |
| 76 | (hstart : ∀ d, arc d 0 = point d.fst) |
| 77 | (hend : ∀ d, arc d 1 = point d.snd) |
| 78 | (hmeet : ∀ d e, d.edge ≠ e.edge → |
| 79 | (arc d '' Icc 0 1 ∩ arc e '' Icc 0 1) ⊆ |
| 80 | {point d.fst, point d.snd} ∩ {point e.fst, point e.snd}) |
| 81 | {u v : V} (p : G.Walk u v) (hp : p.IsPath) (hne : ¬ p.Nil) : |
| 82 | ∃ gamma : ℝ → AnnulusCoordinates, |
| 83 | ContinuousOn gamma (Icc 0 1) ∧ InjOn gamma (Icc 0 1) ∧ |
| 84 | gamma 0 = point u ∧ gamma 1 = point v ∧ |
| 85 | gamma '' Icc 0 1 = ⋃ d ∈ p.darts, arc d '' Icc 0 1 := by |
| 86 | induction p with |
| 87 | | nil => exact (hne .nil).elim |
| 88 | | @cons u v w h p ih => |
| 89 | have hpath : p.IsPath := hp.of_cons |
| 90 | have hu : u ∉ p.support := (SimpleGraph.Walk.cons_isPath_iff h p |>.mp hp).2 |
| 91 | let d : G.Dart := ⟨(u, v), h⟩ |
| 92 | by_cases hnil : p.Nil |
| 93 | · cases p with |
| 94 | | nil => |
| 95 | refine ⟨arc d, hcont d, hinj d, hstart d, hend d, ?_⟩ |
| 96 | simp [d] |
| 97 | | cons h' p' => exact (SimpleGraph.Walk.not_nil_cons hnil).elim |
| 98 | · obtain ⟨beta, hbc, hbi, hb0, hb1, hbimage⟩ := ih hpath hnil |
| 99 | have hjoin : arc d 1 = beta 0 := (hend d).trans hb0.symm |
| 100 | have hjoinmeet : ∀ s ∈ Icc 0 1, ∀ t ∈ Icc 0 1, |
| 101 | arc d s = beta t → s = 1 ∧ t = 0 := by |
| 102 | intro s hs t ht hst |
| 103 | have htimage : beta t ∈ ⋃ e ∈ p.darts, arc e '' Icc 0 1 := |
| 104 | hbimage ▸ mem_image_of_mem beta ht |
| 105 | obtain ⟨e, heimage⟩ := mem_iUnion.mp htimage |
| 106 | obtain ⟨he, r, hr, her⟩ := mem_iUnion.mp heimage |
| 107 | have hef : e.fst ∈ p.support := p.dart_fst_mem_support_of_mem_darts he |
| 108 | have hes : e.snd ∈ p.support := p.dart_snd_mem_support_of_mem_darts he |
| 109 | have hde : d.edge ≠ e.edge := by |
| 110 | intro heq |
| 111 | have heq' : e.edge = s(u, v) := heq.symm |
| 112 | rcases SimpleGraph.dart_edge_eq_mk'_iff'.mp heq' with hh | hh |
| 113 | · exact hu (hh.1 ▸ hef) |
| 114 | · exact hu (hh.2 ▸ hes) |
| 115 | have hends := hmeet d e hde |
| 116 | ⟨mem_image_of_mem (arc d) hs, ⟨r, hr, her.trans hst.symm⟩⟩ |
| 117 | simp only [mem_inter_iff, mem_insert_iff, mem_singleton_iff] at hends |
| 118 | have hsv : arc d s = point v := by |
| 119 | rcases hends.1 with hsu | hsv |
| 120 | · have hpu : arc d s = point u := hsu |
| 121 | rcases hends.2 with hsef | hses |
| 122 | · exact (hu ((hpoint (hpu.symm.trans hsef)).symm ▸ hef)).elim |
| 123 | · exact (hu ((hpoint (hpu.symm.trans hses)).symm ▸ hes)).elim |
| 124 | · exact hsv |
| 125 | exact ⟨hinj d hs (by norm_num) (hsv.trans (hend d).symm), |
| 126 | hbi ht (by norm_num) (hst.symm.trans (hsv.trans hb0.symm))⟩ |
| 127 | obtain ⟨gamma, hgc, hgi, hg0, hg1, hgimage⟩ := |
| 128 | m64Intrinsic_exists_embedded_join (hcont d) hbc (hinj d) hbi hjoin hjoinmeet |
| 129 | refine ⟨gamma, hgc, hgi, hg0.trans (hstart d), hg1.trans hb1, ?_⟩ |
| 130 | rw [hgimage, hbimage, m64_dart_image_union_cons] |
| 131 | |
| 132 | /-- Closing an embedded graph path by another embedded arc meeting its chosen edges only at |
| 133 | the two endpoints constructs the exact Jordan region. This realizes the distinguished-edge |
| 134 | circuit in the disk Euler repair for MT2007, Proposition 19.35, pp. 467--481; see the |
| 135 | path-realization derivation. Source: Morgan--Tian Proposition 19.35, printed pp. 467-481, |
| 136 | including the Gauss--Bonnet argument in Lemma 19.45, p. 474; the explicit regional |
| 137 | construction is reviewed in |
| 138 | `proof-work/tasks/M64/reviews/2026-09-27-round1-intrinsic-euler-turning.md`, Mathematical |
| 139 | Checks. -/ |
| 140 | theorem m64Intrinsic_exists_region_between_graph_path_and_arc |
| 141 | {V : Type*} {G : SimpleGraph V} |
| 142 | (point : V → AnnulusCoordinates) (hpoint : Injective point) |
| 143 | (arc : G.Dart → ℝ → AnnulusCoordinates) |
| 144 | (hcont : ∀ d, ContinuousOn (arc d) (Icc 0 1)) |
| 145 | (hinj : ∀ d, InjOn (arc d) (Icc 0 1)) |
| 146 | (hstart : ∀ d, arc d 0 = point d.fst) |
| 147 | (hend : ∀ d, arc d 1 = point d.snd) |
| 148 | (hmeet : ∀ d e, d.edge ≠ e.edge → |
| 149 | (arc d '' Icc 0 1 ∩ arc e '' Icc 0 1) ⊆ |
| 150 | {point d.fst, point d.snd} ∩ {point e.fst, point e.snd}) |
| 151 | {u v : V} (p : G.Walk u v) (hp : p.IsPath) (hne : ¬ p.Nil) |
| 152 | {base : ℝ → AnnulusCoordinates} |
| 153 | (hbase : ContinuousOn base (Icc 0 1)) (hbaseinj : InjOn base (Icc 0 1)) |
| 154 | (hbase0 : base 0 = point u) (hbase1 : base 1 = point v) |
| 155 | (hbasemeet : ∀ d ∈ p.darts, |
| 156 | base '' Icc 0 1 ∩ arc d '' Icc 0 1 ⊆ {point u, point v}) : |
| 157 | ∃ U W : Set AnnulusCoordinates, |
| 158 | IsOpen U ∧ IsOpen W ∧ IsPathConnected U ∧ IsPathConnected W ∧ |
| 159 | Bornology.IsBounded U ∧ ¬ Bornology.IsBounded W ∧ Disjoint U W ∧ |
| 160 | U ∪ W = (base '' Icc 0 1 ∪ (⋃ d ∈ p.darts, arc d '' Icc 0 1))ᶜ ∧ |
| 161 | frontier U = base '' Icc 0 1 ∪ (⋃ d ∈ p.darts, arc d '' Icc 0 1) ∧ |
| 162 | frontier W = base '' Icc 0 1 ∪ (⋃ d ∈ p.darts, arc d '' Icc 0 1) ∧ |
| 163 | IsCompact (closure U) := by |
| 164 | obtain ⟨gamma, hgc, hgi, hg0, hg1, hgimage⟩ := |
| 165 | m64Intrinsic_exists_embedded_graph_path point hpoint arc hcont hinj hstart hend |
| 166 | hmeet p hp hne |
| 167 | have hbasegamma : ∀ s ∈ Icc 0 1, ∀ t ∈ Icc 0 1, |
| 168 | base s = gamma t → (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1) := by |
| 169 | intro s hs t ht hst |
| 170 | have htimage : gamma t ∈ ⋃ d ∈ p.darts, arc d '' Icc 0 1 := |
| 171 | hgimage ▸ mem_image_of_mem gamma ht |
| 172 | obtain ⟨d, hdimage⟩ := mem_iUnion.mp htimage |
| 173 | obtain ⟨hd, r, hr, hdr⟩ := mem_iUnion.mp hdimage |
| 174 | have hends := hbasemeet d hd |
| 175 | ⟨mem_image_of_mem base hs, ⟨r, hr, hdr.trans hst.symm⟩⟩ |
| 176 | simp only [mem_insert_iff, mem_singleton_iff] at hends |
| 177 | rcases hends with hzero | hone |
| 178 | · exact Or.inl |
| 179 | ⟨hbaseinj hs (by norm_num) (hzero.trans hbase0.symm), |
| 180 | hgi ht (by norm_num) (hst.symm.trans (hzero.trans hg0.symm))⟩ |
| 181 | · exact Or.inr |
| 182 | ⟨hbaseinj hs (by norm_num) (hone.trans hbase1.symm), |
| 183 | hgi ht (by norm_num) (hst.symm.trans (hone.trans hg1.symm))⟩ |
| 184 | simpa only [hgimage] using m64Intrinsic_exists_region_between_arcs hbase hgc |
| 185 | hbaseinj hgi (hbase0.trans hg0.symm) (hbase1.trans hg1.symm) hbasegamma |
| 186 | |
| 187 | end PoincareMT |