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.LocalIntegrability |
| 2 | import PoincareLib.Analysis.Elliptic.Regularity.Sobolev.Weak.Witnesses |
| 3 | |
| 4 | /-! |
| 5 | # Cutoff localization of local weak derivatives |
| 6 | |
| 7 | Compact-local `L2` functions and their weak first derivatives become global |
| 8 | `H1` functions after multiplication by a smooth cutoff supported in the domain. |
| 9 | -/ |
| 10 | |
| 11 | noncomputable section |
| 12 | |
| 13 | open Set MeasureTheory Function Topology |
| 14 | open scoped ENNReal ContDiff |
| 15 | |
| 16 | namespace Poincare.Analysis.Elliptic |
| 17 | |
| 18 | variable {n : ℕ} |
| 19 | |
| 20 | local notation "E" => EuclideanSpace ℝ (Fin n) |
| 21 | |
| 22 | /-- A compactly supported coefficient turns compact-local `L2` into global `L2`. -/ |
| 23 | theorem memLp_mul_of_compact_memLp |
| 24 | {O : Set E} {u χ : E → ℝ} |
| 25 | (hu : ∀ K, IsCompact K → K ⊆ O → MemLp u 2 (volume.restrict K)) |
| 26 | (hχ : Continuous χ) (hχc : HasCompactSupport χ) (hχO : tsupport χ ⊆ O) : |
| 27 | MemLp (fun x => χ x * u x) 2 volume := by |
| 28 | have hlocal := compact_memLp_mul_continuousOn hχ.continuousOn hu hχc hχO |
| 29 | have heq : (tsupport χ).indicator (fun x => χ x * u x) = fun x => χ x * u x := by |
| 30 | ext x |
| 31 | by_cases hx : x ∈ tsupport χ |
| 32 | · simp [hx] |
| 33 | · simp [hx, image_eq_zero_of_notMem_tsupport hx] |
| 34 | rw [← heq] |
| 35 | exact (memLp_indicator_iff_restrict (isClosed_tsupport χ).measurableSet).mpr hlocal |
| 36 | |
| 37 | /-- The derivative term in the cutoff product rule is globally square integrable. -/ |
| 38 | theorem memLp_cutoff_weakPartial |
| 39 | {O : Set E} {u g χ : E → ℝ} (i : Fin n) |
| 40 | (hu : ∀ K, IsCompact K → K ⊆ O → MemLp u 2 (volume.restrict K)) |
| 41 | (hg : ∀ K, IsCompact K → K ⊆ O → MemLp g 2 (volume.restrict K)) |
| 42 | (hχ : ContDiff ℝ ∞ χ) (hχc : HasCompactSupport χ) (hχO : tsupport χ ⊆ O) : |
| 43 | MemLp (fun x => χ x * g x + |
| 44 | (fderiv ℝ χ x) (EuclideanSpace.single i 1) * u x) 2 volume := by |
| 45 | apply (memLp_mul_of_compact_memLp hg hχ.continuous hχc hχO).add |
| 46 | apply memLp_mul_of_compact_memLp hu |
| 47 | ((hχ.continuous_fderiv (by simp)).clm_apply continuous_const) |
| 48 | (hχc.fderiv_apply (𝕜 := ℝ) (EuclideanSpace.single i 1)) |
| 49 | exact (tsupport_fderiv_apply_subset ℝ (EuclideanSpace.single i 1)).trans hχO |
| 50 | |
| 51 | /-- The cutoff product rule holds globally, using only the original local weak identity. -/ |
| 52 | theorem hasWeakPartialDeriv_cutoff |
| 53 | {O : Set E} {u g χ : E → ℝ} (i : Fin n) |
| 54 | (hu : ∀ K, IsCompact K → K ⊆ O → MemLp u 2 (volume.restrict K)) |
| 55 | (hg : ∀ K, IsCompact K → K ⊆ O → MemLp g 2 (volume.restrict K)) |
| 56 | (hweak : Sobolev.Weak.HasWeakPartialDeriv i g u O) |
| 57 | (hχ : ContDiff ℝ ∞ χ) (hχc : HasCompactSupport χ) (hχO : tsupport χ ⊆ O) : |
| 58 | Sobolev.Weak.HasWeakPartialDeriv i |
| 59 | (fun x => χ x * g x + (fderiv ℝ χ x) (EuclideanSpace.single i 1) * u x) |
| 60 | (fun x => χ x * u x) Set.univ := by |
| 61 | intro φ hφ hφc _ |
| 62 | let e : E := EuclideanSpace.single i 1 |
| 63 | have hχd : Continuous (fun x => (fderiv ℝ χ x) e) := |
| 64 | (hχ.continuous_fderiv (by simp)).clm_apply continuous_const |
| 65 | have hχdc : HasCompactSupport (fun x => (fderiv ℝ χ x) e) := hχc.fderiv_apply (𝕜 := ℝ) e |
| 66 | have hχdO : tsupport (fun x => (fderiv ℝ χ x) e) ⊆ O := |
| 67 | (tsupport_fderiv_apply_subset ℝ e).trans hχO |
| 68 | have hχu := memLp_mul_of_compact_memLp hu hχ.continuous hχc hχO |
| 69 | have hχg := memLp_mul_of_compact_memLp hg hχ.continuous hχc hχO |
| 70 | have hdχu := memLp_mul_of_compact_memLp hu hχd hχdc hχdO |
| 71 | have hφd : Continuous (fun x => (fderiv ℝ φ x) e) := |
| 72 | (hφ.continuous_fderiv (by simp)).clm_apply continuous_const |
| 73 | have hφdc : HasCompactSupport (fun x => (fderiv ℝ φ x) e) := hφc.fderiv_apply (𝕜 := ℝ) e |
| 74 | have hint1 : Integrable (fun x => (χ x * u x) * (fderiv ℝ φ x) e) := by |
| 75 | simpa only [smul_eq_mul] using |
| 76 | hχu.locallyIntegrable (by norm_num) |>.integrable_smul_right_of_hasCompactSupport hφd hφdc |
| 77 | have hint2 : Integrable (fun x => ((fderiv ℝ χ x) e * u x) * φ x) := by |
| 78 | simpa only [smul_eq_mul] using |
| 79 | hdχu.locallyIntegrable (by norm_num) |>.integrable_smul_right_of_hasCompactSupport hφ.continuous hφc |
| 80 | have hint3 : Integrable (fun x => (χ x * g x) * φ x) := by |
| 81 | simpa only [smul_eq_mul] using |
| 82 | hχg.locallyIntegrable (by norm_num) |>.integrable_smul_right_of_hasCompactSupport hφ.continuous hφc |
| 83 | have hχφO : tsupport (fun x => χ x * φ x) ⊆ O := |
| 84 | (tsupport_smul_subset_left χ φ).trans hχO |
| 85 | have hkey := hweak (fun x => χ x * φ x) (hχ.mul hφ) hχc.mul_right hχφO |
| 86 | have hprod : ∀ x, (fderiv ℝ (fun y => χ y * φ y) x) e = |
| 87 | χ x * (fderiv ℝ φ x) e + φ x * (fderiv ℝ χ x) e := by |
| 88 | intro x |
| 89 | rw [fderiv_fun_mul (hχ.differentiable (by simp)).differentiableAt |
| 90 | (hφ.differentiable (by simp)).differentiableAt] |
| 91 | simp [smul_eq_mul] |
| 92 | have hz : ∀ x ∉ O, χ x = 0 ∧ (fderiv ℝ χ x) e = 0 := by |
| 93 | intro x hx |
| 94 | exact ⟨image_eq_zero_of_notMem_tsupport (fun h => hx (hχO h)), |
| 95 | image_eq_zero_of_notMem_tsupport (f := fun y => (fderiv ℝ χ y) e) |
| 96 | (fun h => hx (hχdO h))⟩ |
| 97 | change (∫ x in O, u x * (fderiv ℝ (fun y => χ y * φ y) x) e) = _ at hkey |
| 98 | simp_rw [hprod] at hkey |
| 99 | rw [setIntegral_eq_integral_of_forall_compl_eq_zero |
| 100 | (fun x hx => by simp [(hz x hx).1, (hz x hx).2]), |
| 101 | setIntegral_eq_integral_of_forall_compl_eq_zero |
| 102 | (fun x hx => by simp [(hz x hx).1])] at hkey |
| 103 | have hleft : (fun x => u x * (χ x * (fderiv ℝ φ x) e + φ x * (fderiv ℝ χ x) e)) = |
| 104 | fun x => (χ x * u x) * (fderiv ℝ φ x) e + ((fderiv ℝ χ x) e * u x) * φ x := by |
| 105 | ext x; ring |
| 106 | have hright : (fun x => g x * (χ x * φ x)) = fun x => (χ x * g x) * φ x := by |
| 107 | ext x; ring |
| 108 | rw [hleft, hright, integral_add hint1 hint2] at hkey |
| 109 | simp only [Measure.restrict_univ] |
| 110 | change (∫ x, (χ x * u x) * (fderiv ℝ φ x) e) = |
| 111 | -(∫ x, (χ x * g x + (fderiv ℝ χ x) e * u x) * φ x) |
| 112 | simp_rw [add_mul] |
| 113 | rw [integral_add hint3 hint2] |
| 114 | linarith |
| 115 | |
| 116 | /-- Cutoff localization produces a global first-order Sobolev function. -/ |
| 117 | theorem memW1p_cutoff |
| 118 | {O : Set E} {u χ : E → ℝ} {p : Fin n → E → ℝ} |
| 119 | (hu : ∀ K, IsCompact K → K ⊆ O → MemLp u 2 (volume.restrict K)) |
| 120 | (hp : ∀ i K, IsCompact K → K ⊆ O → MemLp (p i) 2 (volume.restrict K)) |
| 121 | (hweak : ∀ i, Sobolev.Weak.HasWeakPartialDeriv i (p i) u O) |
| 122 | (hχ : ContDiff ℝ ∞ χ) (hχc : HasCompactSupport χ) (hχO : tsupport χ ⊆ O) : |
| 123 | Sobolev.Weak.MemW1p 2 (fun x => χ x * u x) Set.univ := by |
| 124 | refine ⟨?_, fun i => ⟨_, ?_, hasWeakPartialDeriv_cutoff i hu (hp i) (hweak i) hχ hχc hχO⟩⟩ |
| 125 | · simpa only [Measure.restrict_univ] using memLp_mul_of_compact_memLp hu hχ.continuous hχc hχO |
| 126 | · simpa only [Measure.restrict_univ] using memLp_cutoff_weakPartial i hu (hp i) hχ hχc hχO |
| 127 | |
| 128 | /-- On an open region where the cutoff is one, the localized function and derivatives agree. -/ |
| 129 | theorem cutoff_eqOn_of_eq_one |
| 130 | {V : Set E} (hV : IsOpen V) {χ u : E → ℝ} {p : Fin n → E → ℝ} |
| 131 | (hχ : ∀ x ∈ V, χ x = 1) : |
| 132 | Set.EqOn (fun x => χ x * u x) u V ∧ |
| 133 | ∀ i, Set.EqOn (fun x => χ x * p i x + |
| 134 | (fderiv ℝ χ x) (EuclideanSpace.single i 1) * u x) (p i) V := by |
| 135 | refine ⟨fun x hx => by simp [hχ x hx], fun i x hx => ?_⟩ |
| 136 | have heq : χ =ᶠ[𝓝 x] fun _ => (1 : ℝ) := |
| 137 | Filter.mem_of_superset (hV.mem_nhds hx) (fun y hy => hχ y hy) |
| 138 | dsimp only |
| 139 | rw [Filter.EventuallyEq.fderiv_eq heq] |
| 140 | simp [hχ x hx] |
| 141 | |
| 142 | end Poincare.Analysis.Elliptic |