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.Coefficients |
| 2 | import PoincareLib.Analysis.Elliptic.Regularity.Localization |
| 3 | |
| 4 | /-! |
| 5 | # Localizing the weak elliptic equation |
| 6 | |
| 7 | The compact-local hypotheses yield globally square-integrable cutoff functions, |
| 8 | their distributional first derivatives, and the corresponding elliptic fluxes. |
| 9 | On a smaller open neighborhood they satisfy the original weak equation. |
| 10 | -/ |
| 11 | |
| 12 | noncomputable section |
| 13 | |
| 14 | open Set MeasureTheory Function Topology |
| 15 | open scoped ENNReal ContDiff BigOperators |
| 16 | |
| 17 | namespace Poincare.Analysis.Elliptic |
| 18 | |
| 19 | open Sobolev.Weak Sobolev.NirenbergEuclidean |
| 20 | |
| 21 | variable {n : ℕ} |
| 22 | local notation "E" => EuclideanSpace ℝ (Fin n) |
| 23 | |
| 24 | /-- A continuous coefficient preserves global `L2` for a compactly supported function. -/ |
| 25 | theorem memLp_continuous_mul_of_hasCompactSupport |
| 26 | {a v : E → ℝ} (ha : Continuous a) (hv : MemLp v 2 volume) |
| 27 | (hvc : HasCompactSupport v) : MemLp (fun x => a x * v x) 2 volume := by |
| 28 | have hlocal := compact_memLp_mul_continuousOn (O := univ) ha.continuousOn |
| 29 | (fun K _ _ => hv.restrict K) hvc (subset_univ _) |
| 30 | have heq : (tsupport v).indicator (fun x => a x * v x) = fun x => a x * v x := by |
| 31 | ext x |
| 32 | by_cases hx : x ∈ tsupport v |
| 33 | · simp [hx] |
| 34 | · simp [hx, image_eq_zero_of_notMem_tsupport hx] |
| 35 | rw [← heq] |
| 36 | exact (memLp_indicator_iff_restrict (isClosed_tsupport v).measurableSet).mpr hlocal |
| 37 | |
| 38 | /-- Restriction and pointwise replacement on an open set preserve the raw weak equation. -/ |
| 39 | theorem weakEquation_congr_restrict |
| 40 | {O V : Set E} (hVO : V ⊆ O) |
| 41 | {A a : E → Matrix (Fin n) (Fin n) ℝ} {p q : Fin n → E → ℝ} {f : E → ℝ} |
| 42 | (ha : EqOn a A V) (hp : ∀ i, EqOn (q i) (p i) V) |
| 43 | (heq : ∀ φ : E → ℝ, ContDiff ℝ ∞ φ → HasCompactSupport φ → tsupport φ ⊆ O → |
| 44 | (∫ x in O, ∑ i, ∑ j, A x i j * p j x * |
| 45 | fderiv ℝ φ x (EuclideanSpace.single i 1)) = ∫ x in O, f x * φ x) : |
| 46 | ∀ φ : E → ℝ, ContDiff ℝ ∞ φ → HasCompactSupport φ → tsupport φ ⊆ V → |
| 47 | (∫ x in V, ∑ i, (∑ j, a x i j * q j x) * |
| 48 | fderiv ℝ φ x (EuclideanSpace.single i 1)) = ∫ x in V, f x * φ x := by |
| 49 | intro φ hφ hφc hφV |
| 50 | have hderivzero : ∀ i x, x ∉ V → |
| 51 | fderiv ℝ φ x (EuclideanSpace.single i 1) = 0 := by |
| 52 | intro i x hx |
| 53 | apply image_eq_zero_of_notMem_tsupport |
| 54 | (f := fun y => fderiv ℝ φ y (EuclideanSpace.single i 1)) |
| 55 | exact fun h => hx (hφV (tsupport_fderiv_apply_subset ℝ (EuclideanSpace.single i 1) h)) |
| 56 | have hφzero : ∀ x, x ∉ V → φ x = 0 := |
| 57 | fun x hx => image_eq_zero_of_notMem_tsupport (fun h => hx (hφV h)) |
| 58 | have hraw := heq φ hφ hφc (hφV.trans hVO) |
| 59 | rw [setIntegral_eq_integral_of_forall_compl_eq_zero |
| 60 | (fun x hx => by simp [hderivzero _ x (fun hv => hx (hVO hv))]), |
| 61 | setIntegral_eq_integral_of_forall_compl_eq_zero |
| 62 | (fun x hx => by simp [hφzero x (fun hv => hx (hVO hv))])] at hraw |
| 63 | rw [setIntegral_eq_integral_of_forall_compl_eq_zero |
| 64 | (fun x hx => by simp [hderivzero _ x hx]), |
| 65 | setIntegral_eq_integral_of_forall_compl_eq_zero |
| 66 | (fun x hx => by simp [hφzero x hx]), ← hraw] |
| 67 | apply integral_congr_ae |
| 68 | filter_upwards [] with x |
| 69 | by_cases hx : x ∈ V |
| 70 | · simp only [ha hx, hp _ hx, Finset.sum_mul] |
| 71 | · simp [hderivzero _ x hx] |
| 72 | |
| 73 | /-- Every point has localized global `H1` data and global `L2` fluxes for the |
| 74 | original weak equation, with a smooth uniformly elliptic coefficient extension. -/ |
| 75 | theorem exists_localized_weakEquation [NeZero n] |
| 76 | {O : Set E} (hO : IsOpen O) (A : E → Matrix (Fin n) (Fin n) ℝ) |
| 77 | (u f : E → ℝ) (p : Fin n → E → ℝ) |
| 78 | (hA : ∀ i j, ContDiffOn ℝ ∞ (fun x => A x i j) O) |
| 79 | (hpos : ∀ x ∈ O, (A x).PosDef) |
| 80 | (hu : ∀ K, IsCompact K → K ⊆ O → MemLp u 2 (volume.restrict K)) |
| 81 | (hp : ∀ i K, IsCompact K → K ⊆ O → MemLp (p i) 2 (volume.restrict K)) |
| 82 | (hf : ∀ K, IsCompact K → K ⊆ O → MemLp f 2 (volume.restrict K)) |
| 83 | (hpartial : ∀ i φ, ContDiff ℝ ∞ φ → HasCompactSupport φ → tsupport φ ⊆ O → |
| 84 | (∫ x in O, u x * fderiv ℝ φ x (EuclideanSpace.single i 1)) = |
| 85 | -(∫ x in O, p i x * φ x)) |
| 86 | (heq : ∀ φ, ContDiff ℝ ∞ φ → HasCompactSupport φ → tsupport φ ⊆ O → |
| 87 | (∫ x in O, ∑ i, ∑ j, A x i j * p j x * |
| 88 | fderiv ℝ φ x (EuclideanSpace.single i 1)) = ∫ x in O, f x * φ x) |
| 89 | {x : E} (hx : x ∈ O) : |
| 90 | ∃ (V : Set E) (B : SmoothEllipticBilinearForm n univ) |
| 91 | (u₀ : E → ℝ) (p₀ : Fin n → E → ℝ), |
| 92 | IsOpen V ∧ x ∈ V ∧ IsCompact (closure V) ∧ closure V ⊆ O ∧ |
| 93 | EqOn B.a A V ∧ EqOn u₀ u V ∧ (∀ i, EqOn (p₀ i) (p i) V) ∧ |
| 94 | HasCompactSupport u₀ ∧ (∀ i, HasCompactSupport (p₀ i)) ∧ |
| 95 | MemLp u₀ 2 volume ∧ (∀ i, MemLp (p₀ i) 2 volume) ∧ |
| 96 | (∀ i, HasWeakPartialDeriv i (p₀ i) u₀ univ) ∧ |
| 97 | (∀ i, MemLp (fun y => ∑ j, B.a y i j * p₀ j y) 2 volume) ∧ |
| 98 | MemLp f 2 (volume.restrict V) ∧ |
| 99 | (∀ φ : E → ℝ, ContDiff ℝ ∞ φ → HasCompactSupport φ → tsupport φ ⊆ V → |
| 100 | (∫ y in V, ∑ i, (∑ j, B.a y i j * p₀ j y) * |
| 101 | fderiv ℝ φ y (EuclideanSpace.single i 1)) = ∫ y in V, f y * φ y) := by |
| 102 | obtain ⟨V, hV, hxV, hVc, hVO, B, hBA, _⟩ := |
| 103 | exists_global_elliptic_extension hO (isCompact_singleton (x := x)) |
| 104 | (singleton_subset_iff.mpr hx) A (fun _ => 0) hA hpos contDiffOn_const |
| 105 | obtain ⟨χ, hχ, hχc, _, hχone, hχO⟩ := |
| 106 | SmoothEllipticBilinearForm.exists_cutoff hVc hO hVO |
| 107 | let u₀ : E → ℝ := fun y => χ y * u y |
| 108 | let p₀ : Fin n → E → ℝ := fun i y => χ y * p i y + |
| 109 | (fderiv ℝ χ y) (EuclideanSpace.single i 1) * u y |
| 110 | have heqOn := cutoff_eqOn_of_eq_one (u := u) (p := p) hV |
| 111 | (fun y hy => hχone y (subset_closure hy)) |
| 112 | have hp₀c (i : Fin n) : HasCompactSupport (p₀ i) := |
| 113 | hχc.mul_right.add (hχc.fderiv_apply (𝕜 := ℝ) (EuclideanSpace.single i 1)).mul_right |
| 114 | have hp₀ (i : Fin n) : MemLp (p₀ i) 2 volume := |
| 115 | memLp_cutoff_weakPartial i hu (hp i) hχ hχc hχO |
| 116 | refine ⟨V, B, u₀, p₀, hV, hxV (mem_singleton x), hVc, hVO, hBA, |
| 117 | heqOn.1, heqOn.2, hχc.mul_right, hp₀c, |
| 118 | memLp_mul_of_compact_memLp hu hχ.continuous hχc hχO, hp₀, ?_, ?_, ?_, ?_⟩ |
| 119 | · intro i |
| 120 | exact hasWeakPartialDeriv_cutoff i hu (hp i) (hpartial i) hχ hχc hχO |
| 121 | · intro i |
| 122 | exact memLp_finsetSum _ (fun j _ => |
| 123 | memLp_continuous_mul_of_hasCompactSupport (B.continuous_a i j) (hp₀ j) (hp₀c j)) |
| 124 | · exact (hf (closure V) hVc hVO).mono_measure (Measure.restrict_mono subset_closure le_rfl) |
| 125 | · exact weakEquation_congr_restrict (subset_closure.trans hVO) hBA heqOn.2 heq |
| 126 | |
| 127 | end Poincare.Analysis.Elliptic |