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.Ramp.Analysis.Periodic.SmoothApproximation |
| 2 | import Mathlib.Topology.Instances.Real.Lemmas |
| 3 | import Mathlib.Topology.Order.Compact |
| 4 | |
| 5 | /-! |
| 6 | # A smooth immersed reference with quantitative label margins |
| 7 | |
| 8 | The constants are chosen from the original periodic C2 curve before its |
| 9 | smooth approximation. No injectivity of the immersed image is used. |
| 10 | MT2007 Claim 19.1, p. 437; |
| 11 | `2026-09-22-uniqueness-smooth-periodic-reference.md`, statement 4. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | |
| 16 | open Set |
| 17 | open scoped ContDiff |
| 18 | |
| 19 | namespace PoincareMT.M63 |
| 20 | |
| 21 | /-- Every periodic C2 immersion has a smooth periodic reference satisfying |
| 22 | all quantitative footpoint guards, with strict initial half-margins. |
| 23 | MT2007 Claim 19.1, p. 437; smooth-periodic-reference derivation, |
| 24 | statement 4. The reference need not lie in a given embedded manifold. -/ |
| 25 | theorem exists_periodic_smooth_normalGraph_reference |
| 26 | {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [CompleteSpace E] |
| 27 | {P : ℝ} (hP : 0 < P) {c : ℝ → E} |
| 28 | (hc : ContDiff ℝ 2 c) (hp : Function.Periodic c P) |
| 29 | (himm : ∀ x, deriv c x ≠ 0) : |
| 30 | ∃ (r : ℝ → E) (m M B rho eps eta : ℝ), |
| 31 | ContDiff ℝ ∞ r ∧ Function.Periodic r P ∧ |
| 32 | 0 < m ∧ 0 < M ∧ 0 < B ∧ 0 < rho ∧ 0 < eps ∧ 0 < eta ∧ |
| 33 | (∀ x, m ≤ ‖deriv r x‖) ∧ (∀ x, ‖deriv r x‖ ≤ M) ∧ |
| 34 | (∀ x, ‖deriv (deriv r) x‖ ≤ B) ∧ |
| 35 | 2 * B * (eps + M * rho) ≤ m ^ 2 ∧ |
| 36 | 4 * eps * M ≤ m ^ 2 * rho ∧ |
| 37 | 2 * M * (eta + B * rho) ≤ m ^ 2 ∧ |
| 38 | (∀ x, ‖c x - r x‖ < eps / 2) ∧ |
| 39 | ∀ x, ‖deriv c x - deriv r x‖ < eta / 2 := by |
| 40 | have hc₁ : ContDiff ℝ 1 (deriv c) := hc.deriv' (n := 1) |
| 41 | have hp₁ := hp.deriv_of_differentiable (hc.differentiable (by norm_num)) |
| 42 | have hp₂ := hp₁.deriv_of_differentiable (hc₁.differentiable (by norm_num)) |
| 43 | have hK₁ := hp₁.compact_of_continuous hP.ne' hc₁.continuous |
| 44 | have hK₂ := hp₂.compact_of_continuous hP.ne' hc₁.continuous_deriv_one |
| 45 | obtain ⟨v, ⟨x₀, rfl⟩, hmin⟩ := hK₁.exists_isMinOn |
| 46 | (range_nonempty (deriv c)) continuous_norm.continuousOn |
| 47 | let m₀ := ‖deriv c x₀‖ |
| 48 | have hm₀ : 0 < m₀ := norm_pos_iff.mpr (himm x₀) |
| 49 | have hlower (x : ℝ) : m₀ ≤ ‖deriv c x‖ := hmin (mem_range_self x) |
| 50 | obtain ⟨M₀, hM₀bound⟩ := hK₁.exists_bound_of_continuousOn continuousOn_id |
| 51 | obtain ⟨B₀, hB₀bound⟩ := hK₂.exists_bound_of_continuousOn continuousOn_id |
| 52 | have hM₀ : 0 ≤ M₀ := (norm_nonneg (deriv c 0)).trans |
| 53 | (hM₀bound (deriv c 0) (mem_range_self 0)) |
| 54 | have hB₀ : 0 ≤ B₀ := (norm_nonneg (deriv (deriv c) 0)).trans |
| 55 | (hB₀bound (deriv (deriv c) 0) (mem_range_self 0)) |
| 56 | let m := m₀ / 2 |
| 57 | let M := M₀ + 1 |
| 58 | let B := B₀ + 1 |
| 59 | let rho := m ^ 2 / (8 * B * M) |
| 60 | let eps := min (m ^ 2 / (8 * B)) (m ^ 2 * rho / (8 * M)) |
| 61 | let eta := m ^ 2 / (8 * M) |
| 62 | have hm : 0 < m := half_pos hm₀ |
| 63 | have hM : 0 < M := by dsimp only [M]; linarith |
| 64 | have hB : 0 < B := by dsimp only [B]; linarith |
| 65 | have hrho : 0 < rho := by dsimp only [rho]; positivity |
| 66 | have heps : 0 < eps := by dsimp only [eps]; positivity |
| 67 | have heta : 0 < eta := by dsimp only [eta]; positivity |
| 68 | have hMrho : M * rho = m ^ 2 / (8 * B) := by |
| 69 | dsimp only [rho] |
| 70 | field_simp |
| 71 | have hBrho : B * rho = m ^ 2 / (8 * M) := by |
| 72 | dsimp only [rho] |
| 73 | field_simp |
| 74 | have hsmall : 2 * B * (eps + M * rho) ≤ m ^ 2 := by |
| 75 | calc |
| 76 | 2 * B * (eps + M * rho) ≤ |
| 77 | 2 * B * (m ^ 2 / (8 * B) + m ^ 2 / (8 * B)) := |
| 78 | mul_le_mul_of_nonneg_left |
| 79 | (add_le_add (min_le_left _ _) hMrho.le) (by positivity) |
| 80 | _ = m ^ 2 / 2 := by field_simp; ring |
| 81 | _ ≤ m ^ 2 := by nlinarith [sq_nonneg m] |
| 82 | have hmargin : 4 * eps * M ≤ m ^ 2 * rho := by |
| 83 | calc |
| 84 | 4 * eps * M ≤ 4 * (m ^ 2 * rho / (8 * M)) * M := |
| 85 | mul_le_mul_of_nonneg_right |
| 86 | (mul_le_mul_of_nonneg_left (min_le_right _ _) (by norm_num)) hM.le |
| 87 | _ = m ^ 2 * rho / 2 := by field_simp; ring |
| 88 | _ ≤ m ^ 2 * rho := by nlinarith [mul_nonneg (sq_nonneg m) hrho.le] |
| 89 | have htrans : 2 * M * (eta + B * rho) ≤ m ^ 2 := by |
| 90 | rw [hBrho] |
| 91 | change 2 * M * (m ^ 2 / (8 * M) + m ^ 2 / (8 * M)) ≤ m ^ 2 |
| 92 | have heq : 2 * M * (m ^ 2 / (8 * M) + m ^ 2 / (8 * M)) = m ^ 2 / 2 := by |
| 93 | field_simp |
| 94 | ring |
| 95 | rw [heq] |
| 96 | nlinarith [sq_nonneg m] |
| 97 | let tol := min (eps / 2) (min (eta / 2) (min (m₀ / 2) (1 / 2))) |
| 98 | have htol : 0 < tol := by dsimp only [tol]; positivity |
| 99 | have htol_eps : tol ≤ eps / 2 := min_le_left _ _ |
| 100 | have htol_eta : tol ≤ eta / 2 := (min_le_right _ _).trans (min_le_left _ _) |
| 101 | have htol_m : tol ≤ m₀ / 2 := |
| 102 | (min_le_right _ _).trans ((min_le_right _ _).trans (min_le_left _ _)) |
| 103 | have htol_one : tol ≤ 1 / 2 := |
| 104 | (min_le_right _ _).trans ((min_le_right _ _).trans (min_le_right _ _)) |
| 105 | obtain ⟨r, hr, hrper, happ⟩ := exists_periodic_smooth_C2_approximation hP hc hp htol |
| 106 | refine ⟨r, m, M, B, rho, eps, eta, hr, hrper, hm, hM, hB, hrho, heps, heta, |
| 107 | ?_, ?_, ?_, hsmall, hmargin, htrans, ?_, ?_⟩ |
| 108 | · intro x |
| 109 | have hdiff := (happ x).2.1.trans_le htol_m |
| 110 | have hreverse := norm_sub_norm_le (deriv c x) (deriv r x) |
| 111 | rw [norm_sub_rev] at hreverse |
| 112 | have hlow := hlower x |
| 113 | dsimp only [m] |
| 114 | linarith |
| 115 | · intro x |
| 116 | have hdiff := (happ x).2.1.trans_le htol_one |
| 117 | have hbound : ‖deriv c x‖ ≤ M₀ := hM₀bound (deriv c x) (mem_range_self x) |
| 118 | have htriangle := norm_add_le (deriv r x - deriv c x) (deriv c x) |
| 119 | rw [sub_add_cancel] at htriangle |
| 120 | dsimp only [M] |
| 121 | linarith |
| 122 | · intro x |
| 123 | have hdiff := (happ x).2.2.trans_le htol_one |
| 124 | have hbound : ‖deriv (deriv c) x‖ ≤ B₀ := |
| 125 | hB₀bound (deriv (deriv c) x) (mem_range_self x) |
| 126 | have htriangle := norm_add_le |
| 127 | (deriv (deriv r) x - deriv (deriv c) x) (deriv (deriv c) x) |
| 128 | rw [sub_add_cancel] at htriangle |
| 129 | dsimp only [B] |
| 130 | linarith |
| 131 | · intro x |
| 132 | rw [norm_sub_rev] |
| 133 | exact (happ x).1.trans_le htol_eps |
| 134 | · intro x |
| 135 | rw [norm_sub_rev] |
| 136 | exact (happ x).2.1.trans_le htol_eta |
| 137 | |
| 138 | end PoincareMT.M63 |