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.Transverse.ArcCuts |
| 2 | import PoincareLib.Topology.Plane.Curves.Graphs.EndpointBarriers |
| 3 | |
| 4 | /-! |
| 5 | # Physical endpoint barriers give an actual graph-strip width |
| 6 | |
| 7 | The original regular curve and increasing graph parameter determine the |
| 8 | separator signs in graph coordinates. The retained inverse cuts then admit |
| 9 | one common width avoiding the closed obstacle along the open strip. |
| 10 | |
| 11 | Morgan--Tian context: Proposition 19.35, printed pp. 467-481, including Claim 19.40, |
| 12 | pp. 470-471. These project constructions provide actual fitted boundary pieces and |
| 13 | contacts for the regional Gauss--Bonnet arguments. |
| 14 | -/ |
| 15 | |
| 16 | noncomputable section |
| 17 | set_option autoImplicit false |
| 18 | set_option backward.isDefEq.respectTransparency false |
| 19 | |
| 20 | open Set |
| 21 | open scoped Topology ContDiff |
| 22 | open Poincare.Topology.Plane.Curves |
| 23 | |
| 24 | namespace PoincareMT |
| 25 | |
| 26 | /-- A regular original curve forces its increasing smooth graph parameter to have strictly |
| 27 | positive derivative. Source: |
| 28 | `proof-work/tasks/M64/reports/2026-09-24-obstacle-strip-chain.md`. -/ |
| 29 | theorem m64Intrinsic_graph_parameter_deriv_pos |
| 30 | {gamma : ℝ → AnnulusCoordinates} (hg : ContDiff ℝ ∞ gamma) |
| 31 | (L : AnnulusCoordinates ≃L[ℝ] (ℝ × ℝ)) (G : OpenPartialHomeomorph ℝ ℝ) |
| 32 | {f : ℝ → ℝ} (hG : ContDiffOn ℝ ∞ G G.source) |
| 33 | (hf : ContDiffOn ℝ ∞ f G.target) (hmono : StrictMonoOn G G.source) |
| 34 | (hgraph : ∀ t ∈ G.source, L (gamma t) = (G t, f (G t))) |
| 35 | {t : ℝ} (ht : t ∈ G.source) (hregular : deriv gamma t ≠ 0) : 0 < deriv G t := by |
| 36 | have htan := m64Intrinsic_graph_tangent hg L G hG hf hgraph ht |
| 37 | have hnonneg : 0 ≤ deriv G t := by |
| 38 | rw [← derivWithin_of_isOpen G.open_source ht] |
| 39 | exact hmono.monotoneOn.derivWithin_nonneg |
| 40 | have hne : deriv G t ≠ 0 := by |
| 41 | intro hz |
| 42 | apply hregular |
| 43 | apply L.injective |
| 44 | rw [htan, hz, zero_smul, map_zero] |
| 45 | exact lt_of_le_of_ne hnonneg hne.symm |
| 46 | |
| 47 | /-- Transfer a physical separator sign to the normalized graph tangent using the proved |
| 48 | positive parameter derivative. Source: |
| 49 | `proof-work/tasks/M64/reports/2026-09-24-obstacle-strip-chain.md`. -/ |
| 50 | theorem m64Intrinsic_graph_separator_sign |
| 51 | {gamma : ℝ → AnnulusCoordinates} (hg : ContDiff ℝ ∞ gamma) |
| 52 | (L : AnnulusCoordinates ≃L[ℝ] (ℝ × ℝ)) (G : OpenPartialHomeomorph ℝ ℝ) |
| 53 | {f : ℝ → ℝ} (hG : ContDiffOn ℝ ∞ G G.source) |
| 54 | (hf : ContDiffOn ℝ ∞ f G.target) (hmono : StrictMonoOn G G.source) |
| 55 | (hgraph : ∀ t ∈ G.source, L (gamma t) = (G t, f (G t))) |
| 56 | {t : ℝ} (ht : t ∈ G.source) (hregular : deriv gamma t ≠ 0) |
| 57 | (ell : AnnulusCoordinates →L[ℝ] ℝ) (terminal : Bool) |
| 58 | (hsign : if terminal then ell (deriv gamma t) < 0 else 0 < ell (deriv gamma t)) : |
| 59 | if terminal then (ell.comp L.symm.toContinuousLinearMap) (1, deriv f (G t)) < 0 |
| 60 | else 0 < (ell.comp L.symm.toContinuousLinearMap) (1, deriv f (G t)) := by |
| 61 | have hd := m64Intrinsic_graph_parameter_deriv_pos hg L G hG hf hmono hgraph ht hregular |
| 62 | have htan := m64Intrinsic_graph_tangent hg L G hG hf hgraph ht |
| 63 | have heq : ell (deriv gamma t) = |
| 64 | deriv G t * (ell.comp L.symm.toContinuousLinearMap) (1, deriv f (G t)) := by |
| 65 | simpa only [L.symm_apply_apply, map_smul, smul_eq_mul, ContinuousLinearMap.comp_apply, |
| 66 | ContinuousLinearEquiv.coe_coe] using congrArg (fun v => ell (L.symm v)) htan |
| 67 | rw [heq] at hsign |
| 68 | cases terminal |
| 69 | · exact (mul_pos_iff_of_pos_left hd).mp hsign |
| 70 | · exact neg_of_mul_neg_right hsign hd.le |
| 71 | |
| 72 | /-- Actual physical barriers at the two original endpoints and avoidance by the open arc |
| 73 | construct a positive obstacle-avoiding graph-strip width. Source: |
| 74 | `proof-work/tasks/M64/reports/2026-09-24-obstacle-strip-chain.md`. -/ |
| 75 | theorem m64Intrinsic_exists_obstacle_avoiding_graph_strip |
| 76 | {gamma : ℝ → AnnulusCoordinates} (hg : ContDiff ℝ ∞ gamma) |
| 77 | {a b : ℝ} (hab : a < b) (hregular : ∀ t ∈ Icc a b, deriv gamma t ≠ 0) |
| 78 | (L : AnnulusCoordinates ≃L[ℝ] (ℝ × ℝ)) (G : OpenPartialHomeomorph ℝ ℝ) |
| 79 | {f : ℝ → ℝ} (hG : ContDiffOn ℝ ∞ G G.source) |
| 80 | (hf : ContDiffOn ℝ ∞ f G.target) (hmono : StrictMonoOn G G.source) |
| 81 | (hI : Icc a b ⊆ G.source) |
| 82 | (hgraph : ∀ t ∈ G.source, L (gamma t) = (G t, f (G t))) |
| 83 | (himage : G '' Icc a b = Icc (G a) (G b)) |
| 84 | {C : Set AnnulusCoordinates} (hC : IsClosed C) |
| 85 | (havoid : ∀ t ∈ Ioo a b, gamma t ∉ C) |
| 86 | (da db : AnnulusCoordinates) |
| 87 | (P : TransverseGraphCuts f (G a) (G b) (L da).1 (L da).2 (L db).1 (L db).2) |
| 88 | (ellA ellB : AnnulusCoordinates →L[ℝ] ℝ) |
| 89 | (hcutA : ellA da = 0) (hcutB : ellB db = 0) |
| 90 | (htangentA : 0 < ellA (deriv gamma a)) (htangentB : ellB (deriv gamma b) < 0) |
| 91 | {WA WB : Set AnnulusCoordinates} (hWA : IsOpen WA) (hWB : IsOpen WB) |
| 92 | (haW : gamma a ∈ WA) (hbW : gamma b ∈ WB) |
| 93 | (hsepA : ∀ z ∈ C ∩ WA, ellA (z - gamma a) ≤ 0) |
| 94 | (hsepB : ∀ z ∈ C ∩ WB, ellB (z - gamma b) ≤ 0) : |
| 95 | ∃ delta > 0, delta ≤ P.radius ∧ |
| 96 | (∀ t ∈ Icc (0 : ℝ) 1, ∀ z : ℝ, |z| < delta → |
| 97 | (t, z) ∈ (P.linearCoordinates L.symm G.open_target hf).source) ∧ |
| 98 | ∀ t ∈ Ioo (0 : ℝ) 1, ∀ z : ℝ, |z| < delta → |
| 99 | P.linearCoordinates L.symm G.open_target hf (t, z) ∉ C := by |
| 100 | have ha := hI (left_mem_Icc.mpr hab.le) |
| 101 | have hb := hI (right_mem_Icc.mpr hab.le) |
| 102 | have hGI : Icc (G a) (G b) ⊆ G.target := by |
| 103 | rw [← himage] |
| 104 | rintro _ ⟨t, ht, rfl⟩ |
| 105 | exact G.map_source (hI ht) |
| 106 | have havoid' : ∀ x ∈ Ioo (G a) (G b), (x, f x) ∉ L '' C := by |
| 107 | intro x hx hmem |
| 108 | obtain ⟨t, ht, rfl⟩ := himage.symm ▸ Ioo_subset_Icc_self hx |
| 109 | have hat : a < t := by |
| 110 | by_contra hn |
| 111 | have heq : t = a := le_antisymm (le_of_not_gt hn) ht.1 |
| 112 | exact (ne_of_lt hx.1) (congrArg G heq.symm) |
| 113 | have htb : t < b := by |
| 114 | by_contra hn |
| 115 | have heq : t = b := le_antisymm ht.2 (le_of_not_gt hn) |
| 116 | exact (ne_of_lt hx.2) (congrArg G heq) |
| 117 | obtain ⟨u, hu, heq⟩ := hmem |
| 118 | have htu : gamma t = u := L.injective ((hgraph t (hI ht)).trans heq.symm) |
| 119 | exact havoid t ⟨hat, htb⟩ (htu.symm ▸ hu) |
| 120 | let mA := ellA.comp L.symm.toContinuousLinearMap |
| 121 | let mB := ellB.comp L.symm.toContinuousLinearMap |
| 122 | have hka : mA ((L da).1, (L da).2) = 0 := by |
| 123 | simpa only [mA, ContinuousLinearMap.comp_apply, ContinuousLinearEquiv.coe_coe, |
| 124 | Prod.eta, L.symm_apply_apply] using hcutA |
| 125 | have hkb : mB ((L db).1, (L db).2) = 0 := by |
| 126 | simpa only [mB, ContinuousLinearMap.comp_apply, ContinuousLinearEquiv.coe_coe, |
| 127 | Prod.eta, L.symm_apply_apply] using hcutB |
| 128 | have hta : 0 < mA (1, deriv f (G a)) := m64Intrinsic_graph_separator_sign |
| 129 | hg L G hG hf hmono hgraph ha (hregular a (left_mem_Icc.mpr hab.le)) ellA false htangentA |
| 130 | have htb : mB (1, deriv f (G b)) < 0 := m64Intrinsic_graph_separator_sign |
| 131 | hg L G hG hf hmono hgraph hb (hregular b (right_mem_Icc.mpr hab.le)) ellB true htangentB |
| 132 | have hsa : ∀ q ∈ (L '' C) ∩ (L '' WA), mA (q - (G a, f (G a))) ≤ 0 := by |
| 133 | rintro q ⟨⟨u, hu, rfl⟩, v, hv, hvu⟩ |
| 134 | have huW : u ∈ WA := L.injective hvu ▸ hv |
| 135 | change ellA (L.symm (L u - (G a, f (G a)))) ≤ 0 |
| 136 | rw [← hgraph a ha, ← map_sub, L.symm_apply_apply] |
| 137 | exact hsepA u ⟨hu, huW⟩ |
| 138 | have hsb : ∀ q ∈ (L '' C) ∩ (L '' WB), mB (q - (G b, f (G b))) ≤ 0 := by |
| 139 | rintro q ⟨⟨u, hu, rfl⟩, v, hv, hvu⟩ |
| 140 | have huW : u ∈ WB := L.injective hvu ▸ hv |
| 141 | change ellB (L.symm (L u - (G b, f (G b)))) ≤ 0 |
| 142 | rw [← hgraph b hb, ← map_sub, L.symm_apply_apply] |
| 143 | exact hsepB u ⟨hu, huW⟩ |
| 144 | obtain ⟨delta, hdelta, hdeltaP, hsource, hseparate, _⟩ := P.exists_avoiding_strip |
| 145 | G.open_target hf (hmono ha hb hab) hGI (L.toHomeomorph.isClosedMap C hC) havoid' |
| 146 | mA mB hka hkb hta htb |
| 147 | (L.toHomeomorph.isOpenMap WA hWA) (L.toHomeomorph.isOpenMap WB hWB) |
| 148 | ⟨gamma a, haW, hgraph a ha⟩ ⟨gamma b, hbW, hgraph b hb⟩ hsa hsb |
| 149 | refine ⟨delta, hdelta, hdeltaP, fun t ht z hz => ⟨hsource t ht z hz, mem_univ _⟩, ?_⟩ |
| 150 | intro t ht z hz hmem |
| 151 | apply hseparate t ht z hz |
| 152 | refine ⟨P.linearCoordinates L.symm G.open_target hf (t, z), hmem, ?_⟩ |
| 153 | rw [P.linearCoordinates_apply] |
| 154 | exact L.apply_symm_apply _ |
| 155 | |
| 156 | end PoincareMT |