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.Eigenfunction |
| 2 | import PoincareLib.Analysis.Elliptic.Regularity.Iteration.TestCalculus |
| 3 | |
| 4 | /-! |
| 5 | # From adjoint elliptic equations to smooth harmonic functions |
| 6 | |
| 7 | The coefficient flux of a compactly supported smooth test is itself a smooth |
| 8 | compactly supported test. Integration by parts with the constructed weak |
| 9 | partials therefore converts the adjoint equation into the first-order weak |
| 10 | equation. Interior elliptic regularity then gives smoothness of a continuous |
| 11 | representative. |
| 12 | |
| 13 | This is the weak harmonic regularity step used in Morgan-Tian, |
| 14 | Proposition 2.3, printed pp. 21-23. |
| 15 | -/ |
| 16 | |
| 17 | noncomputable section |
| 18 | |
| 19 | open Set MeasureTheory Function Filter Topology |
| 20 | open scoped ENNReal ContDiff BigOperators |
| 21 | |
| 22 | namespace Poincare.Analysis.Elliptic |
| 23 | |
| 24 | open Iteration Sobolev.Weak |
| 25 | |
| 26 | variable {n : ℕ} |
| 27 | local notation "E" => EuclideanSpace ℝ (Fin n) |
| 28 | |
| 29 | private theorem integrable_mul_compact_test {O : Set E} {u ψ : E → ℝ} |
| 30 | (hu : ∀ K, IsCompact K → K ⊆ O → MemLp u 2 (volume.restrict K)) |
| 31 | (hψ : Continuous ψ) (hψc : HasCompactSupport ψ) (hψO : tsupport ψ ⊆ O) : |
| 32 | Integrable (fun x => u x * ψ x) (volume.restrict O) := by |
| 33 | let : IsFiniteMeasure (volume.restrict (tsupport ψ)) := ⟨by |
| 34 | simpa only [Measure.restrict_apply_univ] using hψc.measure_lt_top (μ := volume)⟩ |
| 35 | have huK : IntegrableOn u (tsupport ψ) := |
| 36 | (hu (tsupport ψ) hψc hψO).integrable (by norm_num) |
| 37 | have hprod := huK.mul_continuousOn hψ.continuousOn hψc |
| 38 | exact (hprod.integrable_of_forall_notMem_eq_zero |
| 39 | (fun x hx => by simp [image_eq_zero_of_notMem_tsupport hx])).integrableOn |
| 40 | |
| 41 | /-- Integrating the adjoint equation against the test flux produces the |
| 42 | usual first-order weak equation, using the actual weak partial derivatives. -/ |
| 43 | theorem weakEquation_of_adjoint [NeZero n] |
| 44 | {O : Set E} (hO : IsOpen O) |
| 45 | (A : E → Matrix (Fin n) (Fin n) ℝ) (u : E → ℝ) (p : Fin n → E → ℝ) |
| 46 | (hA : ∀ i j, ContDiffOn ℝ ∞ (fun x => A x i j) O) |
| 47 | (hsymm : ∀ x ∈ O, ∀ i j, A x i j = A x j i) |
| 48 | (hu : ∀ K, IsCompact K → K ⊆ O → MemLp u 2 (volume.restrict K)) |
| 49 | (hp : ∀ i K, IsCompact K → K ⊆ O → MemLp (p i) 2 (volume.restrict K)) |
| 50 | (hpartial : ∀ i, HasWeakPartialDeriv i (p i) u O) |
| 51 | (hadj : ∀ φ : E → ℝ, ContDiff ℝ ∞ φ → HasCompactSupport φ → tsupport φ ⊆ O → |
| 52 | (∫ x in O, u x * ∑ i, fderiv ℝ |
| 53 | (fun y => ∑ j, A y i j * fderiv ℝ φ y (EuclideanSpace.single j 1)) x |
| 54 | (EuclideanSpace.single i 1)) = 0) : |
| 55 | ∀ φ : E → ℝ, ContDiff ℝ ∞ φ → HasCompactSupport φ → tsupport φ ⊆ O → |
| 56 | (∫ x in O, ∑ i, ∑ j, A x i j * p j x * |
| 57 | fderiv ℝ φ x (EuclideanSpace.single i 1)) = 0 := by |
| 58 | intro φ hφ hφc hφO |
| 59 | let ψ : Fin n → E → ℝ := fun i x => ∑ j, A x i j * partialDeriv j φ x |
| 60 | have hψ (i : Fin n) : ContDiff ℝ ∞ (ψ i) := by |
| 61 | apply ContDiff.sum |
| 62 | intro j _ |
| 63 | simpa only [mul_comm] using contDiff_cutoff_mul hO (contDiff_partial hφ j) |
| 64 | (hA i j) ((tsupport_partial_subset j φ).trans hφO) |
| 65 | have hψsupp (i : Fin n) : tsupport (ψ i) ⊆ tsupport φ := by |
| 66 | apply closure_minimal _ (isClosed_tsupport φ) |
| 67 | intro x hx |
| 68 | by_contra hxφ |
| 69 | apply hx |
| 70 | change (∑ j, A x i j * partialDeriv j φ x) = 0 |
| 71 | apply Finset.sum_eq_zero |
| 72 | intro j _ |
| 73 | rw [image_eq_zero_of_notMem_tsupport |
| 74 | (fun h => hxφ (tsupport_partial_subset j φ h)), mul_zero] |
| 75 | have hψc (i : Fin n) : HasCompactSupport (ψ i) := |
| 76 | hφc.of_isClosed_subset (isClosed_tsupport _) (hψsupp i) |
| 77 | have hψO (i : Fin n) : tsupport (ψ i) ⊆ O := (hψsupp i).trans hφO |
| 78 | have hleft (i : Fin n) : Integrable (fun x => u x * partialDeriv i (ψ i) x) |
| 79 | (volume.restrict O) := |
| 80 | integrable_mul_compact_test hu (contDiff_partial (hψ i) i).continuous |
| 81 | (hasCompactSupport_partial (hψc i) i) ((tsupport_partial_subset i (ψ i)).trans (hψO i)) |
| 82 | have hright (i : Fin n) : Integrable (fun x => p i x * ψ i x) (volume.restrict O) := |
| 83 | integrable_mul_compact_test (hp i) (hψ i).continuous (hψc i) (hψO i) |
| 84 | have hibp (i : Fin n) : (∫ x in O, u x * partialDeriv i (ψ i) x) = |
| 85 | -(∫ x in O, p i x * ψ i x) := |
| 86 | hpartial i (ψ i) (hψ i) (hψc i) (hψO i) |
| 87 | have hzero := hadj φ hφ hφc hφO |
| 88 | change (∫ x in O, u x * ∑ i, partialDeriv i (ψ i) x) = 0 at hzero |
| 89 | simp_rw [Finset.mul_sum] at hzero |
| 90 | rw [integral_finsetSum Finset.univ (fun i _ => hleft i)] at hzero |
| 91 | simp_rw [hibp] at hzero |
| 92 | rw [Finset.sum_neg_distrib] at hzero |
| 93 | have hflux : (∫ x in O, ∑ i, p i x * ψ i x) = 0 := by |
| 94 | rw [integral_finsetSum Finset.univ (fun i _ => hright i)] |
| 95 | exact neg_eq_zero.mp hzero |
| 96 | calc |
| 97 | (∫ x in O, ∑ i, ∑ j, A x i j * p j x * |
| 98 | fderiv ℝ φ x (EuclideanSpace.single i 1)) = |
| 99 | ∫ x in O, ∑ i, p i x * ψ i x := by |
| 100 | apply integral_congr_ae |
| 101 | filter_upwards [ae_restrict_mem hO.measurableSet] with x hx |
| 102 | dsimp only [ψ, partialDeriv] |
| 103 | simp only [Finset.mul_sum] |
| 104 | rw [Finset.sum_comm] |
| 105 | apply Finset.sum_congr rfl |
| 106 | intro i _ |
| 107 | apply Finset.sum_congr rfl |
| 108 | intro j _ |
| 109 | rw [hsymm x hx j i] |
| 110 | ring |
| 111 | _ = 0 := hflux |
| 112 | |
| 113 | /-- A continuous distributional harmonic function with locally square |
| 114 | integrable weak partials is smooth for smooth positive definite coefficients. -/ |
| 115 | theorem contDiffOn_of_continuous_of_adjoint (hn : 0 < n) |
| 116 | {O : Set E} (hO : IsOpen O) (A : E → Matrix (Fin n) (Fin n) ℝ) |
| 117 | (hA : ∀ i j, ContDiffOn ℝ ∞ (fun x => A x i j) O) |
| 118 | (hpos : ∀ x ∈ O, (A x).PosDef) |
| 119 | (u : E → ℝ) (hu : ContinuousOn u O) (p : Fin n → E → ℝ) |
| 120 | (huL2 : ∀ K, IsCompact K → K ⊆ O → MemLp u 2 (volume.restrict K)) |
| 121 | (hp : ∀ i K, IsCompact K → K ⊆ O → MemLp (p i) 2 (volume.restrict K)) |
| 122 | (hpartial : ∀ i φ, ContDiff ℝ ∞ φ → HasCompactSupport φ → tsupport φ ⊆ O → |
| 123 | (∫ x in O, u x * fderiv ℝ φ x (EuclideanSpace.single i 1)) = |
| 124 | -(∫ x in O, p i x * φ x)) |
| 125 | (hadj : ∀ φ : E → ℝ, ContDiff ℝ ∞ φ → HasCompactSupport φ → tsupport φ ⊆ O → |
| 126 | (∫ x in O, u x * ∑ i, fderiv ℝ |
| 127 | (fun y => ∑ j, A y i j * fderiv ℝ φ y (EuclideanSpace.single j 1)) x |
| 128 | (EuclideanSpace.single i 1)) = 0) : |
| 129 | ContDiffOn ℝ ∞ u O := by |
| 130 | let : NeZero n := ⟨Nat.ne_of_gt hn⟩ |
| 131 | have hsymm : ∀ x ∈ O, ∀ i j, A x i j = A x j i := by |
| 132 | intro x hx i j |
| 133 | simpa using (hpos x hx).isHermitian.apply j i |
| 134 | have heq := weakEquation_of_adjoint hO A u p hA hsymm huL2 hp hpartial hadj |
| 135 | obtain ⟨U, hU, hUu⟩ := exists_smooth_representative hn hO A (fun _ => 0) u p |
| 136 | hA hpos contDiffOn_const huL2 hp hpartial (by |
| 137 | intro φ hφ hφc hφO |
| 138 | simpa only [zero_mul, integral_zero] using heq φ hφ hφc hφO) |
| 139 | have heqOn := Measure.eqOn_open_of_ae_eq hUu hO hU.continuousOn hu |
| 140 | exact hU.congr fun x hx => (heqOn hx).symm |
| 141 | |
| 142 | end Poincare.Analysis.Elliptic |