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.Boundary.Normal |
| 2 | import Mathlib.Analysis.Calculus.Deriv.MeanValue |
| 3 | import Mathlib.Analysis.Calculus.ContDiff.RCLike |
| 4 | |
| 5 | /-! A two-sided local collar for the actual normal map. |
| 6 | Source: MT Lemma 19.53, p. 478; local-inverse-self-return derivation, |
| 7 | Section 3. Negative times are separated from the annulus by their norm. -/ |
| 8 | |
| 9 | noncomputable section |
| 10 | set_option autoImplicit false |
| 11 | set_option backward.isDefEq.respectTransparency false |
| 12 | |
| 13 | open Set Metric |
| 14 | open scoped Topology ContDiff Matrix |
| 15 | |
| 16 | namespace PoincareMT |
| 17 | |
| 18 | /-- Inside any prescribed source neighborhood, the inward normal map has a local rectangle |
| 19 | whose negative times have norm below one and whose positive times lie in the open annulus. |
| 20 | The radius may depend on the label and is not used in the uniform area cutoff. Source: |
| 21 | local-inverse-self-return derivation, Section 3. Source/construction: |
| 22 | proof-work/tasks/M64/derivations/2026-09-27-local-inverse-self-return.md, Section 3. -/ |
| 23 | theorem m64Intrinsic_exists_signed_normal_collar |
| 24 | {e : AnnulusCoordinates → AnnulusCoordinates} (he : ContDiff ℝ ∞ e) |
| 25 | (hbase : ∀ p, e !₂[p, 0] = intrinsicAnnulusBoundary 1 p) |
| 26 | {a : ℝ} (hinward : 0 < inner ℝ (intrinsicAnnulusBoundary 1 a) |
| 27 | (deriv (fun t => e !₂[a, t]) 0)) |
| 28 | {O : Set AnnulusCoordinates} (hO : IsOpen O) (haO : !₂[a, 0] ∈ O) : |
| 29 | ∃ epsilon > (0 : ℝ), ∃ W : Set ℝ, IsOpen W ∧ a ∈ W ∧ |
| 30 | ∀ p ∈ W, ∀ t ∈ Icc (-epsilon) epsilon, |
| 31 | !₂[p, t] ∈ O ∧ ‖e !₂[p, t]‖ < 2 ∧ |
| 32 | (t < 0 → ‖e !₂[p, t]‖ < 1) ∧ (0 < t → 1 < ‖e !₂[p, t]‖) := by |
| 33 | let u : ℝ × ℝ → AnnulusCoordinates := fun z => e !₂[z.1, z.2] |
| 34 | have hpair : ContDiff ℝ ∞ (fun z : ℝ × ℝ => (!₂[z.1, z.2] : AnnulusCoordinates)) := by |
| 35 | apply (contDiff_piLp 2).mpr |
| 36 | intro i |
| 37 | fin_cases i |
| 38 | · exact contDiff_fst |
| 39 | · exact contDiff_snd |
| 40 | have hu : ContDiff ℝ ∞ u := he.comp hpair |
| 41 | let f : ℝ × ℝ → ℝ := fun z => ‖u z‖ ^ 2 |
| 42 | have hf : ContDiff ℝ ∞ f := (contDiff_norm_sq ℝ).comp hu |
| 43 | let D : ℝ × ℝ → ℝ := fun z => fderiv ℝ f z (0, 1) |
| 44 | have hD : Continuous D := (hf.continuous_fderiv (by simp)).clm_apply continuous_const |
| 45 | have hd (p t : ℝ) : HasDerivAt (fun s => f (p, s)) (D (p, t)) t := |
| 46 | (hf.differentiable (by simp) (p, t)).hasFDerivAt.comp_hasDerivAt t |
| 47 | ((hasDerivAt_const t p).prodMk (hasDerivAt_id t)) |
| 48 | have hnormal : ContDiff ℝ ∞ (fun t => u (a, t)) := hu.comp (by fun_prop) |
| 49 | have hD0 : 0 < D (a, 0) := by |
| 50 | have heq := (hd a 0).unique ((hnormal.differentiable (by simp) 0).hasDerivAt.norm_sq) |
| 51 | rw [heq] |
| 52 | change 0 < 2 * inner ℝ (e !₂[a, 0]) (deriv (fun t => e !₂[a, t]) 0) |
| 53 | rw [hbase] |
| 54 | exact mul_pos (by norm_num) hinward |
| 55 | let V : Set (ℝ × ℝ) := |
| 56 | {z | !₂[z.1, z.2] ∈ O} ∩ {z | 0 < D z} ∩ {z | ‖u z‖ < 2} |
| 57 | have hV : IsOpen V := |
| 58 | ((hO.preimage hpair.continuous).inter (isOpen_lt continuous_const hD)).inter |
| 59 | (isOpen_lt hu.continuous.norm continuous_const) |
| 60 | have haV : (a, 0) ∈ V := by |
| 61 | refine ⟨⟨haO, hD0⟩, ?_⟩ |
| 62 | change ‖e !₂[a, 0]‖ < 2 |
| 63 | rw [hbase] |
| 64 | have hn := m64Intrinsic_boundary_self_inner 1 a |
| 65 | rw [real_inner_self_eq_norm_sq] at hn |
| 66 | nlinarith [norm_nonneg (intrinsicAnnulusBoundary 1 a)] |
| 67 | obtain ⟨d, hdpos, hball⟩ := Metric.isOpen_iff.mp hV (a, 0) haV |
| 68 | have hhalf : 0 < d / 2 := by positivity |
| 69 | have hrectangle (p : ℝ) (hp : p ∈ ball a (d / 2)) |
| 70 | (t : ℝ) (ht : t ∈ Icc (-(d / 2)) (d / 2)) : (p, t) ∈ V := by |
| 71 | apply hball |
| 72 | simp only [mem_ball, Prod.dist_eq, dist_zero_right, Real.norm_eq_abs] |
| 73 | exact max_lt ((mem_ball.mp hp).trans (by linarith only [hdpos])) |
| 74 | ((abs_le.mpr ht).trans_lt (by linarith only [hdpos])) |
| 75 | refine ⟨d / 2, hhalf, ball a (d / 2), isOpen_ball, mem_ball_self hhalf, ?_⟩ |
| 76 | intro p hp t ht |
| 77 | have hhere := hrectangle p hp t ht |
| 78 | have hmono : StrictMonoOn (fun s => f (p, s)) (Icc (-(d / 2)) (d / 2)) := by |
| 79 | apply strictMonoOn_of_deriv_pos (convex_Icc _ _) |
| 80 | (hf.continuous.comp (continuous_const.prodMk continuous_id)).continuousOn |
| 81 | intro s hs |
| 82 | change 0 < deriv (fun t => f (p, t)) s |
| 83 | rw [(hd p s).deriv] |
| 84 | exact (hrectangle p hp s (interior_subset hs)).1.2 |
| 85 | have hz : (0 : ℝ) ∈ Icc (-(d / 2)) (d / 2) := ⟨by linarith, hhalf.le⟩ |
| 86 | have hzero : f (p, 0) = 1 := by |
| 87 | change ‖e !₂[p, 0]‖ ^ 2 = 1 |
| 88 | rw [hbase] |
| 89 | have hn := m64Intrinsic_boundary_self_inner 1 p |
| 90 | simpa only [real_inner_self_eq_norm_sq, one_pow] using hn |
| 91 | refine ⟨hhere.1.1, hhere.2, ?_, ?_⟩ |
| 92 | · intro htneg |
| 93 | have h := hmono ht hz htneg |
| 94 | change f (p, t) < f (p, 0) at h |
| 95 | rw [hzero] at h |
| 96 | change ‖e !₂[p, t]‖ ^ 2 < 1 at h |
| 97 | nlinarith [norm_nonneg (e !₂[p, t])] |
| 98 | · intro htpos |
| 99 | have h := hmono hz ht htpos |
| 100 | change f (p, 0) < f (p, t) at h |
| 101 | rw [hzero] at h |
| 102 | change 1 < ‖e !₂[p, t]‖ ^ 2 at h |
| 103 | nlinarith [norm_nonneg (e !₂[p, t])] |
| 104 | |
| 105 | end PoincareMT |