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.SecondDerivative |
| 2 | import PoincareLib.Analysis.Elliptic.Regularity.InteriorEstimates.Energy.Nirenberg |
| 3 | |
| 4 | /-! |
| 5 | # Quantitative extraction of second derivatives |
| 6 | |
| 7 | The difference-quotient bound retains its constant under weak-derivative |
| 8 | extraction. For continuously differentiable gradient components, uniqueness |
| 9 | identifies the resulting bound with the classical second partial derivatives. |
| 10 | |
| 11 | This is the quantitative passage to the limit in Evans, *Partial Differential |
| 12 | Equations*, second edition, Section 6.3.1, Theorem 1, printed p. 327. |
| 13 | -/ |
| 14 | |
| 15 | noncomputable section |
| 16 | |
| 17 | open Set MeasureTheory |
| 18 | open scoped ENNReal |
| 19 | open Poincare.Analysis.Sobolev |
| 20 | open Poincare.Analysis.Sobolev.NirenbergCrossBoundsNonSmooth |
| 21 | open Poincare.Analysis.Sobolev.Weak |
| 22 | open Poincare.Analysis.Sobolev.Euclidean |
| 23 | |
| 24 | namespace Poincare.Analysis.Elliptic.InteriorEstimates |
| 25 | |
| 26 | variable {d : ℕ} |
| 27 | local notation "E" => EuclideanSpace ℝ (Fin d) |
| 28 | |
| 29 | theorem exists_weakPartial_eLpNorm_le_of_integral_diffQuot_bound |
| 30 | {V : Set E} (hV : IsOpen V) (hVc : IsCompact (closure V)) |
| 31 | {p : Fin d → E → ℝ} (hp : ∀ i, MemLp (p i) 2 volume) |
| 32 | {h₀ : ℝ} (hh₀ : 0 < h₀) {C : Fin d → ℝ} |
| 33 | (hbound : ∀ k : Fin d, ∀ h : ℝ, h ≠ 0 → |h| ≤ h₀ → |
| 34 | (∫ x in V, ∑ i, diffQuot k h (p i) x ^ 2) ≤ C k) |
| 35 | (i k : Fin d) : |
| 36 | ∃ q : E → ℝ, MemLp q 2 (volume.restrict V) ∧ |
| 37 | HasWeakPartialDeriv k q (p i) V ∧ |
| 38 | eLpNorm q 2 (volume.restrict V) ≤ ENNReal.ofReal (Real.sqrt (C k)) := by |
| 39 | have hb (h : ℝ) (hh : 0 < |h|) (hle : |h| ≤ h₀) : |
| 40 | eLpNorm (diffQuot k h (p i)) 2 (volume.restrict V) ≤ |
| 41 | ENNReal.ofReal (Real.sqrt (C k)) := by |
| 42 | have hq (j : Fin d) := (memLp_diffQuot_two k h (hp j)).restrict V |
| 43 | have hsq (j : Fin d) : Integrable (fun x => diffQuot k h (p j) x ^ 2) |
| 44 | (volume.restrict V) := by |
| 45 | simpa only [pow_two, Pi.mul_def] using (hq j).integrable_mul (hq j) |
| 46 | apply eLpNorm_two_le_sqrt_of_integral_sq_le (hq i) |
| 47 | apply le_trans _ (hbound k h (abs_pos.mp hh) hle) |
| 48 | apply integral_mono (hsq i) |
| 49 | (integrable_finsetSum _ (fun j _ => hsq j)) |
| 50 | intro x |
| 51 | exact Finset.single_le_sum (fun j _ => sq_nonneg (diffQuot k h (p j) x)) |
| 52 | (Finset.mem_univ i) |
| 53 | exact hasWeakPartialDeriv_of_diffQuot_uniform_bound_loc isOpen_univ hV hVc hh₀ |
| 54 | (subset_univ _) (by simpa using hp i) k (Real.sqrt_nonneg (C k)) hb |
| 55 | |
| 56 | theorem classicalPartial_eLpNorm_le_of_integral_diffQuot_bound |
| 57 | {V : Set E} (hV : IsOpen V) (hVc : IsCompact (closure V)) |
| 58 | {p : Fin d → E → ℝ} (hp : ∀ i, MemLp (p i) 2 volume) |
| 59 | (hp_smooth : ∀ i, ContDiff ℝ 1 (p i)) |
| 60 | {h₀ : ℝ} (hh₀ : 0 < h₀) {C : Fin d → ℝ} |
| 61 | (hbound : ∀ k : Fin d, ∀ h : ℝ, h ≠ 0 → |h| ≤ h₀ → |
| 62 | (∫ x in V, ∑ i, diffQuot k h (p i) x ^ 2) ≤ C k) |
| 63 | (i k : Fin d) : |
| 64 | MemLp (fun x => fderiv ℝ (p i) x (EuclideanSpace.single k 1)) 2 |
| 65 | (volume.restrict V) ∧ |
| 66 | eLpNorm (fun x => fderiv ℝ (p i) x (EuclideanSpace.single k 1)) 2 |
| 67 | (volume.restrict V) ≤ ENNReal.ofReal (Real.sqrt (C k)) := by |
| 68 | obtain ⟨q, hq, hweak, hnorm⟩ := |
| 69 | exists_weakPartial_eLpNorm_le_of_integral_diffQuot_bound hV hVc hp hh₀ hbound i k |
| 70 | have hclassical := HasWeakPartialDeriv.of_contDiff (i := k) hV (hp_smooth i) |
| 71 | have hcont : Continuous (fun x => fderiv ℝ (p i) x (EuclideanSpace.single k 1)) := |
| 72 | ((hp_smooth i).continuous_fderiv one_ne_zero).clm_apply continuous_const |
| 73 | have heq := HasWeakPartialDeriv.ae_eq hV hweak hclassical |
| 74 | (hq.locallyIntegrable (by norm_num)) |
| 75 | (hcont.locallyIntegrable.mono_measure Measure.restrict_le_self) |
| 76 | refine ⟨hq.ae_eq heq, ?_⟩ |
| 77 | rw [← eLpNorm_congr_ae heq] |
| 78 | exact hnorm |
| 79 | |
| 80 | theorem classicalPartial_integral_sq_le_of_integral_diffQuot_bound |
| 81 | {V : Set E} (hV : IsOpen V) (hVc : IsCompact (closure V)) |
| 82 | {p : Fin d → E → ℝ} (hp : ∀ i, MemLp (p i) 2 volume) |
| 83 | (hp_smooth : ∀ i, ContDiff ℝ 1 (p i)) |
| 84 | {h₀ : ℝ} (hh₀ : 0 < h₀) {C : Fin d → ℝ} (hC : ∀ k, 0 ≤ C k) |
| 85 | (hbound : ∀ k : Fin d, ∀ h : ℝ, h ≠ 0 → |h| ≤ h₀ → |
| 86 | (∫ x in V, ∑ i, diffQuot k h (p i) x ^ 2) ≤ C k) |
| 87 | (i k : Fin d) : |
| 88 | (∫ x in V, (fderiv ℝ (p i) x (EuclideanSpace.single k 1)) ^ 2) ≤ C k := by |
| 89 | obtain ⟨hm, hn⟩ := classicalPartial_eLpNorm_le_of_integral_diffQuot_bound |
| 90 | hV hVc hp hp_smooth hh₀ hbound i k |
| 91 | have hn' := ENNReal.toReal_mono (ENNReal.ofReal_ne_top) hn |
| 92 | rw [ENNReal.toReal_ofReal (Real.sqrt_nonneg _)] at hn' |
| 93 | rw [← eLpNorm_toReal_sq_eq_integral hm, ← Real.sq_sqrt (hC k)] |
| 94 | exact (sq_le_sq₀ ENNReal.toReal_nonneg (Real.sqrt_nonneg _)).mpr hn' |
| 95 | |
| 96 | theorem classicalGradient_integral_sq_le_of_integral_diffQuot_bound |
| 97 | {V : Set E} (hV : IsOpen V) (hVc : IsCompact (closure V)) |
| 98 | {p : Fin d → E → ℝ} (hp : ∀ i, MemLp (p i) 2 volume) |
| 99 | (hp_smooth : ∀ i, ContDiff ℝ 1 (p i)) |
| 100 | {h₀ : ℝ} (hh₀ : 0 < h₀) {C : Fin d → ℝ} (hC : ∀ k, 0 ≤ C k) |
| 101 | (hbound : ∀ k : Fin d, ∀ h : ℝ, h ≠ 0 → |h| ≤ h₀ → |
| 102 | (∫ x in V, ∑ i, diffQuot k h (p i) x ^ 2) ≤ C k) : |
| 103 | (∫ x in V, ∑ k : Fin d, ∑ i : Fin d, |
| 104 | (fderiv ℝ (p i) x (EuclideanSpace.single k 1)) ^ 2) ≤ |
| 105 | (d : ℝ) * ∑ k : Fin d, C k := by |
| 106 | have hint (i k : Fin d) : Integrable |
| 107 | (fun x => (fderiv ℝ (p i) x (EuclideanSpace.single k 1)) ^ 2) |
| 108 | (volume.restrict V) := |
| 109 | (classicalPartial_eLpNorm_le_of_integral_diffQuot_bound |
| 110 | hV hVc hp hp_smooth hh₀ hbound i k).1.integrable_sq |
| 111 | rw [integral_finsetSum _ (fun k _ => integrable_finsetSum _ (fun i _ => hint i k))] |
| 112 | calc |
| 113 | _ ≤ ∑ k : Fin d, ∑ _i : Fin d, C k := by |
| 114 | apply Finset.sum_le_sum |
| 115 | intro k _ |
| 116 | rw [integral_finsetSum _ (fun i _ => hint i k)] |
| 117 | exact Finset.sum_le_sum (fun i _ => |
| 118 | classicalPartial_integral_sq_le_of_integral_diffQuot_bound |
| 119 | hV hVc hp hp_smooth hh₀ hC hbound i k) |
| 120 | _ = _ := by simp [Finset.mul_sum] |
| 121 | |
| 122 | /-- The local second-partial estimate for an actual weak elliptic equation. |
| 123 | The coefficient of the three energy integrals is fixed before `u`, `p`, and `f`. |
| 124 | -/ |
| 125 | theorem classicalPartial_integral_sq_le_nirenberg |
| 126 | [NeZero d] {Ω V : Set E} (B : NirenbergEuclidean.SmoothEllipticBilinearForm d Ω) |
| 127 | (hV : IsOpen V) {u f : E → ℝ} {p : Fin d → E → ℝ} |
| 128 | (hu : MemLp u 2 volume) (hf : MemLp f 2 volume) |
| 129 | (hp : ∀ i, MemLp (p i) 2 volume) |
| 130 | (hp_smooth : ∀ i, ContDiff ℝ 1 (p i)) |
| 131 | (hw : ∀ i, HasWeakPartialDeriv i (p i) u univ) |
| 132 | (hF : ∀ j, MemLp (fun x => ∑ i : Fin d, B.a x i j * p i x) 2 volume) |
| 133 | (heq : ∀ φ : E → ℝ, ContDiff ℝ (⊤ : ℕ∞) φ → HasCompactSupport φ → |
| 134 | tsupport φ ⊆ V → |
| 135 | (∫ x in V, ∑ j : Fin d, |
| 136 | (∑ i : Fin d, B.a x i j * p i x) * |
| 137 | fderiv ℝ φ x (EuclideanSpace.single j 1)) = ∫ x in V, f x * φ x) |
| 138 | {η : E → ℝ} (hη : ContDiff ℝ (⊤ : ℕ∞) η) (hηc : HasCompactSupport η) |
| 139 | (hηrange : range η ⊆ Icc (0 : ℝ) 1) |
| 140 | {N : ℝ} (hN : 0 ≤ N) (hDη : ∀ x : E, ‖fderiv ℝ η x‖ ≤ N) |
| 141 | {Ω' Ω'' : Set E} (hΩ' : IsOpen Ω') (hΩ'Ω : closure Ω' ⊆ Ω) |
| 142 | (hΩ'c : IsCompact (closure Ω')) (hΩ'V : Ω' ⊆ V) |
| 143 | {R₀ : ℝ} (hR₀ : 0 < R₀) |
| 144 | (hthick : ∀ {h : ℝ}, |h| ≤ R₀ → Metric.cthickening |h| (tsupport η) ⊆ Ω') |
| 145 | (hηone : ∀ x ∈ Ω'', η x = 1) |
| 146 | (hΩ'' : IsOpen Ω'') (hΩ''c : IsCompact (closure Ω'')) (i k : Fin d) : |
| 147 | (∫ x in Ω'', (fderiv ℝ (p i) x (EuclideanSpace.single k 1)) ^ 2) ≤ |
| 148 | (2 * nirenbergMasterYoungConstant B N hΩ'c k / B.lam) * |
| 149 | ((∫ x in Ω', ∑ i : Fin d, (p i x) ^ 2) + |
| 150 | (∫ x in Ω', (u x) ^ 2) + (∫ x in Ω', (f x) ^ 2)) := by |
| 151 | let energy : ℝ := (∫ x in Ω', ∑ i : Fin d, (p i x) ^ 2) + |
| 152 | (∫ x in Ω', (u x) ^ 2) + (∫ x in Ω', (f x) ^ 2) |
| 153 | have henergy : 0 ≤ energy := by |
| 154 | dsimp [energy] |
| 155 | positivity |
| 156 | apply classicalPartial_integral_sq_le_of_integral_diffQuot_bound hΩ'' hΩ''c hp |
| 157 | hp_smooth hR₀ (C := fun k => |
| 158 | (2 * nirenbergMasterYoungConstant B N hΩ'c k / B.lam) * energy) ?_ ?_ i k |
| 159 | · intro k |
| 160 | exact mul_nonneg (div_nonneg |
| 161 | (mul_nonneg (by norm_num) (nirenbergMasterYoungConstant_nonneg B hN hΩ'c k)) |
| 162 | B.hlam_pos.le) henergy |
| 163 | · intro k h hh hhle |
| 164 | have hestimate := diffQuot_weakGradient_localL2_bound_quantitative B hV hu hf hp hw hF heq |
| 165 | hη hηc hηrange hN hDη hΩ' hΩ'Ω hΩ'c hΩ'V hR₀ hthick hηone |
| 166 | hΩ''.measurableSet k hh hhle |
| 167 | rw [mul_comm (B.lam / 2)] at hestimate |
| 168 | have h' := (le_div_iff₀ |
| 169 | (div_pos B.hlam_pos (by norm_num : (0 : ℝ) < 2))).mpr hestimate |
| 170 | calc |
| 171 | _ ≤ nirenbergMasterYoungConstant B N hΩ'c k * energy / (B.lam / 2) := h' |
| 172 | _ = _ := by rw [div_div_eq_mul_div]; ring |
| 173 | |
| 174 | end Poincare.Analysis.Elliptic.InteriorEstimates |