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.Three.ArcReverseData |
| 2 | import PoincareLib.Geometry.CurveShortening.Comparison.IntrinsicComparison.Joined.InwardSign |
| 3 | |
| 4 | /-! The actual three-arc triangulation with the original labels restored. |
| 5 | Source: MT Claim 19.40; normal-collision-transversality derivation, |
| 6 | Section 11. Its construction does not assume an inward orientation. -/ |
| 7 | |
| 8 | noncomputable section |
| 9 | set_option autoImplicit false |
| 10 | set_option backward.isDefEq.respectTransparency false |
| 11 | |
| 12 | open Set Filter |
| 13 | open scoped Topology ContDiff Matrix |
| 14 | open Poincare.Topology.Plane.Curves PoincareMT.Topology.Surface |
| 15 | |
| 16 | namespace PoincareMT |
| 17 | |
| 18 | /-- The original three arcs construct a marked triangulation in either orientation. The |
| 19 | output labels always refer to the original initial corner, straight join and terminal |
| 20 | corner. Source: MT Claim 19.40; normal-collision-transversality derivation, Section 11. |
| 21 | Construction: |
| 22 | proof-work/tasks/M64/derivations/2026-09-27-normal-collision-transversality.md, Section 11. -/ |
| 23 | theorem m64Intrinsic_exists_three_arc_triangulation |
| 24 | (gamma : Bool → ℝ → AnnulusCoordinates) (sigma : ℝ → AnnulusCoordinates) |
| 25 | (T : Bool → ℝ) {S speed : ℝ} (hg : ∀ e, ContDiff ℝ ∞ (gamma e)) |
| 26 | (hs : ContDiff ℝ ∞ sigma) (hT : ∀ e, 0 < T e) (hS : 0 < S) (hspeed : 0 < speed) |
| 27 | (hinj : ∀ e, InjOn (gamma e) (Icc 0 (T e))) (hsi : InjOn sigma (Icc 0 S)) |
| 28 | (hstart : sigma 0 = gamma false 0) (hend : sigma S = gamma true (T true)) |
| 29 | (hjoin : gamma false (T false) = gamma true 0) |
| 30 | (hreg : deriv (gamma false) (T false) ≠ 0) |
| 31 | (htan : deriv (gamma true) 0 = speed • deriv (gamma false) (T false)) |
| 32 | (hab : ∀ x ∈ Icc 0 (T false), ∀ y ∈ Icc 0 (T true), |
| 33 | gamma false x = gamma true y → x = T false ∧ y = 0) |
| 34 | (has : ∀ x ∈ Icc 0 (T false), ∀ y ∈ Icc 0 S, |
| 35 | gamma false x = sigma y → x = 0 ∧ y = 0) |
| 36 | (hbs : ∀ x ∈ Icc 0 (T true), ∀ y ∈ Icc 0 S, |
| 37 | gamma true x = sigma y → x = T true ∧ y = S) |
| 38 | (hregular : ∀ e, ∀ t ∈ Ioo 0 (T e), deriv (gamma e) t ≠ 0) |
| 39 | (hsreg : ∀ t ∈ Ioo 0 S, deriv sigma t ≠ 0) |
| 40 | (hind0 : LinearIndependent ℝ |
| 41 | (![deriv (gamma false) 0, deriv sigma 0] : Fin 2 → AnnulusCoordinates)) |
| 42 | (hind1 : LinearIndependent ℝ |
| 43 | (![-deriv (gamma true) (T true), -deriv sigma S] : Fin 2 → AnnulusCoordinates)) |
| 44 | {U V : Set AnnulusCoordinates} (hU : IsOpen U) (hV : IsOpen V) (hUV : Disjoint U V) |
| 45 | (hfront : frontier U = gamma false '' Icc 0 (T false) ∪ |
| 46 | gamma true '' Icc 0 (T true) ∪ sigma '' Icc 0 S) |
| 47 | (hfV : frontier V = frontier U) (hcompact : IsCompact (closure U)) : |
| 48 | ∃ R : M64IntrinsicCoordinateTriangulation (closure U), |
| 49 | ∃ v0 vj v1 : Euler.CoordinateVertex R.coordinates R.basis, |
| 50 | v0.1 = gamma false 0 ∧ vj.1 = gamma false (T false) ∧ v1.1 = gamma true (T true) ∧ |
| 51 | ∀ g : RiemannianMetric 2 AnnulusCoordinates, |
| 52 | coordinateVertexAngleContribution g R.coordinates R.basis vj.1 = Real.pi := by |
| 53 | have hpK : gamma false (T false) ∉ sigma '' Icc 0 S := by |
| 54 | rintro ⟨y, hy, he⟩ |
| 55 | exact (hT false).ne' (has (T false) ⟨(hT false).le, le_rfl⟩ y hy he.symm).1 |
| 56 | have havoid0 (x : ℝ) (hx : x ∈ Ioo 0 (T false)) : |
| 57 | gamma false x ∉ sigma '' Icc 0 S := by |
| 58 | rintro ⟨y, hy, he⟩ |
| 59 | exact hx.1.ne' (has x (Ioo_subset_Icc_self hx) y hy he.symm).1 |
| 60 | have havoid1 (x : ℝ) (hx : x ∈ Ioo 0 (T true)) : |
| 61 | gamma true x ∉ sigma '' Icc 0 S := by |
| 62 | rintro ⟨y, hy, he⟩ |
| 63 | exact hx.2.ne (hbs x (Ioo_subset_Icc_self hx) y hy he.symm).1 |
| 64 | obtain ⟨sign, hsign, hray0, hray1⟩ := m64Intrinsic_exists_straight_join_inward_sign |
| 65 | (hg false) (hg true) (hT false) (hT true) hspeed (hinj false) (hinj true) |
| 66 | hjoin hreg htan hab (hregular false) (hregular true) |
| 67 | (isCompact_Icc.image hs.continuous) hpK havoid0 havoid1 hU hV hUV hfront hfV |
| 68 | rcases hsign with rfl | rfl |
| 69 | · apply m64Intrinsic_exists_three_arc_triangulation_with_straight_fan gamma sigma T |
| 70 | hg hs hT hS hspeed hinj hsi hstart hend hjoin hreg htan hab has hbs hregular hsreg |
| 71 | hind0 hind1 hU hV hUV hfront hfV hcompact |
| 72 | intro e |
| 73 | cases e |
| 74 | · simpa only [one_smul] using hray0 |
| 75 | · simpa only [one_smul] using hray1 |
| 76 | · have hray (e : Bool) : ∀ t ∈ Ioo 0 (T e), ∀ᶠ r in 𝓝[>] (0 : ℝ), |
| 77 | gamma e t + r • ((-1 : ℝ) • quarterTurn (deriv (gamma e) t)) ∈ U := by |
| 78 | cases e |
| 79 | · exact hray0 |
| 80 | · exact hray1 |
| 81 | let g (e : Bool) (t : ℝ) := gamma (!e) (T (!e) - t) |
| 82 | let s (t : ℝ) := sigma (S - t) |
| 83 | let L (e : Bool) := T (!e) |
| 84 | obtain ⟨hg', hs', hgi, hsi', hstart', hend', hjoin', hreg', htan', hab', has', hbs', |
| 85 | hregular', hsreg', hind0', hind1', hfront', hray'⟩ := |
| 86 | m64Intrinsic_three_arc_reverse_data gamma sigma T hg hs hspeed hinj hsi |
| 87 | hstart hend hjoin hreg htan hab has hbs hregular hsreg hind0 hind1 hfront hray |
| 88 | obtain ⟨R, v0, vj, v1, hv0, hvj, hv1, hfan⟩ := |
| 89 | m64Intrinsic_exists_three_arc_triangulation_with_straight_fan g s L hg' hs' |
| 90 | (fun e => hT (!e)) hS (inv_pos.mpr hspeed) hgi hsi' hstart' hend' hjoin' hreg' |
| 91 | htan' hab' has' hbs' hregular' hsreg' hind0' hind1' hU hV hUV hfront' hfV hcompact hray' |
| 92 | refine ⟨R, v1, vj, v0, ?_, ?_, ?_, hfan⟩ |
| 93 | · simpa only [g, L, Bool.not_true, sub_self] using hv1 |
| 94 | · have hjoinVertex : vj.1 = gamma true 0 := by |
| 95 | simpa only [g, L, Bool.not_false, sub_self] using hvj |
| 96 | exact hjoinVertex.trans hjoin.symm |
| 97 | · simpa only [g, Bool.not_false, sub_zero] using hv0 |
| 98 | |
| 99 | end PoincareMT |