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.Analysis.Closed.FirstExit |
| 2 | import PoincareLib.Geometry.CurveShortening.Comparison.Analysis.Compact.RadialTube |
| 3 | import PoincareLib.Geometry.CurveShortening.Comparison.Analysis.Local.LiftNormControl |
| 4 | import PoincareLib.Geometry.CurveShortening.Comparison.Analysis.Radial.CornerGerms |
| 5 | |
| 6 | /-! A bounded earlier contact from the actual convex digon germs. |
| 7 | Source: MT Claim 19.41; short-geodesic-digons derivation, Section 10. |
| 8 | First exit supplies confinement of the whole perturbed ray. -/ |
| 9 | |
| 10 | set_option autoImplicit false |
| 11 | set_option backward.isDefEq.respectTransparency false |
| 12 | |
| 13 | open Set Filter |
| 14 | open scoped Topology |
| 15 | |
| 16 | namespace PoincareMT |
| 17 | |
| 18 | /-- Perturbing into the initial corner and taking first exit produces a bounded confined |
| 19 | noncanonical contact strictly before the terminal point. The inverse chart is only required |
| 20 | near the first compact radial segment. Source: MT Claim 19.41; digon derivation, Section 10. |
| 21 | Source/construction: proof-work/tasks/M64/derivations/2026-09-27-short-geodesic-digons.md, |
| 22 | Section 10. -/ |
| 23 | theorem m64_exists_earlier_radial_digon_contact |
| 24 | {E X : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 25 | [TopologicalSpace X] [T2Space X] (F : OpenPartialHomeomorph E X) |
| 26 | {v theta : E} {R s : ℝ} (hs : 0 < s) (hR : ‖v‖ ≤ R) |
| 27 | (hsegment : ∀ t ∈ Icc (0 : ℝ) 1, t • v ∈ F.source) |
| 28 | {beta : ℝ → X} (hb : ContinuousOn beta (Icc 0 s)) (hi : InjOn beta (Icc 0 s)) |
| 29 | (hbase : beta 0 = F 0) (hend : beta s = F v) |
| 30 | {U : Set X} |
| 31 | (hfront : frontier U = (fun t : ℝ => F (t • v)) '' Icc 0 1 ∪ beta '' Icc 0 s) |
| 32 | {phi : E → ℝ × ℝ} {J : E →L[ℝ] ℝ × ℝ} |
| 33 | (hphi : HasFDerivAt phi J 0) (hzero : phi 0 = 0) |
| 34 | (hcorner : ∀ᶠ z in 𝓝 (0 : E), |
| 35 | 0 ≤ (phi z).1 ∧ 0 ≤ (phi z).2 → F z ∈ closure U) |
| 36 | (hv1 : 0 < (J v).1) (hv2 : (J v).2 = 0) |
| 37 | (ht1 : (J theta).1 = 0) (ht2 : 0 < (J theta).2) |
| 38 | (hescape : ∀ᶠ a in 𝓝[>] (1 : ℝ), F (a • v) ∉ closure U) |
| 39 | (hshort : ∀ᶠ b in 𝓝[<] s, ‖F.symm (beta b)‖ < ‖v‖) : |
| 40 | ∃ b ∈ Ioo 0 s, ∃ z ∈ F.source, |
| 41 | ‖z‖ ≤ R ∧ (∀ t ∈ Icc (0 : ℝ) 1, t • z ∈ F.source ∧ F (t • z) ∈ closure U) ∧ |
| 42 | F z = beta b ∧ z ≠ b • theta := by |
| 43 | have hvne : v ≠ 0 := by |
| 44 | intro hv |
| 45 | simp only [hv, map_zero, Prod.fst_zero, lt_self_iff_false] at hv1 |
| 46 | have hvs : v ∈ F.source := by simpa only [one_smul] using hsegment 1 ⟨zero_le_one, le_rfl⟩ |
| 47 | have hlocal := m64_eventually_lift_contact_norm_le F hvs hs.le hb hi hend.symm hshort |
| 48 | obtain ⟨O, hO, hOS, hsegO, hnorm⟩ := |
| 49 | m64_exists_radial_contact_neighborhood F.open_source hvne hR hsegment hlocal |
| 50 | obtain ⟨A0, hA0, C, hC, htube⟩ := m64_exists_extended_radial_tube hO hsegO |
| 51 | have hvC : v ∈ C := mem_of_mem_nhds hC |
| 52 | have hsmall : ∀ᶠ a in 𝓝[>] (1 : ℝ), a ∈ Ioo 1 A0 := Ioo_mem_nhdsGT hA0 |
| 53 | obtain ⟨A, hAI, hAvout⟩ := (hsmall.and hescape).exists |
| 54 | have hA : 0 < A := zero_lt_one.trans hAI.1 |
| 55 | have hAvs : A • v ∈ F.source := hOS (htube v hvC A ⟨hA.le, hAI.2.le⟩) |
| 56 | have hcont : ContinuousAt (fun w : E => F (A • w)) v := |
| 57 | ((F.continuousOn (A • v) hAvs).continuousAt (F.open_source.mem_nhds hAvs)).comp |
| 58 | (continuous_const.smul continuous_id).continuousAt |
| 59 | have hC' : ∀ᶠ w in 𝓝 v, w ∈ C := hC |
| 60 | have hnear : ∀ᶠ w in 𝓝 v, w ∈ C ∧ F (A • w) ∉ closure U := |
| 61 | hC'.and (hcont.eventually (isClosed_closure.isOpen_compl.mem_nhds hAvout)) |
| 62 | have hpert : Tendsto (fun eps : ℝ => v + eps • theta) (𝓝 0) (𝓝 v) := by |
| 63 | have hc : Continuous (fun eps : ℝ => v + eps • theta) := by fun_prop |
| 64 | simpa only [zero_smul, add_zero] using hc.tendsto (0 : ℝ) |
| 65 | have hnear' : ∀ᶠ eps in 𝓝[>] (0 : ℝ), |
| 66 | v + eps • theta ∈ C ∧ F (A • (v + eps • theta)) ∉ closure U := |
| 67 | (hpert.eventually hnear).filter_mono nhdsWithin_le_nhds |
| 68 | have hpos : ∀ᶠ eps in 𝓝[>] (0 : ℝ), 0 < eps := self_mem_nhdsWithin |
| 69 | obtain ⟨eps, heps, hwC, hwout⟩ := (hpos.and hnear').exists |
| 70 | have hepspos : 0 < eps := heps |
| 71 | let w := v + eps • theta |
| 72 | have hw1 : (J w).1 = (J v).1 := by simp [w, ht1] |
| 73 | have hw2 : (J w).2 = eps * (J theta).2 := by simp [w, hv2] |
| 74 | have hwpos : 0 < (J w).1 ∧ 0 < (J w).2 := by |
| 75 | rw [hw1, hw2] |
| 76 | exact ⟨hv1, mul_pos hepspos ht2⟩ |
| 77 | have hwO (t : ℝ) (ht : t ∈ Icc 0 A) : t • w ∈ O := |
| 78 | htube w hwC t ⟨ht.1, ht.2.trans hAI.2.le⟩ |
| 79 | have hpath : ContinuousOn (fun t : ℝ => F (t • w)) (Icc 0 A) := |
| 80 | F.continuousOn.comp (continuous_id.smul continuous_const).continuousOn |
| 81 | (fun t ht => hOS (hwO t ht)) |
| 82 | have hstart : F ((0 : ℝ) • w) ∈ closure U := by |
| 83 | apply frontier_subset_closure |
| 84 | rw [hfront] |
| 85 | exact Or.inl ⟨0, ⟨le_rfl, zero_le_one⟩, by simp⟩ |
| 86 | obtain ⟨a, ha, hafront, hconf⟩ := m64_exists_first_exit_closed hA hpath isClosed_closure |
| 87 | hstart (m64_radial_enters_positive_corner hphi hzero hcorner hwpos) hwout |
| 88 | have has : a • w ∈ F.source := hOS (hwO a ⟨ha.1.le, ha.2.le⟩) |
| 89 | have havoid (t : ℝ) (ht : t ∈ Icc 0 1) : F (a • w) ≠ F (t • v) := by |
| 90 | intro heq |
| 91 | have hvect := F.injOn has (hsegment t ht) heq |
| 92 | have hcoord := congrArg (fun z : E => (J z).2) hvect |
| 93 | have hpos : 0 < a * (J w).2 := mul_pos ha.1 hwpos.2 |
| 94 | simp only [map_smul, Prod.smul_snd, smul_eq_mul, hv2, mul_zero] at hcoord |
| 95 | exact hpos.ne' hcoord |
| 96 | have hcontact : F (a • w) ∈ frontier U := frontier_closure_subset hafront |
| 97 | rw [hfront] at hcontact |
| 98 | rcases hcontact with ⟨t, ht, heq⟩ | ⟨b, hbI, heq⟩ |
| 99 | · exact False.elim (havoid t ht heq.symm) |
| 100 | have hb0 : 0 < b := lt_of_le_of_ne hbI.1 (by |
| 101 | intro heq0 |
| 102 | have h := heq0 ▸ heq |
| 103 | rw [hbase] at h |
| 104 | exact havoid 0 ⟨le_rfl, zero_le_one⟩ (by simpa only [zero_smul] using h.symm)) |
| 105 | have hbs : b < s := lt_of_le_of_ne hbI.2 (by |
| 106 | intro heqs |
| 107 | have h := heqs ▸ heq |
| 108 | rw [hend] at h |
| 109 | exact havoid 1 ⟨zero_le_one, le_rfl⟩ (by simpa only [one_smul] using h.symm)) |
| 110 | refine ⟨b, ⟨hb0, hbs⟩, a • w, has, |
| 111 | hnorm (a • w) (hwO a ⟨ha.1.le, ha.2.le⟩) b hbI heq.symm, ?_, heq.symm, ?_⟩ |
| 112 | · intro t ht |
| 113 | have hta : t * a ∈ Icc 0 a := |
| 114 | ⟨mul_nonneg ht.1 ha.1.le, by nlinarith only [ht.2, ha.1]⟩ |
| 115 | rw [smul_smul] |
| 116 | exact ⟨hOS (hwO (t * a) ⟨hta.1, hta.2.trans ha.2.le⟩), hconf hta⟩ |
| 117 | · intro heqv |
| 118 | have hcoord := congrArg (fun z : E => (J z).1) heqv |
| 119 | have hpos : 0 < a * (J w).1 := mul_pos ha.1 hwpos.1 |
| 120 | simp only [map_smul, Prod.smul_fst, smul_eq_mul, ht1, mul_zero] at hcoord |
| 121 | exact hpos.ne' hcoord |
| 122 | |
| 123 | end PoincareMT |