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 | import Mathlib.Analysis.Calculus.Deriv.Slope |
| 3 | |
| 4 | /-! |
| 5 | # Positive transverse physical rays enter the actual region |
| 6 | |
| 7 | The inverse of the constructed normal collar has positive height derivative |
| 8 | along every positive transverse ray. The derivative limit and continuity |
| 9 | place the ray inside the occupied half-collar. |
| 10 | |
| 11 | Morgan--Tian context: Proposition 19.35, printed pp. 467-481. These project |
| 12 | Jordan-region constructions supply the actual domains, boundary charts and finite |
| 13 | faces used in its regional Gauss--Bonnet arguments. |
| 14 | -/ |
| 15 | |
| 16 | noncomputable section |
| 17 | set_option autoImplicit false |
| 18 | set_option backward.isDefEq.respectTransparency false |
| 19 | |
| 20 | open Set Filter |
| 21 | open scoped Topology ContDiff |
| 22 | open Poincare.Topology.Plane.Curves |
| 23 | |
| 24 | namespace PoincareMT |
| 25 | |
| 26 | private theorem eventually_positive_of_derivative |
| 27 | {f : ℝ → ℝ} {v : ℝ} (hf : HasDerivAt f v 0) (hzero : f 0 = 0) (hv : 0 < v) : |
| 28 | ∀ᶠ r in 𝓝[>] (0 : ℝ), 0 < f r := by |
| 29 | have hs := hf.tendsto_slope_zero_right.eventually_const_lt hv |
| 30 | filter_upwards [hs, self_mem_nhdsWithin] with r hr hrpos |
| 31 | have hrpos' : 0 < r := hrpos |
| 32 | simp only [zero_add, hzero, sub_zero, smul_eq_mul] at hr |
| 33 | exact (mul_pos_iff_of_pos_left (inv_pos.mpr hrpos')).mp hr |
| 34 | |
| 35 | /-- Actual positive transverse directions enter the Jordan region fixed by the constructed |
| 36 | normal orientation. This supplies the inward ray for straight corner-chord cuts. Source: |
| 37 | `proof-work/tasks/M64/derivations/2026-09-27-joined-orientation-and-attachments.md`, Section |
| 38 | 1. -/ |
| 39 | theorem m64Intrinsic_transverse_ray_enters_region |
| 40 | {gamma : ℝ → AnnulusCoordinates} (hg : ContDiff ℝ ∞ gamma) {T p : ℝ} |
| 41 | (hend : gamma 0 = gamma T) (hinj : InjOn gamma (Ico 0 T)) |
| 42 | (hregular : ∀ t ∈ Ioo (0 : ℝ) T, deriv gamma t ≠ 0) |
| 43 | {U : Set AnnulusCoordinates} (hU : IsOpen U) |
| 44 | (hfront : frontier U = gamma '' Icc 0 T) |
| 45 | (hray : ∀ t ∈ Ioo (0 : ℝ) T, ∀ᶠ r in 𝓝[>] (0 : ℝ), |
| 46 | gamma t + r • quarterTurn (deriv gamma t) ∈ U) |
| 47 | (hp : p ∈ Ioo (0 : ℝ) T) {w : AnnulusCoordinates} |
| 48 | (hw : 0 < inner ℝ (quarterTurn (deriv gamma p)) w) : |
| 49 | ∀ᶠ r in 𝓝[>] (0 : ℝ), gamma p + r • w ∈ U := by |
| 50 | let a := p / 2 |
| 51 | let b := (p + T) / 2 |
| 52 | have ha : 0 < a := half_pos hp.1 |
| 53 | have hap : a < p := half_lt_self hp.1 |
| 54 | have hpb : p < b := by dsimp [b]; linarith [hp.2] |
| 55 | have hb : b < T := by dsimp [b]; linarith [hp.2] |
| 56 | have hab : a ≤ b := (hap.trans hpb).le |
| 57 | have haT : a < T := hap.trans hp.2 |
| 58 | obtain ⟨delta, hdelta, H, hmap, _, _, hcollar⟩ := |
| 59 | m64Intrinsic_exists_positive_loop_collar hg hend hinj hab ha hb |
| 60 | (fun t ht => hregular t ⟨ha.trans_le ht.1, ht.2.trans_lt hb⟩) |
| 61 | hU hfront (hray a ⟨ha, haT⟩) |
| 62 | have hpab : p ∈ Icc a b := ⟨hap.le, hpb.le⟩ |
| 63 | have hps : (p, (0 : ℝ)) ∈ H.source := (hcollar p hpab 0 ⟨le_rfl, hdelta.le⟩).1 |
| 64 | have hbase : H (p, 0) = gamma p := by rw [hmap, normalStrip_axis] |
| 65 | have hpt : gamma p ∈ H.target := hbase ▸ H.map_source hps |
| 66 | have hinverse : H.symm (gamma p) = (p, 0) := by rw [← hbase, H.left_inv hps] |
| 67 | obtain ⟨L, hL, hd⟩ := exists_strictFDerivAt_normalStrip_axis hg (hregular p hp) |
| 68 | have hHfun : (H : (ℝ × ℝ) → AnnulusCoordinates) = normalStrip gamma := funext hmap |
| 69 | have hHd : HasFDerivAt H (L : (ℝ × ℝ) →L[ℝ] AnnulusCoordinates) (p, 0) := by |
| 70 | rw [hHfun] |
| 71 | exact hd.hasFDerivAt |
| 72 | have hdi : HasFDerivAt H.symm (L.symm : AnnulusCoordinates →L[ℝ] (ℝ × ℝ)) |
| 73 | (gamma p) := H.hasFDerivAt_symm hpt (hinverse ▸ hHd) |
| 74 | have hrayderiv : HasDerivAt (fun r : ℝ => gamma p + r • w) w 0 := by |
| 75 | convert! (hasDerivAt_const (0 : ℝ) (gamma p)).add |
| 76 | ((hasDerivAt_id (0 : ℝ)).smul_const w) using 1 |
| 77 | simp |
| 78 | have hdi' : HasFDerivAt H.symm (L.symm : AnnulusCoordinates →L[ℝ] (ℝ × ℝ)) |
| 79 | (gamma p + (0 : ℝ) • w) := by simpa only [zero_smul, add_zero] using hdi |
| 80 | have hpath : HasDerivAt (fun r : ℝ => H.symm (gamma p + r • w)) (L.symm w) 0 := by |
| 81 | convert! hdi'.comp_hasDerivAt 0 hrayderiv using 1 |
| 82 | have hnormal : quarterTurn (deriv gamma p) ≠ 0 := by |
| 83 | intro hn |
| 84 | simp only [hn, inner_zero_left] at hw |
| 85 | exact (lt_irrefl 0) hw |
| 86 | have hheight : 0 < (L.symm w).2 := by |
| 87 | have horth : inner ℝ (quarterTurn (deriv gamma p)) (deriv gamma p) = 0 := by |
| 88 | rw [real_inner_comm] |
| 89 | exact inner_quarterTurn_self _ |
| 90 | have heq := congrArg (fun z => inner ℝ (quarterTurn (deriv gamma p)) z) |
| 91 | (hL (L.symm w)) |
| 92 | rw [L.apply_symm_apply, inner_add_right, real_inner_smul_right, |
| 93 | real_inner_smul_right, horth, mul_zero, zero_add] at heq |
| 94 | exact (mul_pos_iff_of_pos_right (real_inner_self_pos.mpr hnormal)).mp (heq ▸ hw) |
| 95 | have hheightderiv : HasDerivAt (fun r : ℝ => (H.symm (gamma p + r • w)).2) |
| 96 | (L.symm w).2 0 := by |
| 97 | convert! hasFDerivAt_snd.comp_hasDerivAt 0 hpath using 1 |
| 98 | have hheightzero : (H.symm (gamma p + (0 : ℝ) • w)).2 = 0 := by |
| 99 | simp only [zero_smul, add_zero, hinverse] |
| 100 | have hpos := eventually_positive_of_derivative hheightderiv hheightzero hheight |
| 101 | have hnear : ∀ᶠ r in 𝓝 (0 : ℝ), |
| 102 | H.symm (gamma p + r • w) ∈ Ioo a b ×ˢ Ioo (-delta) delta := by |
| 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 hnhds : Ioo a b ×ˢ Ioo (-delta) delta ∈ 𝓝 (p, (0 : ℝ)) := |
| 106 | (isOpen_Ioo.prod isOpen_Ioo).mem_nhds ⟨⟨hap, hpb⟩, ⟨by linarith, hdelta⟩⟩ |
| 107 | exact hlim.eventually hnhds |
| 108 | have htarget : ∀ᶠ r in 𝓝 (0 : ℝ), gamma p + r • w ∈ H.target := |
| 109 | hrayderiv.continuousAt.preimage_mem_nhds (by |
| 110 | simpa only [zero_smul, add_zero] using H.open_target.mem_nhds hpt) |
| 111 | filter_upwards [hpos, hnear.filter_mono nhdsWithin_le_nhds, |
| 112 | htarget.filter_mono nhdsWithin_le_nhds] with r hrpos hrnear hrtarget |
| 113 | have h := (hcollar (H.symm (gamma p + r • w)).1 ⟨hrnear.1.1.le, hrnear.1.2.le⟩ |
| 114 | (H.symm (gamma p + r • w)).2 ⟨hrpos.le, hrnear.2.2.le⟩).2.2 hrpos |
| 115 | simpa only [Prod.eta, H.right_inv hrtarget] using h |
| 116 | |
| 117 | end PoincareMT |