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.Transverse.ArcCuts |
| 2 | |
| 3 | /-! |
| 4 | # Actual local geometry at a regular straight join |
| 5 | |
| 6 | Two separately smooth arcs with positively proportional endpoint tangents |
| 7 | have embedded short pieces, a common positive projection and a common |
| 8 | transverse direction. No smoothness of their concatenation is assumed. |
| 9 | This supplies the straight contact in Morgan--Tian, Claim 19.40, pp. 470-471; |
| 10 | see `derivations/2026-09-27-minimal-contact-regularity.md`, Section 9. |
| 11 | -/ |
| 12 | |
| 13 | noncomputable section |
| 14 | set_option autoImplicit false |
| 15 | set_option backward.isDefEq.respectTransparency false |
| 16 | |
| 17 | open Set Filter |
| 18 | open scoped Topology ContDiff |
| 19 | open Poincare.Topology.Plane.Curves |
| 20 | |
| 21 | namespace PoincareMT |
| 22 | |
| 23 | /-- Positively proportional regular tangents construct arbitrarily short embedded adjacent |
| 24 | pieces and a single physical transverse direction. The derivative assertions concern each |
| 25 | smooth extension separately. Source: |
| 26 | `proof-work/tasks/M64/derivations/2026-09-27-minimal-contact-regularity.md`, Section 9. -/ |
| 27 | theorem m64Intrinsic_straight_join_local_geometry |
| 28 | {alpha beta : ℝ → AnnulusCoordinates} |
| 29 | (ha : ContDiff ℝ ∞ alpha) (hb : ContDiff ℝ ∞ beta) |
| 30 | {A B c eta : ℝ} (heta : 0 < eta) (hc : 0 < c) |
| 31 | (hend : alpha A = beta B) (hreg : deriv alpha A ≠ 0) |
| 32 | (htan : deriv beta B = c • deriv alpha A) : |
| 33 | ∃ epsilon > 0, epsilon < eta ∧ |
| 34 | (∀ t ∈ Icc (A - epsilon) A, |
| 35 | 0 < inner ℝ (deriv alpha A) (deriv alpha t) ∧ |
| 36 | 0 < inner ℝ (quarterTurn (deriv alpha t)) (quarterTurn (deriv alpha A))) ∧ |
| 37 | (∀ t ∈ Icc B (B + epsilon), |
| 38 | 0 < inner ℝ (deriv alpha A) (deriv beta t) ∧ |
| 39 | 0 < inner ℝ (quarterTurn (deriv beta t)) (quarterTurn (deriv alpha A))) ∧ |
| 40 | InjOn alpha (Icc (A - epsilon) A) ∧ InjOn beta (Icc B (B + epsilon)) ∧ |
| 41 | ∀ s ∈ Icc (A - epsilon) A, ∀ t ∈ Icc B (B + epsilon), |
| 42 | alpha s = beta t → s = A ∧ t = B := by |
| 43 | have hac : Continuous (deriv alpha) := (contDiff_infty_iff_deriv.mp ha).2.continuous |
| 44 | have hbc : Continuous (deriv beta) := (contDiff_infty_iff_deriv.mp hb).2.continuous |
| 45 | have hv : 0 < inner ℝ (deriv alpha A) (deriv alpha A) := real_inner_self_pos.mpr hreg |
| 46 | have hw : 0 < inner ℝ (quarterTurn (deriv alpha A)) (quarterTurn (deriv alpha A)) := by |
| 47 | apply real_inner_self_pos.mpr |
| 48 | intro hz |
| 49 | exact hreg (quarterTurn.injective (by simpa using hz)) |
| 50 | let P : Set ℝ := {s | |
| 51 | (0 < inner ℝ (deriv alpha A) (deriv alpha (A + s)) ∧ |
| 52 | 0 < inner ℝ (quarterTurn (deriv alpha (A + s))) (quarterTurn (deriv alpha A))) ∧ |
| 53 | (0 < inner ℝ (deriv alpha A) (deriv beta (B + s)) ∧ |
| 54 | 0 < inner ℝ (quarterTurn (deriv beta (B + s))) (quarterTurn (deriv alpha A)))} |
| 55 | have hP : IsOpen P := by |
| 56 | have hca : Continuous (fun s : ℝ => deriv alpha (A + s)) := |
| 57 | hac.comp (continuous_const.add continuous_id) |
| 58 | have hcb : Continuous (fun s : ℝ => deriv beta (B + s)) := |
| 59 | hbc.comp (continuous_const.add continuous_id) |
| 60 | have hpa := isOpen_lt (continuous_const (y := (0 : ℝ))) |
| 61 | ((continuous_const (y := deriv alpha A)).inner hca) |
| 62 | have hta := isOpen_lt (continuous_const (y := (0 : ℝ))) |
| 63 | ((quarterTurn.continuous.comp hca).inner |
| 64 | (continuous_const (y := quarterTurn (deriv alpha A)))) |
| 65 | have hpb := isOpen_lt (continuous_const (y := (0 : ℝ))) |
| 66 | ((continuous_const (y := deriv alpha A)).inner hcb) |
| 67 | have htb := isOpen_lt (continuous_const (y := (0 : ℝ))) |
| 68 | ((quarterTurn.continuous.comp hcb).inner |
| 69 | (continuous_const (y := quarterTurn (deriv alpha A)))) |
| 70 | exact (hpa.inter hta).inter (hpb.inter htb) |
| 71 | have hzero : (0 : ℝ) ∈ P := by |
| 72 | refine ⟨⟨by simpa using hv, by simpa using hw⟩, ?_, ?_⟩ |
| 73 | · simp only [add_zero, htan, real_inner_smul_right] |
| 74 | exact mul_pos hc hv |
| 75 | · simp only [add_zero, htan, map_smul, real_inner_smul_left] |
| 76 | exact mul_pos hc hw |
| 77 | obtain ⟨r, hr, hball⟩ := Metric.mem_nhds_iff.mp (hP.mem_nhds hzero) |
| 78 | let epsilon := min eta r / 2 |
| 79 | have he : 0 < epsilon := half_pos (lt_min heta hr) |
| 80 | have hemin : epsilon < min eta r := half_lt_self (lt_min heta hr) |
| 81 | have heeta : epsilon < eta := hemin.trans_le (min_le_left _ _) |
| 82 | have her : epsilon < r := hemin.trans_le (min_le_right _ _) |
| 83 | have hsmall (s : ℝ) (hs : |s| ≤ epsilon) : s ∈ P := by |
| 84 | apply hball |
| 85 | simpa only [Metric.mem_ball, Real.dist_eq, sub_zero] using hs.trans_lt her |
| 86 | have hleft (t : ℝ) (ht : t ∈ Icc (A - epsilon) A) : |
| 87 | 0 < inner ℝ (deriv alpha A) (deriv alpha t) ∧ |
| 88 | 0 < inner ℝ (quarterTurn (deriv alpha t)) (quarterTurn (deriv alpha A)) := by |
| 89 | have hs := (hsmall (t - A) (abs_le.mpr ⟨by linarith [ht.1], by linarith [ht.2]⟩)).1 |
| 90 | simpa only [add_sub_cancel] using hs |
| 91 | have hright (t : ℝ) (ht : t ∈ Icc B (B + epsilon)) : |
| 92 | 0 < inner ℝ (deriv alpha A) (deriv beta t) ∧ |
| 93 | 0 < inner ℝ (quarterTurn (deriv beta t)) (quarterTurn (deriv alpha A)) := by |
| 94 | have hs := (hsmall (t - B) (abs_le.mpr ⟨by linarith [ht.1], by linarith [ht.2]⟩)).2 |
| 95 | simpa only [add_sub_cancel] using hs |
| 96 | let f : ℝ → ℝ := fun t => inner ℝ (deriv alpha A) (alpha t) |
| 97 | let g : ℝ → ℝ := fun t => inner ℝ (deriv alpha A) (beta t) |
| 98 | have hfd (t : ℝ) : deriv f t = inner ℝ (deriv alpha A) (deriv alpha t) := by |
| 99 | simpa only [inner_zero_left, add_zero] using |
| 100 | ((hasDerivAt_const t (deriv alpha A)).inner ℝ |
| 101 | ((ha.differentiable (by simp)) t).hasDerivAt).deriv |
| 102 | have hgd (t : ℝ) : deriv g t = inner ℝ (deriv alpha A) (deriv beta t) := by |
| 103 | simpa only [inner_zero_left, add_zero] using |
| 104 | ((hasDerivAt_const t (deriv alpha A)).inner ℝ |
| 105 | ((hb.differentiable (by simp)) t).hasDerivAt).deriv |
| 106 | have hfc : Continuous f := continuous_const.inner ha.continuous |
| 107 | have hgc : Continuous g := continuous_const.inner hb.continuous |
| 108 | have hfm : StrictMonoOn f (Icc (A - epsilon) A) := |
| 109 | strictMonoOn_of_deriv_pos (convex_Icc _ _) hfc.continuousOn |
| 110 | (fun t ht => by rw [hfd]; exact (hleft t (interior_subset ht)).1) |
| 111 | have hgm : StrictMonoOn g (Icc B (B + epsilon)) := |
| 112 | strictMonoOn_of_deriv_pos (convex_Icc _ _) hgc.continuousOn |
| 113 | (fun t ht => by rw [hgd]; exact (hright t (interior_subset ht)).1) |
| 114 | have hAmem : A ∈ Icc (A - epsilon) A := ⟨by linarith, le_rfl⟩ |
| 115 | have hBmem : B ∈ Icc B (B + epsilon) := ⟨le_rfl, by linarith⟩ |
| 116 | have hfg : f A = g B := congrArg (inner ℝ (deriv alpha A)) hend |
| 117 | refine ⟨epsilon, he, heeta, hleft, hright, ?_, ?_, ?_⟩ |
| 118 | · intro s hs t ht hst |
| 119 | exact hfm.injOn hs ht (congrArg (inner ℝ (deriv alpha A)) hst) |
| 120 | · intro s hs t ht hst |
| 121 | exact hgm.injOn hs ht (congrArg (inner ℝ (deriv alpha A)) hst) |
| 122 | · intro s hs t ht hst |
| 123 | have hval : f s = g t := congrArg (inner ℝ (deriv alpha A)) hst |
| 124 | have hle := hfm.monotoneOn hs hAmem hs.2 |
| 125 | have hle' := hgm.monotoneOn hBmem ht ht.1 |
| 126 | exact ⟨hfm.injOn hs hAmem (by linarith), hgm.injOn ht hBmem (by linarith)⟩ |
| 127 | |
| 128 | end PoincareMT |