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.Analysis.Elliptic.Regularity.GradientCompactness.Parametric |
| 2 | import PoincareLib.Analysis.Elliptic.Regularity.GradientCompactness.Products |
| 3 | |
| 4 | /-! # Integrating convergence of gradient quadratic forms -/ |
| 5 | |
| 6 | noncomputable section |
| 7 | set_option autoImplicit false |
| 8 | set_option backward.isDefEq.respectTransparency false |
| 9 | |
| 10 | open Set Filter MeasureTheory |
| 11 | open scoped Topology NNReal |
| 12 | |
| 13 | namespace Poincare.Analysis.Elliptic |
| 14 | |
| 15 | variable {d : ℕ} |
| 16 | local notation "E" => EuclideanSpace ℝ (Fin d) |
| 17 | |
| 18 | theorem aestronglyMeasurable_spatial_partial_of_lipschitz |
| 19 | {O U : Set E} (hO : IsOpen O) (hU : MeasurableSet U) (hUO : U ⊆ O) |
| 20 | {I : Set ℝ} (hI : MeasurableSet I) |
| 21 | {u : E × ℝ → ℝ} {L : ℝ≥0} (hu : LipschitzOnWith L u (O ×ˢ I)) (i : Fin d) : |
| 22 | AEStronglyMeasurable (fun z : ℝ × E => |
| 23 | fderiv ℝ (fun y => u (y, z.1)) z.2 (EuclideanSpace.single i 1)) |
| 24 | ((volume.restrict I).prod (volume.restrict U)) := by |
| 25 | obtain ⟨ue, hue, hueq⟩ := hu.extend_real |
| 26 | have hum := measurable_fderiv_apply_const_with_param ℝ |
| 27 | (f := fun t x => ue (x, t)) (hue.continuous.comp continuous_swap) |
| 28 | (EuclideanSpace.single i 1) |
| 29 | apply hum.aestronglyMeasurable.congr |
| 30 | have hmem : ∀ᵐ z ∂(volume.restrict I).prod (volume.restrict U), z ∈ I ×ˢ U := by |
| 31 | rw [Measure.prod_restrict] |
| 32 | exact ae_restrict_mem (hI.prod hU) |
| 33 | filter_upwards [hmem] with z hz |
| 34 | have heq : (fun y => u (y, z.1)) =ᶠ[𝓝 z.2] fun y => ue (y, z.1) := by |
| 35 | filter_upwards [hO.mem_nhds (hUO hz.2)] with y hy |
| 36 | exact hueq ⟨hy, hz.1⟩ |
| 37 | rw [heq.fderiv_eq] |
| 38 | |
| 39 | theorem norm_integral_gradient_quadratic_sub_le |
| 40 | {O U : Set E} (hO : IsOpen O) (hU : MeasurableSet U) (hUO : U ⊆ O) |
| 41 | [IsFiniteMeasure (volume.restrict U)] |
| 42 | {u v : E → ℝ} {L : ℝ≥0} |
| 43 | (hu : LipschitzOnWith L u O) (hv : LipschitzOnWith L v O) |
| 44 | {A B : E → Fin d → Fin d → ℝ} {C : ℝ} (hC : 0 ≤ C) |
| 45 | (hA : ∀ x ∈ U, ∀ i j, |A x i j| ≤ C) |
| 46 | (hB : ∀ x ∈ U, ∀ i j, |B x i j| ≤ C) : |
| 47 | ‖∫ x in U, |
| 48 | |(∑ i, ∑ j, A x i j * fderiv ℝ u x (EuclideanSpace.single j 1) * |
| 49 | fderiv ℝ u x (EuclideanSpace.single i 1)) - |
| 50 | ∑ i, ∑ j, B x i j * fderiv ℝ v x (EuclideanSpace.single j 1) * |
| 51 | fderiv ℝ v x (EuclideanSpace.single i 1)|‖ ≤ |
| 52 | 2 * (d : ℝ) ^ 2 * C * (L : ℝ) ^ 2 * volume.real U := by |
| 53 | have hb (f : E → ℝ) (hf : LipschitzOnWith L f O) |
| 54 | (Q : E → Fin d → Fin d → ℝ) (hQ : ∀ x ∈ U, ∀ i j, |Q x i j| ≤ C) |
| 55 | (x : E) (hx : x ∈ U) : |
| 56 | |∑ i, ∑ j, Q x i j * fderiv ℝ f x (EuclideanSpace.single j 1) * |
| 57 | fderiv ℝ f x (EuclideanSpace.single i 1)| ≤ (d : ℝ) ^ 2 * C * (L : ℝ) ^ 2 := by |
| 58 | calc |
| 59 | _ ≤ ∑ i, |∑ j, Q x i j * fderiv ℝ f x (EuclideanSpace.single j 1) * |
| 60 | fderiv ℝ f x (EuclideanSpace.single i 1)| := Finset.abs_sum_le_sum_abs _ _ |
| 61 | _ ≤ ∑ i : Fin d, ∑ _j : Fin d, C * (L : ℝ) * L := by |
| 62 | apply Finset.sum_le_sum |
| 63 | intro i _ |
| 64 | apply (Finset.abs_sum_le_sum_abs _ _).trans |
| 65 | apply Finset.sum_le_sum |
| 66 | intro j _ |
| 67 | simp only [abs_mul] |
| 68 | exact mul_le_mul |
| 69 | (mul_le_mul (hQ x hx i j) (abs_partial_le_of_lipschitzOn hO hf (hUO hx) j) |
| 70 | (abs_nonneg _) hC) |
| 71 | (abs_partial_le_of_lipschitzOn hO hf (hUO hx) i) |
| 72 | (abs_nonneg _) (mul_nonneg hC L.coe_nonneg) |
| 73 | _ = _ := by simp [pow_two, mul_assoc, mul_left_comm] |
| 74 | have hbound : ∀ᵐ x ∂volume.restrict U, |
| 75 | ‖|(∑ i, ∑ j, A x i j * fderiv ℝ u x (EuclideanSpace.single j 1) * |
| 76 | fderiv ℝ u x (EuclideanSpace.single i 1)) - |
| 77 | ∑ i, ∑ j, B x i j * fderiv ℝ v x (EuclideanSpace.single j 1) * |
| 78 | fderiv ℝ v x (EuclideanSpace.single i 1)|‖ ≤ |
| 79 | 2 * (d : ℝ) ^ 2 * C * (L : ℝ) ^ 2 := by |
| 80 | filter_upwards [ae_restrict_mem hU] with x hx |
| 81 | rw [Real.norm_eq_abs, abs_abs] |
| 82 | have h := (abs_sub _ _).trans (add_le_add (hb u hu A hA x hx) (hb v hv B hB x hx)) |
| 83 | nlinarith |
| 84 | simpa only [Measure.real, Measure.restrict_apply_univ] using |
| 85 | norm_integral_le_of_norm_le_const hbound |
| 86 | |
| 87 | theorem tendsto_iterated_integral_abs_gradient_quadratic_sub |
| 88 | {O U : Set E} (hO : IsOpen O) (hU : MeasurableSet U) (hUO : U ⊆ O) |
| 89 | {I : Set ℝ} (hI : MeasurableSet I) |
| 90 | [IsFiniteMeasure (volume.restrict U)] [IsFiniteMeasure (volume.restrict I)] |
| 91 | {u : ℕ → E × ℝ → ℝ} {v : E × ℝ → ℝ} {L : ℝ≥0} |
| 92 | (hu : ∀ᶠ k in atTop, LipschitzOnWith L (u k) (O ×ˢ I)) |
| 93 | (hv : LipschitzOnWith L v (O ×ˢ I)) |
| 94 | {A : ℕ → E × ℝ → Fin d → Fin d → ℝ} {B : E × ℝ → Fin d → Fin d → ℝ} |
| 95 | {C : ℝ} (hC : 0 ≤ C) |
| 96 | (hA : ∀ᶠ k in atTop, ∀ i j, AEStronglyMeasurable (fun z : ℝ × E => A k z.swap i j) |
| 97 | ((volume.restrict I).prod (volume.restrict U))) |
| 98 | (hB : ∀ i j, AEStronglyMeasurable (fun z : ℝ × E => B z.swap i j) |
| 99 | ((volume.restrict I).prod (volume.restrict U))) |
| 100 | (hAb : ∀ᶠ k in atTop, ∀ z ∈ U ×ˢ I, ∀ i j, |A k z i j| ≤ C) |
| 101 | (hBb : ∀ z ∈ U ×ˢ I, ∀ i j, |B z i j| ≤ C) |
| 102 | (hlim : ∀ t ∈ I, Tendsto (fun k => ∫ x in U, |
| 103 | |(∑ i, ∑ j, A k (x, t) i j * fderiv ℝ (fun y => u k (y, t)) x (EuclideanSpace.single j 1) * |
| 104 | fderiv ℝ (fun y => u k (y, t)) x (EuclideanSpace.single i 1)) - |
| 105 | ∑ i, ∑ j, B (x, t) i j * fderiv ℝ (fun y => v (y, t)) x (EuclideanSpace.single j 1) * |
| 106 | fderiv ℝ (fun y => v (y, t)) x (EuclideanSpace.single i 1)|) atTop (𝓝 0)) : |
| 107 | Tendsto (fun k => ∫ t in I, ∫ x in U, |
| 108 | |(∑ i, ∑ j, A k (x, t) i j * fderiv ℝ (fun y => u k (y, t)) x (EuclideanSpace.single j 1) * |
| 109 | fderiv ℝ (fun y => u k (y, t)) x (EuclideanSpace.single i 1)) - |
| 110 | ∑ i, ∑ j, B (x, t) i j * fderiv ℝ (fun y => v (y, t)) x (EuclideanSpace.single j 1) * |
| 111 | fderiv ℝ (fun y => v (y, t)) x (EuclideanSpace.single i 1)|) atTop (𝓝 0) := by |
| 112 | have hmeas : ∀ᶠ k in atTop, AEStronglyMeasurable (fun t => ∫ x in U, |
| 113 | |(∑ i, ∑ j, A k (x, t) i j * fderiv ℝ (fun y => u k (y, t)) x (EuclideanSpace.single j 1) * |
| 114 | fderiv ℝ (fun y => u k (y, t)) x (EuclideanSpace.single i 1)) - |
| 115 | ∑ i, ∑ j, B (x, t) i j * fderiv ℝ (fun y => v (y, t)) x (EuclideanSpace.single j 1) * |
| 116 | fderiv ℝ (fun y => v (y, t)) x (EuclideanSpace.single i 1)|) (volume.restrict I) := by |
| 117 | filter_upwards [hu, hA] with k hku hkA |
| 118 | have hdu (i : Fin d) := aestronglyMeasurable_spatial_partial_of_lipschitz hO hU hUO hI hku i |
| 119 | have hdv (i : Fin d) := aestronglyMeasurable_spatial_partial_of_lipschitz hO hU hUO hI hv i |
| 120 | simpa only [Pi.sub_apply, Finset.sum_apply, Pi.mul_apply, Real.norm_eq_abs, Prod.swap] using |
| 121 | ((Finset.aestronglyMeasurable_sum Finset.univ (fun i _ => |
| 122 | Finset.aestronglyMeasurable_sum Finset.univ (fun j _ => ((hkA i j).mul (hdu j)).mul (hdu i)))).sub |
| 123 | (Finset.aestronglyMeasurable_sum Finset.univ (fun i _ => |
| 124 | Finset.aestronglyMeasurable_sum Finset.univ (fun j _ => ((hB i j).mul (hdv j)).mul (hdv i))))).norm.integral_prod_right' |
| 125 | have hb : ∀ᶠ k in atTop, ∀ᵐ t ∂volume.restrict I, |
| 126 | ‖∫ x in U, |
| 127 | |(∑ i, ∑ j, A k (x, t) i j * fderiv ℝ (fun y => u k (y, t)) x (EuclideanSpace.single j 1) * |
| 128 | fderiv ℝ (fun y => u k (y, t)) x (EuclideanSpace.single i 1)) - |
| 129 | ∑ i, ∑ j, B (x, t) i j * fderiv ℝ (fun y => v (y, t)) x (EuclideanSpace.single j 1) * |
| 130 | fderiv ℝ (fun y => v (y, t)) x (EuclideanSpace.single i 1)|‖ ≤ |
| 131 | 2 * (d : ℝ) ^ 2 * C * (L : ℝ) ^ 2 * volume.real U := by |
| 132 | filter_upwards [hu, hAb] with k hk hkb |
| 133 | filter_upwards [ae_restrict_mem hI] with t ht |
| 134 | have hul : LipschitzOnWith L (fun y => u k (y, t)) O := by |
| 135 | simpa only [mul_one, Function.comp_def] using hk.comp |
| 136 | (LipschitzWith.prodMk_right t).lipschitzOnWith (fun y hy => ⟨hy, ht⟩) |
| 137 | have hvl : LipschitzOnWith L (fun y => v (y, t)) O := by |
| 138 | simpa only [mul_one, Function.comp_def] using hv.comp |
| 139 | (LipschitzWith.prodMk_right t).lipschitzOnWith (fun y hy => ⟨hy, ht⟩) |
| 140 | exact norm_integral_gradient_quadratic_sub_le hO hU hUO hul hvl hC |
| 141 | (fun x hx => hkb (x, t) ⟨hx, ht⟩) (fun x hx => hBb (x, t) ⟨hx, ht⟩) |
| 142 | have h := tendsto_integral_filter_of_dominated_convergence |
| 143 | (fun _ : ℝ => 2 * (d : ℝ) ^ 2 * C * (L : ℝ) ^ 2 * volume.real U) |
| 144 | hmeas hb (integrable_const _) (by |
| 145 | filter_upwards [ae_restrict_mem hI] with t ht |
| 146 | exact hlim t ht) |
| 147 | simpa only [integral_zero] using h |
| 148 | |
| 149 | end Poincare.Analysis.Elliptic |