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.InwardRay |
| 2 | |
| 3 | /-! |
| 4 | # The sign of an actual inward transverse chord |
| 5 | |
| 6 | The Jordan-side germ in normal coordinates is fixed by the actual positive |
| 7 | normal ray. Any other ray in the closed region has nonnegative inverse |
| 8 | height derivative; transversality makes its physical sign strictly positive. |
| 9 | |
| 10 | Morgan--Tian context: Proposition 19.35, printed pp. 467-481. These project |
| 11 | Jordan-region constructions supply the actual domains, boundary charts and finite |
| 12 | faces used in its regional Gauss--Bonnet arguments. |
| 13 | -/ |
| 14 | |
| 15 | noncomputable section |
| 16 | set_option autoImplicit false |
| 17 | set_option backward.isDefEq.respectTransparency false |
| 18 | |
| 19 | open Set Filter |
| 20 | open scoped Topology ContDiff |
| 21 | open Poincare.Topology.Plane.Curves |
| 22 | |
| 23 | namespace PoincareMT |
| 24 | |
| 25 | private theorem positive_normal_germ |
| 26 | {gamma : ℝ → AnnulusCoordinates} {T p : ℝ} |
| 27 | {U V : Set AnnulusCoordinates} (hU : IsOpen U) (hV : IsOpen V) |
| 28 | (hdisj : Disjoint U V) (hfU : frontier U = gamma '' Icc 0 T) |
| 29 | (hfV : frontier V = gamma '' Icc 0 T) (hp : p ∈ Icc (0 : ℝ) T) |
| 30 | (H : OpenPartialHomeomorph (ℝ × ℝ) AnnulusCoordinates) |
| 31 | (hps : (p, (0 : ℝ)) ∈ H.source) (hmap : ∀ q, H q = normalStrip gamma q) |
| 32 | (hline : ∀ q ∈ H.source, H q ∈ gamma '' Icc 0 T ↔ q.2 = 0) |
| 33 | (hray : ∀ᶠ r in 𝓝[>] (0 : ℝ), gamma p + r • quarterTurn (deriv gamma p) ∈ U) : |
| 34 | ∀ᶠ q in 𝓝 (p, (0 : ℝ)), H q ∈ closure U ↔ 0 ≤ q.2 := by |
| 35 | have hfront : H (p, 0) ∈ frontier U := by |
| 36 | rw [hmap, normalStrip_axis, hfU] |
| 37 | exact ⟨p, hp, rfl⟩ |
| 38 | have hline' : ∀ᶠ q in 𝓝 (p, (0 : ℝ)), H q ∈ frontier U ↔ q.2 = 0 := by |
| 39 | filter_upwards [H.open_source.mem_nhds hps] with q hq |
| 40 | simpa only [hfU] using hline q hq |
| 41 | rcases m64Intrinsic_jordan_product_line_germ hU hV hdisj (hfU.trans hfV.symm) |
| 42 | H hps hfront hline' with hpos | hneg |
| 43 | · exact hpos |
| 44 | · have hpath : Tendsto (fun r : ℝ => (p, r)) (𝓝 0) (𝓝 (p, (0 : ℝ))) := |
| 45 | continuous_const.prodMk continuous_id |>.tendsto 0 |
| 46 | have hneg' : ∀ᶠ r in 𝓝[>] (0 : ℝ), H (p, r) ∈ closure U ↔ r ≤ 0 := |
| 47 | (hpath.eventually hneg).filter_mono nhdsWithin_le_nhds |
| 48 | have hfalse : ∀ᶠ r in 𝓝[>] (0 : ℝ), False := by |
| 49 | filter_upwards [hray, hneg', self_mem_nhdsWithin] with r hrU hrside hrpos |
| 50 | have hrpos' : 0 < r := hrpos |
| 51 | have hcl : H (p, r) ∈ closure U := by |
| 52 | simpa only [hmap, normalStrip] using subset_closure hrU |
| 53 | exact hrpos'.not_ge (hrside.mp hcl) |
| 54 | obtain ⟨_, h⟩ := hfalse.exists |
| 55 | exact False.elim h |
| 56 | |
| 57 | /-- The actual closed-region placement determines the sign of every transverse ray. In |
| 58 | particular it determines the sign of a fitted cap chord. Source: |
| 59 | `proof-work/tasks/M64/derivations/2026-09-27-joined-orientation-and-attachments.md`, Section |
| 60 | 1. -/ |
| 61 | theorem m64Intrinsic_inward_ray_transverse_pos |
| 62 | {gamma : ℝ → AnnulusCoordinates} (hg : ContDiff ℝ ∞ gamma) {T p : ℝ} |
| 63 | (hend : gamma 0 = gamma T) (hinj : InjOn gamma (Ico 0 T)) |
| 64 | (hp : p ∈ Ioo (0 : ℝ) T) (hregular : deriv gamma p ≠ 0) |
| 65 | {U V : Set AnnulusCoordinates} (hU : IsOpen U) (hV : IsOpen V) |
| 66 | (hdisj : Disjoint U V) (hfU : frontier U = gamma '' Icc 0 T) |
| 67 | (hfV : frontier V = gamma '' Icc 0 T) |
| 68 | (hray : ∀ᶠ r in 𝓝[>] (0 : ℝ), gamma p + r • quarterTurn (deriv gamma p) ∈ U) |
| 69 | {w : AnnulusCoordinates} |
| 70 | (hw : inner ℝ (quarterTurn (deriv gamma p)) w ≠ 0) |
| 71 | (hwray : ∀ᶠ r in 𝓝[>] (0 : ℝ), gamma p + r • w ∈ closure U) : |
| 72 | 0 < inner ℝ (quarterTurn (deriv gamma p)) w := by |
| 73 | have hreg : ∀ t ∈ Icc p p, deriv gamma t ≠ 0 := by |
| 74 | intro t ht |
| 75 | have he : t = p := le_antisymm ht.2 ht.1 |
| 76 | simpa only [he] using hregular |
| 77 | obtain ⟨delta, hdelta, H, hsource, hmap, _, _, hline⟩ := |
| 78 | m64Intrinsic_exists_loop_normal_neighborhood hg hend hinj le_rfl hp.1 hp.2 hreg |
| 79 | have hps : (p, (0 : ℝ)) ∈ H.source := hsource ⟨by simp, ⟨by linarith, hdelta⟩⟩ |
| 80 | have hbase : H (p, 0) = gamma p := by rw [hmap, normalStrip_axis] |
| 81 | have hpt : gamma p ∈ H.target := hbase ▸ H.map_source hps |
| 82 | have hinverse : H.symm (gamma p) = (p, 0) := by rw [← hbase, H.left_inv hps] |
| 83 | have hside := positive_normal_germ hU hV hdisj hfU hfV ⟨hp.1.le, hp.2.le⟩ |
| 84 | H hps hmap hline hray |
| 85 | obtain ⟨L, hL, hd⟩ := exists_strictFDerivAt_normalStrip_axis hg hregular |
| 86 | have hHfun : (H : (ℝ × ℝ) → AnnulusCoordinates) = normalStrip gamma := funext hmap |
| 87 | have hHd : HasFDerivAt H (L : (ℝ × ℝ) →L[ℝ] AnnulusCoordinates) (p, 0) := by |
| 88 | rw [hHfun] |
| 89 | exact hd.hasFDerivAt |
| 90 | have hdi : HasFDerivAt H.symm (L.symm : AnnulusCoordinates →L[ℝ] (ℝ × ℝ)) |
| 91 | (gamma p) := H.hasFDerivAt_symm hpt (hinverse ▸ hHd) |
| 92 | have hrayderiv : HasDerivAt (fun r : ℝ => gamma p + r • w) w 0 := by |
| 93 | convert! (hasDerivAt_const (0 : ℝ) (gamma p)).add |
| 94 | ((hasDerivAt_id (0 : ℝ)).smul_const w) using 1 |
| 95 | simp |
| 96 | have hdi' : HasFDerivAt H.symm (L.symm : AnnulusCoordinates →L[ℝ] (ℝ × ℝ)) |
| 97 | (gamma p + (0 : ℝ) • w) := by simpa only [zero_smul, add_zero] using hdi |
| 98 | have hpath : HasDerivAt (fun r : ℝ => H.symm (gamma p + r • w)) (L.symm w) 0 := by |
| 99 | convert! hdi'.comp_hasDerivAt 0 hrayderiv using 1 |
| 100 | have hheightderiv : HasDerivAt (fun r : ℝ => (H.symm (gamma p + r • w)).2) |
| 101 | (L.symm w).2 0 := by |
| 102 | convert! hasFDerivAt_snd.comp_hasDerivAt 0 hpath using 1 |
| 103 | have hlim : Tendsto (fun r : ℝ => H.symm (gamma p + r • w)) (𝓝 0) (𝓝 (p, 0)) := by |
| 104 | simpa only [zero_smul, add_zero, hinverse] using hpath.continuousAt.tendsto |
| 105 | have htarget : ∀ᶠ r in 𝓝 (0 : ℝ), gamma p + r • w ∈ H.target := |
| 106 | hrayderiv.continuousAt.preimage_mem_nhds (by |
| 107 | simpa only [zero_smul, add_zero] using H.open_target.mem_nhds hpt) |
| 108 | have hheightnonneg : ∀ᶠ r in 𝓝[>] (0 : ℝ), 0 ≤ (H.symm (gamma p + r • w)).2 := by |
| 109 | filter_upwards [hwray, (hlim.eventually hside).filter_mono nhdsWithin_le_nhds, |
| 110 | htarget.filter_mono nhdsWithin_le_nhds] with r hr hrside hrtarget |
| 111 | apply hrside.mp |
| 112 | rwa [H.right_inv hrtarget] |
| 113 | have hnonneg : 0 ≤ (L.symm w).2 := by |
| 114 | apply ge_of_tendsto hheightderiv.tendsto_slope_zero_right |
| 115 | filter_upwards [hheightnonneg, self_mem_nhdsWithin] with r hr hrpos |
| 116 | have hrpos' : 0 < r := hrpos |
| 117 | simpa only [zero_add, zero_smul, add_zero, hinverse, sub_zero, smul_eq_mul] using |
| 118 | mul_nonneg (inv_nonneg.mpr hrpos'.le) hr |
| 119 | have horth : inner ℝ (quarterTurn (deriv gamma p)) (deriv gamma p) = 0 := by |
| 120 | rw [real_inner_comm] |
| 121 | exact inner_quarterTurn_self _ |
| 122 | have heq := congrArg (fun z => inner ℝ (quarterTurn (deriv gamma p)) z) (hL (L.symm w)) |
| 123 | rw [L.apply_symm_apply, inner_add_right, real_inner_smul_right, real_inner_smul_right, |
| 124 | horth, mul_zero, zero_add] at heq |
| 125 | have hnonneg' : 0 ≤ inner ℝ (quarterTurn (deriv gamma p)) w := by |
| 126 | rw [heq] |
| 127 | exact mul_nonneg hnonneg real_inner_self_nonneg |
| 128 | exact lt_of_le_of_ne hnonneg' (Ne.symm hw) |
| 129 | |
| 130 | end PoincareMT |