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.Loop.RegionChart |
| 2 | |
| 3 | /-! |
| 4 | # The actual occupied side in oriented linear graph coordinates |
| 5 | |
| 6 | The regular loop graph and the Jordan-side theorem select the vertical |
| 7 | orientation. The resulting region germ is above the graph in linear |
| 8 | coordinates, which permits straight outer and side interfaces. |
| 9 | |
| 10 | Morgan--Tian context: Proposition 19.35, printed pp. 467-481. These project |
| 11 | Jordan-region constructions supply the actual domains, boundary charts and finite |
| 12 | faces used in its regional Gauss--Bonnet arguments. |
| 13 | -/ |
| 14 | |
| 15 | noncomputable section |
| 16 | set_option autoImplicit false |
| 17 | |
| 18 | open Set Filter |
| 19 | open scoped Topology ContDiff |
| 20 | |
| 21 | namespace PoincareMT |
| 22 | |
| 23 | /-- The actual Jordan closure occupies the upper side of a smooth graph after a possible |
| 24 | vertical reflection of its linear coordinates. Source: |
| 25 | `proof-work/tasks/M64/reports/2026-09-24-intrinsic-radial-scalar.md`, Fitted linear bands |
| 26 | with actual straight interfaces. -/ |
| 27 | theorem m64Intrinsic_exists_loop_upper_graph |
| 28 | {gamma : ℝ → AnnulusCoordinates} (hg : ContDiff ℝ ∞ gamma) {T p : ℝ} |
| 29 | (hend : gamma 0 = gamma T) (hinj : InjOn gamma (Ico 0 T)) |
| 30 | (hp : p ∈ Ioo (0 : ℝ) T) (hregular : deriv gamma p ≠ 0) |
| 31 | {U V : Set AnnulusCoordinates} (hU : IsOpen U) (hV : IsOpen V) |
| 32 | (hdisj : Disjoint U V) (hfU : frontier U = gamma '' Icc 0 T) |
| 33 | (hfV : frontier V = gamma '' Icc 0 T) : |
| 34 | ∃ (L : AnnulusCoordinates ≃L[ℝ] (ℝ × ℝ)) (h : ℝ → ℝ) (X : Set ℝ) (x : ℝ), |
| 35 | IsOpen X ∧ x ∈ X ∧ ContDiffOn ℝ ∞ h X ∧ L (gamma p) = (x, h x) ∧ |
| 36 | ∀ᶠ z in 𝓝 (x, h x), |
| 37 | (L.symm z ∈ closure U ↔ h z.1 ≤ z.2) ∧ |
| 38 | (L.symm z ∈ frontier U ↔ z.2 = h z.1) := by |
| 39 | obtain ⟨L, h, X, W, hX, hh, hW, hpW, hWgraph⟩ := |
| 40 | m64Intrinsic_exists_regular_loop_graph_neighborhood hg hend hinj hp hregular |
| 41 | obtain ⟨H, hsource, _, hformula, _, _⟩ := m64Intrinsic_graph_straightening_chart L hX hh |
| 42 | let x := (L (gamma p)).1 |
| 43 | have hxX : x ∈ X := (hWgraph (gamma p) hpW).1 |
| 44 | have hpgraph : (L (gamma p)).2 = h x := |
| 45 | (hWgraph (gamma p) hpW).2.mp ⟨p, ⟨hp.1.le, hp.2.le⟩, rfl⟩ |
| 46 | have hcoord : L (gamma p) = (x, h x) := Prod.ext rfl hpgraph |
| 47 | have hbase : L.symm (x, h x) = gamma p := by rw [← hcoord, L.symm_apply_apply] |
| 48 | have hx : (x, 0) ∈ H.source := by rw [hsource]; exact ⟨hxX, mem_univ _⟩ |
| 49 | have hHbase : H (x, 0) = gamma p := by rw [hformula, add_zero, hbase] |
| 50 | have hfront : H (x, 0) ∈ frontier U := by |
| 51 | rw [hHbase, hfU] |
| 52 | exact ⟨p, ⟨hp.1.le, hp.2.le⟩, rfl⟩ |
| 53 | have hpre : ∀ᶠ z in 𝓝 (x, (0 : ℝ)), H z ∈ W := |
| 54 | (H.continuousAt hx).preimage_mem_nhds (by simpa only [hHbase] using hW.mem_nhds hpW) |
| 55 | have hline : ∀ᶠ z in 𝓝 (x, (0 : ℝ)), H z ∈ frontier U ↔ z.2 = 0 := by |
| 56 | filter_upwards [hpre] with z hz |
| 57 | rw [hfU, (hWgraph (H z) hz).2, hformula, L.apply_symm_apply] |
| 58 | simp only [add_eq_left] |
| 59 | have hside := m64Intrinsic_jordan_product_line_germ hU hV hdisj |
| 60 | (hfU.trans hfV.symm) H hx hfront hline |
| 61 | have hhx : ContinuousAt h x := |
| 62 | (hh x hxX).continuousWithinAt.continuousAt (hX.mem_nhds hxX) |
| 63 | have hshift : ContinuousAt (fun z : ℝ × ℝ => (z.1, z.2 - h z.1)) (x, h x) := |
| 64 | continuousAt_fst.prodMk (continuousAt_snd.sub (hhx.comp continuousAt_fst)) |
| 65 | have hgraph : ∀ᶠ z in 𝓝 (x, h x), L.symm z ∈ frontier U ↔ z.2 = h z.1 := by |
| 66 | have hw := L.symm.continuous.continuousAt.preimage_mem_nhds |
| 67 | (show W ∈ 𝓝 (L.symm (x, h x)) by rw [hbase]; exact hW.mem_nhds hpW) |
| 68 | filter_upwards [hw] with z hz |
| 69 | rw [hfU, (hWgraph (L.symm z) hz).2, L.apply_symm_apply] |
| 70 | rcases hside with hside | hside |
| 71 | · have hs := hshift.eventually (by simpa only [sub_self] using hside) |
| 72 | refine ⟨L, h, X, x, hX, hxX, hh, hcoord, ?_⟩ |
| 73 | filter_upwards [hs, hgraph] with z hz hzg |
| 74 | rw [hformula, add_sub_cancel] at hz |
| 75 | exact ⟨hz.trans sub_nonneg, hzg⟩ |
| 76 | · have hs := hshift.eventually (by simpa only [sub_self] using hside) |
| 77 | have hdown : ∀ᶠ z in 𝓝 (x, h x), |
| 78 | (L.symm z ∈ closure U ↔ z.2 ≤ h z.1) ∧ |
| 79 | (L.symm z ∈ frontier U ↔ z.2 = h z.1) := by |
| 80 | filter_upwards [hs, hgraph] with z hz hzg |
| 81 | rw [hformula, add_sub_cancel] at hz |
| 82 | exact ⟨hz.trans sub_nonpos, hzg⟩ |
| 83 | let E : (ℝ × ℝ) ≃L[ℝ] (ℝ × ℝ) := |
| 84 | (ContinuousLinearEquiv.refl ℝ ℝ).prodCongr (ContinuousLinearEquiv.neg ℝ) |
| 85 | let K := L.trans E |
| 86 | have hK (z : ℝ × ℝ) : K.symm z = L.symm (z.1, -z.2) := rfl |
| 87 | have he : E (x, h x) = (x, -h x) := rfl |
| 88 | have he' : E.symm (x, -h x) = (x, h x) := by |
| 89 | change (x, - -h x) = (x, h x) |
| 90 | rw [neg_neg] |
| 91 | refine ⟨K, fun s => -h s, X, x, hX, hxX, hh.neg, ?_, ?_⟩ |
| 92 | · change E (L (gamma p)) = (x, -h x) |
| 93 | rw [hcoord, he] |
| 94 | · have hs' := E.symm.continuous.continuousAt.eventually |
| 95 | (show ∀ᶠ z in 𝓝 (E.symm (x, -h x)), |
| 96 | (L.symm z ∈ closure U ↔ z.2 ≤ h z.1) ∧ |
| 97 | (L.symm z ∈ frontier U ↔ z.2 = h z.1) by rw [he']; exact hdown) |
| 98 | filter_upwards [hs'] with z hz |
| 99 | change (L.symm (z.1, -z.2) ∈ closure U ↔ -z.2 ≤ h z.1) ∧ |
| 100 | (L.symm (z.1, -z.2) ∈ frontier U ↔ -z.2 = h z.1) at hz |
| 101 | rw [hK] |
| 102 | exact ⟨hz.1.trans (by constructor <;> intro h' <;> linarith), |
| 103 | hz.2.trans (by constructor <;> intro h' <;> linarith)⟩ |
| 104 | |
| 105 | end PoincareMT |