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.Arc.GraphNeighborhood |
| 2 | import PoincareLib.Geometry.CurveShortening.Comparison.IntrinsicComparison.Loop.RegionChart |
| 3 | |
| 4 | /-! |
| 5 | # A regular defining function on a piecewise smooth regional boundary |
| 6 | |
| 7 | The actual embedded arc and compact remaining frontier construct an exact |
| 8 | graph neighborhood. The Jordan pair chooses its side. The resulting |
| 9 | defining function has a nonzero derivative in the physical vertical |
| 10 | direction, without requiring smoothness at the other boundary joins. |
| 11 | |
| 12 | Morgan--Tian context: Proposition 19.35, printed pp. 467-481. These project |
| 13 | Jordan-region constructions supply the actual domains, boundary charts and finite |
| 14 | faces used in its regional Gauss--Bonnet arguments. |
| 15 | -/ |
| 16 | |
| 17 | noncomputable section |
| 18 | set_option autoImplicit false |
| 19 | set_option backward.isDefEq.respectTransparency false |
| 20 | |
| 21 | open Set Filter |
| 22 | open scoped Topology ContDiff |
| 23 | |
| 24 | namespace PoincareMT |
| 25 | |
| 26 | /-- Construct a regular defining function at an interior point of an actual embedded |
| 27 | boundary arc of a Jordan region. Source: |
| 28 | `proof-work/tasks/M64/derivations/2026-09-27-minimal-contact-regularity.md`, Section 3. -/ |
| 29 | theorem m64Intrinsic_exists_arc_defining_function |
| 30 | {gamma : ℝ → AnnulusCoordinates} (hg : ContDiff ℝ ∞ gamma) {a b p : ℝ} |
| 31 | (hinj : InjOn gamma (Icc a b)) (hp : p ∈ Ioo a b) (hregular : deriv gamma p ≠ 0) |
| 32 | {K U V : Set AnnulusCoordinates} (hK : IsCompact K) (hpK : gamma p ∉ K) |
| 33 | (hU : IsOpen U) (hV : IsOpen V) (hdisj : Disjoint U V) |
| 34 | (hfU : frontier U = gamma '' Icc a b ∪ K) (hfV : frontier V = frontier U) : |
| 35 | ∃ (phi : AnnulusCoordinates → ℝ) (ell : AnnulusCoordinates →L[ℝ] ℝ), |
| 36 | HasFDerivAt phi ell (gamma p) ∧ phi (gamma p) = 0 ∧ ell ≠ 0 ∧ |
| 37 | (∀ᶠ z in 𝓝 (gamma p), z ∈ closure U ↔ 0 ≤ phi z) := by |
| 38 | obtain ⟨L, h, X, W, hX, hh, hW, hpW, hWgraph⟩ := |
| 39 | m64Intrinsic_exists_arc_graph_neighborhood hg hinj hp hregular hK hpK |
| 40 | obtain ⟨H, hsource, _, hformula, _, _⟩ := m64Intrinsic_graph_straightening_chart L hX hh |
| 41 | let x := (L (gamma p)).1 |
| 42 | have hxX : x ∈ X := (hWgraph (gamma p) hpW).1 |
| 43 | have hpgraph : (L (gamma p)).2 = h x := |
| 44 | (hWgraph (gamma p) hpW).2.mp (Or.inl ⟨p, Ioo_subset_Icc_self hp, rfl⟩) |
| 45 | have hcoord : L (gamma p) = (x, h x) := Prod.ext rfl hpgraph |
| 46 | have hbase : L.symm (x, h x) = gamma p := by rw [← hcoord, L.symm_apply_apply] |
| 47 | have hx : (x, 0) ∈ H.source := by rw [hsource]; exact ⟨hxX, mem_univ _⟩ |
| 48 | have hHbase : H (x, 0) = gamma p := by rw [hformula, add_zero, hbase] |
| 49 | have hfront : H (x, 0) ∈ frontier U := by |
| 50 | rw [hHbase, hfU] |
| 51 | exact Or.inl ⟨p, Ioo_subset_Icc_self hp, rfl⟩ |
| 52 | have hpre : ∀ᶠ z in 𝓝 (x, (0 : ℝ)), H z ∈ W := |
| 53 | (H.continuousAt hx).preimage_mem_nhds (by simpa only [hHbase] using hW.mem_nhds hpW) |
| 54 | have hline : ∀ᶠ z in 𝓝 (x, (0 : ℝ)), H z ∈ frontier U ↔ z.2 = 0 := by |
| 55 | filter_upwards [hpre] with z hz |
| 56 | rw [hfU, (hWgraph (H z) hz).2, hformula, L.apply_symm_apply] |
| 57 | simp only [add_eq_left] |
| 58 | have hside := m64Intrinsic_jordan_product_line_germ hU hV hdisj hfV.symm H hx hfront hline |
| 59 | let X0 : AnnulusCoordinates →L[ℝ] ℝ := |
| 60 | (ContinuousLinearMap.fst ℝ ℝ ℝ).comp L.toContinuousLinearMap |
| 61 | let Y0 : AnnulusCoordinates →L[ℝ] ℝ := |
| 62 | (ContinuousLinearMap.snd ℝ ℝ ℝ).comp L.toContinuousLinearMap |
| 63 | let phi := fun z => Y0 z - h (X0 z) |
| 64 | let ell : AnnulusCoordinates →L[ℝ] ℝ := Y0 - deriv h x • X0 |
| 65 | have hdh : HasDerivAt h (deriv h x) x := |
| 66 | ((hh x hxX).contDiffAt (hX.mem_nhds hxX)).differentiableAt (by simp) |>.hasDerivAt |
| 67 | have hXbase : X0 (gamma p) = x := rfl |
| 68 | have hYbase : Y0 (gamma p) = h x := hpgraph |
| 69 | have hd : HasFDerivAt phi ell (gamma p) := |
| 70 | Y0.hasFDerivAt.sub (hdh.comp_hasFDerivAt_of_eq (gamma p) X0.hasFDerivAt hXbase.symm) |
| 71 | have hzero : phi (gamma p) = 0 := by simp only [phi, hXbase, hYbase, sub_self] |
| 72 | have hv : ell (L.symm (0, 1)) = 1 := by |
| 73 | change (L (L.symm (0, 1))).2 - deriv h x * (L (L.symm (0, 1))).1 = 1 |
| 74 | rw [L.apply_symm_apply] |
| 75 | simp |
| 76 | have hell : ell ≠ 0 := by |
| 77 | intro heq |
| 78 | have hz : ell (L.symm (0, 1)) = 0 := by rw [heq]; rfl |
| 79 | linarith |
| 80 | let psi := fun z : AnnulusCoordinates => ((L z).1, (L z).2 - h (L z).1) |
| 81 | have hshift : ContinuousAt psi (gamma p) := |
| 82 | L.continuous.fst.continuousAt.prodMk (L.continuous.snd.continuousAt.sub |
| 83 | (hdh.continuousAt.comp_of_eq L.continuous.fst.continuousAt rfl)) |
| 84 | have ht : Tendsto psi (𝓝 (gamma p)) (𝓝 (x, (0 : ℝ))) := by |
| 85 | simpa only [psi, hcoord, sub_self] using hshift.tendsto |
| 86 | have hcancel (z : AnnulusCoordinates) : H (psi z) = z := by |
| 87 | rw [hformula] |
| 88 | simp only [psi, add_sub_cancel, L.symm_apply_apply] |
| 89 | rcases hside with hs | hs |
| 90 | · refine ⟨phi, ell, hd, hzero, hell, ?_⟩ |
| 91 | filter_upwards [ht.eventually hs] with z hz |
| 92 | rw [hcancel] at hz |
| 93 | exact hz |
| 94 | · refine ⟨fun z => -phi z, -ell, hd.neg, by simp only [hzero, neg_zero], |
| 95 | neg_ne_zero.mpr hell, ?_⟩ |
| 96 | filter_upwards [ht.eventually hs] with z hz |
| 97 | rw [hcancel] at hz |
| 98 | exact hz.trans neg_nonneg.symm |
| 99 | |
| 100 | end PoincareMT |