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.RicciFlow.ReducedGeometry.LGeometry.Minimization.WeakEnergy |
| 2 | import Mathlib.MeasureTheory.Function.L2Space |
| 3 | import Mathlib.MeasureTheory.Integral.IntervalIntegral.FundThmCalculus |
| 4 | import Mathlib.MeasureTheory.Integral.IntervalIntegral.LebesgueDifferentiationThm |
| 5 | import Mathlib.MeasureTheory.Measure.SeparableMeasure |
| 6 | import Mathlib.Analysis.Normed.Lp.SmoothApprox |
| 7 | import Mathlib.Analysis.Calculus.ContDiff.Deriv |
| 8 | |
| 9 | /-! Adapted from Mapher `PoincareMT/Proofs/M08/ChartPrimitive.lean` at |
| 10 | `f927d9e1f0810042766d3b5f64d3f4da02ee93cc`. -/ |
| 11 | |
| 12 | |
| 13 | /-! |
| 14 | # Primitive identification for chart limits |
| 15 | |
| 16 | The continuous curve limit and the weak velocity limit represent the same |
| 17 | path. Indicator tests retain the endpoint values without endpoint derivatives. |
| 18 | -/ |
| 19 | |
| 20 | set_option autoImplicit false |
| 21 | set_option backward.isDefEq.respectTransparency false |
| 22 | |
| 23 | open MeasureTheory Set Filter Topology |
| 24 | open scoped intervalIntegral ContDiff |
| 25 | |
| 26 | namespace PoincareMT.LGeometry |
| 27 | |
| 28 | /-- One subsequence works for every chart in a finite subdivision. -/ |
| 29 | theorem exists_finite_weak_subsequence {ι : Type*} [Fintype ι] {H : ι → Type*} |
| 30 | [∀ i, NormedAddCommGroup (H i)] [∀ i, InnerProductSpace ℝ (H i)] |
| 31 | [∀ i, CompleteSpace (H i)] [∀ i, TopologicalSpace.SeparableSpace (H i)] |
| 32 | (v : ∀ i, ℕ → H i) (C : ι → ℝ) (hbound : ∀ i k, ‖v i k‖ ≤ C i) : |
| 33 | ∃ φ : ℕ → ℕ, StrictMono φ ∧ ∃ w : ∀ i, H i, |
| 34 | ∀ i, ‖w i‖ ≤ C i ∧ ∀ l : H i →L[ℝ] ℝ, |
| 35 | Tendsto (fun k ↦ l (v i (φ k))) atTop (𝓝 (l (w i))) := by |
| 36 | classical |
| 37 | have hfinite (s : Finset ι) : ∃ φ : ℕ → ℕ, StrictMono φ ∧ |
| 38 | ∀ i ∈ s, ∃ w : H i, ‖w‖ ≤ C i ∧ ∀ l : H i →L[ℝ] ℝ, |
| 39 | Tendsto (fun k ↦ l (v i (φ k))) atTop (𝓝 (l w)) := by |
| 40 | induction s using Finset.induction_on with |
| 41 | | empty => exact ⟨id, strictMono_id, by simp⟩ |
| 42 | | @insert i s hi ih => |
| 43 | obtain ⟨φ, hφ, hold⟩ := ih |
| 44 | obtain ⟨w, ψ, hw, hψ, hweak⟩ := |
| 45 | exists_weak_subsequence (fun k ↦ v i (φ k)) (C i) (fun k ↦ hbound i (φ k)) |
| 46 | refine ⟨φ ∘ ψ, hφ.comp hψ, ?_⟩ |
| 47 | intro j hj |
| 48 | rcases Finset.mem_insert.mp hj with rfl | hj |
| 49 | · exact ⟨w, hw, hweak⟩ |
| 50 | · obtain ⟨z, hz, hlim⟩ := hold j hj |
| 51 | exact ⟨z, hz, fun l ↦ (hlim l).comp hψ.tendsto_atTop⟩ |
| 52 | obtain ⟨φ, hφ, hlim⟩ := hfinite Finset.univ |
| 53 | choose w hw using fun i ↦ hlim i (Finset.mem_univ i) |
| 54 | exact ⟨φ, hφ, w, hw⟩ |
| 55 | |
| 56 | variable {E : Type*} [NormedAddCommGroup E] |
| 57 | |
| 58 | section SmoothPrimitive |
| 59 | |
| 60 | variable [NormedSpace ℝ E] [CompleteSpace E] |
| 61 | |
| 62 | theorem smooth_primitive_fixed_endpoints {a b : ℝ} (hab : a < b) |
| 63 | (u₀ u₁ : E) (q : ℝ → E) (hq : ContDiff ℝ ∞ q) : |
| 64 | ∃ f : ℝ → E, ContDiff ℝ ∞ f ∧ f a = u₀ ∧ f b = u₁ ∧ |
| 65 | ∀ s, HasDerivAt f |
| 66 | (q s + (b - a)⁻¹ • (u₁ - u₀ - ∫ r in a..b, q r)) s := by |
| 67 | let c : E := (b - a)⁻¹ • (u₁ - u₀ - ∫ r in a..b, q r) |
| 68 | let d : ℝ → E := fun s ↦ q s + c |
| 69 | let f : ℝ → E := fun s ↦ u₀ + ∫ r in a..s, d r |
| 70 | have hd : ContDiff ℝ ∞ d := hq.add contDiff_const |
| 71 | have hdint : ∀ s t : ℝ, IntervalIntegrable d volume s t := by |
| 72 | intro s t |
| 73 | exact (hd.continuous.intervalIntegrable s t) |
| 74 | have hfderiv (s : ℝ) : HasDerivAt f (d s) s := by |
| 75 | dsimp only [f] |
| 76 | exact (intervalIntegral.integral_hasDerivAt_right (hdint a s) |
| 77 | hd.continuous.aestronglyMeasurable.stronglyMeasurableAtFilter |
| 78 | hd.continuous.continuousAt).const_add u₀ |
| 79 | have hf : ContDiff ℝ ∞ f := by |
| 80 | rw [contDiff_infty_iff_deriv] |
| 81 | refine ⟨fun s ↦ (hfderiv s).differentiableAt, ?_⟩ |
| 82 | rw [show deriv f = d by |
| 83 | funext s |
| 84 | exact (hfderiv s).deriv] |
| 85 | exact hd |
| 86 | have hfa : f a = u₀ := by |
| 87 | simp only [f, intervalIntegral.integral_same, add_zero] |
| 88 | have hfb : f b = u₁ := by |
| 89 | dsimp only [f, d, c] |
| 90 | rw [intervalIntegral.integral_add (hq.continuous.intervalIntegrable a b) |
| 91 | (continuous_const.intervalIntegrable a b), intervalIntegral.integral_const, |
| 92 | smul_inv_smul₀ (ne_of_gt (sub_pos.mpr hab))] |
| 93 | abel |
| 94 | refine ⟨f, hf, hfa, hfb, ?_⟩ |
| 95 | intro s |
| 96 | simpa only [d, c] using hfderiv s |
| 97 | |
| 98 | end SmoothPrimitive |
| 99 | |
| 100 | variable [InnerProductSpace ℝ E] [CompleteSpace E] |
| 101 | |
| 102 | noncomputable abbrev ChartL2 (E : Type*) [NormedAddCommGroup E] (a b : ℝ) := |
| 103 | Lp E 2 (volume.restrict (Icc a b)) |
| 104 | |
| 105 | theorem chartL2_intervalIntegrable {a b : ℝ} (hab : a ≤ b) (v : ChartL2 E a b) : |
| 106 | IntervalIntegrable v volume a b := by |
| 107 | apply (intervalIntegrable_iff_integrableOn_Icc_of_le hab).mpr |
| 108 | exact MemLp.integrable (by norm_num) (Lp.memLp v) |
| 109 | |
| 110 | theorem chart_primitive_of_deriv {a b : ℝ} {u d : ℝ → E} |
| 111 | (hu : ContinuousOn u (Icc a b)) |
| 112 | (hd : ∀ t ∈ Ioo a b, HasDerivAt u (d t) t) |
| 113 | (hLp : MemLp d 2 (volume.restrict (Icc a b))) {t : ℝ} (ht : t ∈ Icc a b) : |
| 114 | u t = u a + ∫ s in a..t, (hLp.toLp d) s := by |
| 115 | have hint : IntervalIntegrable d volume a t := by |
| 116 | apply (intervalIntegrable_iff_integrableOn_Icc_of_le ht.1).mpr |
| 117 | exact IntegrableOn.mono_set (MemLp.integrable (by norm_num) hLp) |
| 118 | (Icc_subset_Icc_right ht.2) |
| 119 | have hFTC := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le ht.1 |
| 120 | (hu.mono (Icc_subset_Icc_right ht.2)) |
| 121 | (fun s hs ↦ hd s ⟨hs.1, hs.2.trans_le ht.2⟩) hint |
| 122 | have heq : (∫ s in a..t, (hLp.toLp d) s) = ∫ s in a..t, d s := by |
| 123 | apply intervalIntegral.integral_congr_ae_restrict |
| 124 | rw [uIoc_of_le ht.1] |
| 125 | exact ae_mono (Measure.restrict_mono |
| 126 | (Ioc_subset_Icc_self.trans (Icc_subset_Icc_right ht.2)) le_rfl) hLp.coeFn_toLp |
| 127 | rw [heq, hFTC, add_comm, sub_add_cancel] |
| 128 | |
| 129 | private theorem chart_integral_as_setIntegral {a b t : ℝ} (ht : t ∈ Icc a b) |
| 130 | (v : ChartL2 E a b) : |
| 131 | (∫ s in Icc a t, v s ∂volume.restrict (Icc a b)) = ∫ s in a..t, v s := by |
| 132 | rw [Measure.restrict_restrict_of_subset (Icc_subset_Icc_right ht.2), |
| 133 | integral_Icc_eq_integral_Ioc, intervalIntegral.integral_of_le ht.1] |
| 134 | |
| 135 | /-- Weak chart velocities identify the pointwise limit of their primitives. -/ |
| 136 | theorem chart_primitive_of_weak_limit {a b : ℝ} |
| 137 | (u : ℕ → ℝ → E) (g : ℝ → E) (v : ℕ → ChartL2 E a b) (w : ChartL2 E a b) |
| 138 | (hprimitive : ∀ k t, t ∈ Icc a b → u k t = u k a + ∫ s in a..t, v k s) |
| 139 | (hpoint : ∀ t ∈ Icc a b, Tendsto (fun k ↦ u k t) atTop (𝓝 (g t))) |
| 140 | (hweak : ∀ l : ChartL2 E a b →L[ℝ] ℝ, |
| 141 | Tendsto (fun k ↦ l (v k)) atTop (𝓝 (l w))) {t : ℝ} (ht : t ∈ Icc a b) : |
| 142 | g t = g a + ∫ s in a..t, w s := by |
| 143 | apply ext_inner_left ℝ |
| 144 | intro z |
| 145 | let test : ChartL2 E a b := |
| 146 | indicatorConstLp 2 (s := Icc a t) measurableSet_Icc (measure_ne_top _ _) z |
| 147 | have htest (q : ChartL2 E a b) : |
| 148 | inner ℝ test q = inner ℝ z (∫ s in a..t, q s) := by |
| 149 | dsimp only [test] |
| 150 | rw [L2.inner_indicatorConstLp_eq_inner_setIntegral ℝ] |
| 151 | rw [chart_integral_as_setIntegral ht q] |
| 152 | have hw := hweak (innerSL ℝ test) |
| 153 | change Tendsto (fun k ↦ inner ℝ test (v k)) atTop (𝓝 (inner ℝ test w)) at hw |
| 154 | simp only [htest] at hw |
| 155 | have ha : a ∈ Icc a b := ⟨le_rfl, ht.1.trans ht.2⟩ |
| 156 | have hsum := (Filter.Tendsto.inner (𝕜 := ℝ) |
| 157 | (tendsto_const_nhds (x := z)) (hpoint a ha)).add hw |
| 158 | have hsum' : Tendsto (fun k ↦ inner ℝ z (u k t)) atTop |
| 159 | (𝓝 (inner ℝ z (g a + ∫ s in a..t, w s))) := by |
| 160 | simpa only [inner_add_right, hprimitive _ _ ht] using hsum |
| 161 | exact tendsto_nhds_unique |
| 162 | (Filter.Tendsto.inner (𝕜 := ℝ) tendsto_const_nhds (hpoint t ht)) hsum' |
| 163 | |
| 164 | /-- The identified primitive has the weak velocity as its ordinary derivative almost everywhere. -/ |
| 165 | theorem chart_primitive_ae_hasDerivAt {a b : ℝ} (hab : a ≤ b) |
| 166 | (u : ℝ → E) (w : ChartL2 E a b) |
| 167 | (hprimitive : ∀ s ∈ Icc a b, u s = u a + ∫ r in a..s, w r) : |
| 168 | ∀ᵐ s ∂volume.restrict (Icc a b), HasDerivAt u (w s) s := by |
| 169 | have hFTC := (chartL2_intervalIntegrable hab w).ae_hasDerivAt_integral |
| 170 | rw [uIcc_of_le hab] at hFTC |
| 171 | have hmem : ∀ᵐ s ∂volume.restrict (Icc a b), s ∈ Ioo a b := by |
| 172 | rw [← restrict_Ioo_eq_restrict_Icc] |
| 173 | exact ae_restrict_mem measurableSet_Ioo |
| 174 | filter_upwards [ae_restrict_of_ae hFTC, hmem] with s hs hsI |
| 175 | have hd := (hs (Ioo_subset_Icc_self hsI) a ⟨le_rfl, hab⟩).const_add (u a) |
| 176 | apply hd.congr_of_eventuallyEq |
| 177 | exact eventually_of_mem (Ioo_mem_nhds hsI.1 hsI.2) |
| 178 | (fun r hr ↦ hprimitive r (Ioo_subset_Icc_self hr)) |
| 179 | |
| 180 | end PoincareMT.LGeometry |