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.ArcStraightFan |
| 2 | |
| 3 | /-! Exact reversal and exchange of the two joined boundary arcs. |
| 4 | Source: MT Claim 19.40; normal-collision-transversality derivation, |
| 5 | Section 11. The two genuine corner data exchange roles. -/ |
| 6 | |
| 7 | noncomputable section |
| 8 | set_option autoImplicit false |
| 9 | set_option backward.isDefEq.respectTransparency false |
| 10 | |
| 11 | open Set Filter |
| 12 | open scoped Topology ContDiff Matrix |
| 13 | open Poincare.Topology.Plane.Curves |
| 14 | |
| 15 | namespace PoincareMT |
| 16 | |
| 17 | private theorem reverse_inj {gamma : ℝ → AnnulusCoordinates} {T : ℝ} |
| 18 | (hi : InjOn gamma (Icc 0 T)) : InjOn (fun t => gamma (T - t)) (Icc 0 T) := by |
| 19 | intro s hs t ht he |
| 20 | have h := hi ⟨by linarith [hs.2], by linarith [hs.1]⟩ |
| 21 | ⟨by linarith [ht.2], by linarith [ht.1]⟩ he |
| 22 | linarith |
| 23 | |
| 24 | private theorem reverse_image (gamma : ℝ → AnnulusCoordinates) (T : ℝ) : |
| 25 | (fun t => gamma (T - t)) '' Icc 0 T = gamma '' Icc 0 T := by |
| 26 | change (gamma ∘ fun t => T - t) '' Icc 0 T = _ |
| 27 | rw [image_comp, image_const_sub_Icc] |
| 28 | simp only [sub_self, sub_zero] |
| 29 | |
| 30 | /-- Reversing and exchanging the original joined arcs preserves their exact region and |
| 31 | converts their negative inward sign to the positive sign. Source: MT Claim 19.40; |
| 32 | normal-collision-transversality derivation, Section 11. Construction: |
| 33 | proof-work/tasks/M64/derivations/2026-09-27-normal-collision-transversality.md, Section 11. -/ |
| 34 | theorem m64Intrinsic_three_arc_reverse_data |
| 35 | (gamma : Bool → ℝ → AnnulusCoordinates) (sigma : ℝ → AnnulusCoordinates) |
| 36 | (T : Bool → ℝ) {S speed : ℝ} (hg : ∀ e, ContDiff ℝ ∞ (gamma e)) |
| 37 | (hs : ContDiff ℝ ∞ sigma) (hspeed : 0 < speed) |
| 38 | (hinj : ∀ e, InjOn (gamma e) (Icc 0 (T e))) (hsi : InjOn sigma (Icc 0 S)) |
| 39 | (hstart : sigma 0 = gamma false 0) (hend : sigma S = gamma true (T true)) |
| 40 | (hjoin : gamma false (T false) = gamma true 0) |
| 41 | (hreg : deriv (gamma false) (T false) ≠ 0) |
| 42 | (htan : deriv (gamma true) 0 = speed • deriv (gamma false) (T false)) |
| 43 | (hab : ∀ x ∈ Icc 0 (T false), ∀ y ∈ Icc 0 (T true), |
| 44 | gamma false x = gamma true y → x = T false ∧ y = 0) |
| 45 | (has : ∀ x ∈ Icc 0 (T false), ∀ y ∈ Icc 0 S, |
| 46 | gamma false x = sigma y → x = 0 ∧ y = 0) |
| 47 | (hbs : ∀ x ∈ Icc 0 (T true), ∀ y ∈ Icc 0 S, |
| 48 | gamma true x = sigma y → x = T true ∧ y = S) |
| 49 | (hregular : ∀ e, ∀ t ∈ Ioo 0 (T e), deriv (gamma e) t ≠ 0) |
| 50 | (hsreg : ∀ t ∈ Ioo 0 S, deriv sigma t ≠ 0) |
| 51 | (hind0 : LinearIndependent ℝ |
| 52 | (![deriv (gamma false) 0, deriv sigma 0] : Fin 2 → AnnulusCoordinates)) |
| 53 | (hind1 : LinearIndependent ℝ |
| 54 | (![-deriv (gamma true) (T true), -deriv sigma S] : Fin 2 → AnnulusCoordinates)) |
| 55 | {U : Set AnnulusCoordinates} |
| 56 | (hfront : frontier U = gamma false '' Icc 0 (T false) ∪ |
| 57 | gamma true '' Icc 0 (T true) ∪ sigma '' Icc 0 S) |
| 58 | (hray : ∀ e, ∀ t ∈ Ioo 0 (T e), ∀ᶠ r in 𝓝[>] (0 : ℝ), |
| 59 | gamma e t + r • ((-1 : ℝ) • quarterTurn (deriv (gamma e) t)) ∈ U) : |
| 60 | let g (e : Bool) (t : ℝ) := gamma (!e) (T (!e) - t) |
| 61 | let s (t : ℝ) := sigma (S - t) |
| 62 | let L (e : Bool) := T (!e) |
| 63 | (∀ e, ContDiff ℝ ∞ (g e)) ∧ ContDiff ℝ ∞ s ∧ |
| 64 | (∀ e, InjOn (g e) (Icc 0 (L e))) ∧ InjOn s (Icc 0 S) ∧ |
| 65 | s 0 = g false 0 ∧ s S = g true (L true) ∧ |
| 66 | g false (L false) = g true 0 ∧ |
| 67 | deriv (g false) (L false) ≠ 0 ∧ |
| 68 | deriv (g true) 0 = speed⁻¹ • deriv (g false) (L false) ∧ |
| 69 | (∀ x ∈ Icc 0 (L false), ∀ y ∈ Icc 0 (L true), |
| 70 | g false x = g true y → x = L false ∧ y = 0) ∧ |
| 71 | (∀ x ∈ Icc 0 (L false), ∀ y ∈ Icc 0 S, g false x = s y → x = 0 ∧ y = 0) ∧ |
| 72 | (∀ x ∈ Icc 0 (L true), ∀ y ∈ Icc 0 S, |
| 73 | g true x = s y → x = L true ∧ y = S) ∧ |
| 74 | (∀ e, ∀ t ∈ Ioo 0 (L e), deriv (g e) t ≠ 0) ∧ |
| 75 | (∀ t ∈ Ioo 0 S, deriv s t ≠ 0) ∧ |
| 76 | LinearIndependent ℝ (![deriv (g false) 0, deriv s 0] : Fin 2 → AnnulusCoordinates) ∧ |
| 77 | LinearIndependent ℝ |
| 78 | (![-deriv (g true) (L true), -deriv s S] : Fin 2 → AnnulusCoordinates) ∧ |
| 79 | frontier U = g false '' Icc 0 (L false) ∪ g true '' Icc 0 (L true) ∪ s '' Icc 0 S ∧ |
| 80 | ∀ e, ∀ t ∈ Ioo 0 (L e), ∀ᶠ r in 𝓝[>] (0 : ℝ), |
| 81 | g e t + r • quarterTurn (deriv (g e) t) ∈ U := by |
| 82 | intro g s L |
| 83 | have hd (e : Bool) (t : ℝ) : deriv (g e) t = -deriv (gamma (!e)) (T (!e) - t) := by |
| 84 | change deriv (fun t => gamma (!e) (T (!e) - t)) t = _ |
| 85 | rw [deriv_comp_const_sub] |
| 86 | have hds (t : ℝ) : deriv s t = -deriv sigma (S - t) := by |
| 87 | change deriv (fun t => sigma (S - t)) t = _ |
| 88 | rw [deriv_comp_const_sub] |
| 89 | refine ⟨fun e => (hg (!e)).comp (contDiff_const.sub contDiff_id), |
| 90 | hs.comp (contDiff_const.sub contDiff_id), fun e => reverse_inj (hinj (!e)), |
| 91 | reverse_inj hsi, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ |
| 92 | · simpa only [s, g, Bool.not_false, sub_zero] using hend |
| 93 | · simpa only [s, g, L, Bool.not_true, sub_self] using hstart |
| 94 | · simpa only [g, L, Bool.not_false, Bool.not_true, sub_self, sub_zero] using hjoin.symm |
| 95 | · rw [hd] |
| 96 | change -deriv (gamma true) (T true - T true) ≠ 0 |
| 97 | rw [sub_self, htan] |
| 98 | exact neg_ne_zero.mpr (smul_ne_zero hspeed.ne' hreg) |
| 99 | · rw [hd, hd] |
| 100 | change -deriv (gamma false) (T false - 0) = |
| 101 | speed⁻¹ • (-deriv (gamma true) (T true - T true)) |
| 102 | rw [sub_zero, sub_self, htan, smul_neg, smul_smul, inv_mul_cancel₀ hspeed.ne', one_smul] |
| 103 | · intro x hx y hy he |
| 104 | change x ∈ Icc 0 (T true) at hx |
| 105 | change y ∈ Icc 0 (T false) at hy |
| 106 | have hh := hab (T false - y) ⟨by linarith [hy.2], by linarith [hy.1]⟩ |
| 107 | (T true - x) ⟨by linarith [hx.2], by linarith [hx.1]⟩ he.symm |
| 108 | exact ⟨by change x = T true; linarith [hh.2], by linarith [hh.1]⟩ |
| 109 | · intro x hx y hy he |
| 110 | change x ∈ Icc 0 (T true) at hx |
| 111 | have hh := hbs (T true - x) ⟨by linarith [hx.2], by linarith [hx.1]⟩ |
| 112 | (S - y) ⟨by linarith [hy.2], by linarith [hy.1]⟩ he |
| 113 | exact ⟨by linarith [hh.1], by linarith [hh.2]⟩ |
| 114 | · intro x hx y hy he |
| 115 | change x ∈ Icc 0 (T false) at hx |
| 116 | have hh := has (T false - x) ⟨by linarith [hx.2], by linarith [hx.1]⟩ |
| 117 | (S - y) ⟨by linarith [hy.2], by linarith [hy.1]⟩ he |
| 118 | exact ⟨by change x = T false; linarith [hh.1], by linarith [hh.2]⟩ |
| 119 | · intro e t ht |
| 120 | rw [hd] |
| 121 | exact neg_ne_zero.mpr (hregular (!e) _ ⟨by linarith [ht.2], by linarith [ht.1]⟩) |
| 122 | · intro t ht |
| 123 | rw [hds] |
| 124 | exact neg_ne_zero.mpr (hsreg _ ⟨by linarith [ht.2], by linarith [ht.1]⟩) |
| 125 | · rw [hd, hds] |
| 126 | simpa only [Bool.not_false, sub_zero] using hind1 |
| 127 | · rw [hd, hds] |
| 128 | simpa only [L, Bool.not_true, sub_self, neg_neg] using hind0 |
| 129 | · change frontier U = (fun t => gamma true (T true - t)) '' Icc 0 (T true) ∪ |
| 130 | (fun t => gamma false (T false - t)) '' Icc 0 (T false) ∪ |
| 131 | (fun t => sigma (S - t)) '' Icc 0 S |
| 132 | rw [reverse_image, reverse_image, reverse_image] |
| 133 | exact hfront.trans (by ac_rfl) |
| 134 | · intro e t ht |
| 135 | simpa only [g, deriv_comp_const_sub, map_neg, neg_one_smul] using |
| 136 | hray (!e) (T (!e) - t) ⟨by linarith [ht.2], by linarith [ht.1]⟩ |
| 137 | |
| 138 | end PoincareMT |