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 Mathlib.Analysis.Calculus.ContDiff.Deriv |
| 2 | import Mathlib.Analysis.Calculus.Deriv.Slope |
| 3 | import Mathlib.Analysis.Real.Pi.Bounds |
| 4 | import Mathlib.Analysis.SpecialFunctions.SmoothTransition |
| 5 | import Mathlib.Analysis.SpecialFunctions.Integrals.Basic |
| 6 | import Mathlib.MeasureTheory.Integral.DominatedConvergence |
| 7 | import Mathlib.MeasureTheory.Integral.IntervalIntegral.FundThmCalculus |
| 8 | |
| 9 | /-! |
| 10 | # A smooth radial profile for the initial cap |
| 11 | |
| 12 | The profile in Morgan-Tian Lemma 12.2, printed pp. 293-295, is constructed |
| 13 | here in meridian arclength by cutting off the round-sphere slope. The |
| 14 | geometric change from arclength to the book's axial graph coordinate is |
| 15 | derived in `proof-work/tasks/M34/derivations/radial-profile.md`. |
| 16 | -/ |
| 17 | |
| 18 | set_option autoImplicit false |
| 19 | |
| 20 | open Set MeasureTheory |
| 21 | open scoped ContDiff Topology |
| 22 | |
| 23 | namespace PoincareMT.M34 |
| 24 | |
| 25 | /-- The decreasing smooth cutoff for Lemma 12.2, pp. 294-295. -/ |
| 26 | noncomputable def capCutoff (s : ℝ) : ℝ := 1 - Real.smoothTransition (2 * s) |
| 27 | |
| 28 | /-- Smoothness of the cutoff in Lemma 12.2, pp. 294-295. -/ |
| 29 | theorem capCutoff_contDiff : ContDiff ℝ ∞ capCutoff := by |
| 30 | unfold capCutoff |
| 31 | fun_prop |
| 32 | |
| 33 | /-- The cutoff is nonnegative, as required in Lemma 12.2, p. 295. -/ |
| 34 | theorem capCutoff_nonneg (s : ℝ) : 0 ≤ capCutoff s := |
| 35 | sub_nonneg.mpr (Real.smoothTransition.le_one _) |
| 36 | |
| 37 | /-- The cutoff is at most one (Lemma 12.2, p. 295). -/ |
| 38 | theorem capCutoff_le_one (s : ℝ) : capCutoff s ≤ 1 := |
| 39 | sub_le_self _ (Real.smoothTransition.nonneg _) |
| 40 | |
| 41 | /-- The cutoff leaves the round tip unchanged (Lemma 12.2, p. 295). -/ |
| 42 | theorem capCutoff_eq_one {s : ℝ} (hs : s ≤ 0) : capCutoff s = 1 := by |
| 43 | rw [capCutoff, Real.smoothTransition.zero_of_nonpos (by linarith), sub_zero] |
| 44 | |
| 45 | /-- The cutoff vanishes past half a unit (Lemma 12.2, p. 295). -/ |
| 46 | theorem capCutoff_eq_zero {s : ℝ} (hs : 1 / 2 ≤ s) : capCutoff s = 0 := by |
| 47 | rw [capCutoff, Real.smoothTransition.one_of_one_le (by linarith), sub_self] |
| 48 | |
| 49 | /-- The explicit cutoff is positive before its terminal plateau |
| 50 | (Lemma 12.2, p. 295). -/ |
| 51 | theorem capCutoff_pos {s : ℝ} (hs : s < 1 / 2) : 0 < capCutoff s := |
| 52 | sub_pos.mpr (Real.smoothTransition.lt_one_of_lt_one (by linarith)) |
| 53 | |
| 54 | /-- Monotonicity needed to preserve concavity in Lemma 12.2, p. 295. -/ |
| 55 | theorem capCutoff_antitone : Antitone capCutoff := by |
| 56 | intro s t hst |
| 57 | exact sub_le_sub_left (Real.smoothTransition.monotone (by linarith)) 1 |
| 58 | |
| 59 | /-- The radial slope of the round sphere with its distant part cut off; |
| 60 | see Lemma 12.2, pp. 294-295, and the radial-profile derivation. -/ |
| 61 | noncomputable def capSlope (a r : ℝ) : ℝ := Real.cos (r / 2) * capCutoff (r - a) |
| 62 | |
| 63 | /-- Joint smoothness of the radial slope and cutoff translation |
| 64 | (Lemma 12.2, p. 295). -/ |
| 65 | theorem capSlope_contDiff : ContDiff ℝ ∞ (fun p : ℝ × ℝ => capSlope p.1 p.2) := by |
| 66 | unfold capSlope capCutoff |
| 67 | fun_prop |
| 68 | |
| 69 | /-- Smoothness at a fixed translation (Lemma 12.2, p. 295). -/ |
| 70 | theorem capSlope_contDiff_right (a : ℝ) : ContDiff ℝ ∞ (capSlope a) := by |
| 71 | unfold capSlope capCutoff |
| 72 | fun_prop |
| 73 | |
| 74 | /-- The radial slope vanishes on the cylindrical part (Lemma 12.2, p. 295). -/ |
| 75 | theorem capSlope_eq_zero {a r : ℝ} (hr : a + 1 / 2 ≤ r) : capSlope a r = 0 := by |
| 76 | rw [capSlope, capCutoff_eq_zero (by linarith), mul_zero] |
| 77 | |
| 78 | /-- Before the cutoff the slope is exactly that of the radius-two sphere |
| 79 | (Lemma 12.2, pp. 294-295). -/ |
| 80 | theorem capSlope_eq_cos {a r : ℝ} (hr : r ≤ a) : capSlope a r = Real.cos (r / 2) := by |
| 81 | rw [capSlope, capCutoff_eq_one (sub_nonpos.mpr hr), mul_one] |
| 82 | |
| 83 | /-- The cutoff acts before the cosine can change sign |
| 84 | (Lemma 12.2, pp. 294-295, in radial arclength). -/ |
| 85 | theorem capSlope_nonneg {a r : ℝ} (ha : a ≤ Real.pi / 2) (hr : 0 ≤ r) : |
| 86 | 0 ≤ capSlope a r := by |
| 87 | by_cases h : a + 1 / 2 ≤ r |
| 88 | · rw [capSlope_eq_zero h] |
| 89 | · have hrpi : r < Real.pi := by linarith [Real.pi_gt_three] |
| 90 | exact mul_nonneg (Real.cos_nonneg_of_mem_Icc (by constructor <;> linarith [Real.pi_pos])) |
| 91 | (capCutoff_nonneg _) |
| 92 | |
| 93 | /-- The radial speed never exceeds one (Lemma 12.2, pp. 294-295). -/ |
| 94 | theorem capSlope_le_one (a r : ℝ) : capSlope a r ≤ 1 := by |
| 95 | calc |
| 96 | capSlope a r ≤ 1 * capCutoff (r - a) := |
| 97 | mul_le_mul_of_nonneg_right (Real.cos_le_one _) (capCutoff_nonneg _) |
| 98 | _ ≤ 1 := by simpa only [one_mul] using capCutoff_le_one (r - a) |
| 99 | |
| 100 | /-- The radial slope is nonincreasing on the geometric half-line, |
| 101 | giving a concave profile (Lemma 12.2, pp. 294-295). -/ |
| 102 | theorem capSlope_antitoneOn {a : ℝ} (ha : a ≤ Real.pi / 2) : |
| 103 | AntitoneOn (capSlope a) (Ici 0) := by |
| 104 | intro r hr s hs hrs |
| 105 | change 0 ≤ r at hr |
| 106 | change 0 ≤ s at hs |
| 107 | by_cases h : a + 1 / 2 ≤ s |
| 108 | · rw [capSlope_eq_zero h] |
| 109 | exact capSlope_nonneg ha hr |
| 110 | · have hspi : s < Real.pi := by linarith [Real.pi_gt_three] |
| 111 | apply mul_le_mul |
| 112 | · exact Real.antitoneOn_cos (by constructor <;> linarith) |
| 113 | (by constructor <;> linarith) (by linarith) |
| 114 | · exact capCutoff_antitone (sub_le_sub_right hrs _) |
| 115 | · exact capCutoff_nonneg _ |
| 116 | · exact Real.cos_nonneg_of_mem_Icc (by constructor <;> linarith [Real.pi_pos]) |
| 117 | |
| 118 | /-- Integrating the slope gives the radial warping function used in |
| 119 | Lemma 12.2, pp. 294-295. The integral has no singular endpoint. -/ |
| 120 | noncomputable def capProfile (a r : ℝ) : ℝ := ∫ s in 0..r, capSlope a s |
| 121 | |
| 122 | /-- The radial profile has the prescribed slope (Lemma 12.2, p. 295). -/ |
| 123 | theorem capProfile_hasDerivAt (a r : ℝ) : HasDerivAt (capProfile a) (capSlope a r) r := by |
| 124 | have hc := (capSlope_contDiff_right a).continuous |
| 125 | exact intervalIntegral.integral_hasDerivAt_right (hc.intervalIntegrable _ _) |
| 126 | (hc.stronglyMeasurable.stronglyMeasurableAtFilter) hc.continuousAt |
| 127 | |
| 128 | /-- The classical derivative agrees with the prescribed smooth slope |
| 129 | (Lemma 12.2, p. 295). -/ |
| 130 | theorem capProfile_deriv (a : ℝ) : deriv (capProfile a) = capSlope a := by |
| 131 | funext r |
| 132 | exact (capProfile_hasDerivAt a r).deriv |
| 133 | |
| 134 | /-- The radial profile is smooth, including at radius zero |
| 135 | (Lemma 12.2, pp. 294-295). -/ |
| 136 | theorem capProfile_contDiff (a : ℝ) : ContDiff ℝ ∞ (capProfile a) := by |
| 137 | apply contDiff_infty_iff_deriv.mpr |
| 138 | refine ⟨fun r => (capProfile_hasDerivAt a r).differentiableAt, ?_⟩ |
| 139 | rw [capProfile_deriv] |
| 140 | exact capSlope_contDiff_right a |
| 141 | |
| 142 | /-- The profile vanishes at the tip (Lemma 12.2, p. 294). -/ |
| 143 | theorem capProfile_zero (a : ℝ) : capProfile a 0 = 0 := by |
| 144 | simp [capProfile] |
| 145 | |
| 146 | /-- Continuity of the plateau height in the cutoff translation, for the |
| 147 | intermediate-value argument of Lemma 12.2, p. 295. -/ |
| 148 | theorem capProfile_continuous_parameter (r : ℝ) : Continuous (fun a => capProfile a r) := |
| 149 | intervalIntegral.continuous_parametric_intervalIntegral_of_continuous' |
| 150 | capSlope_contDiff.continuous 0 r |
| 151 | |
| 152 | end PoincareMT.M34 |