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.Energy |
| 2 | import PoincareLib.Analysis.Elliptic.Regularity.WeakDerivativeLimit |
| 3 | |
| 4 | /-! |
| 5 | # Local L2 norms and weighted energy |
| 6 | |
| 7 | These lemmas connect scalar coordinate derivatives, represented as actual |
| 8 | functions, to their classes in the complete space L2. |
| 9 | -/ |
| 10 | |
| 11 | noncomputable section |
| 12 | set_option backward.isDefEq.respectTransparency false |
| 13 | |
| 14 | open Set MeasureTheory Filter |
| 15 | open scoped Topology ENNReal NNReal BigOperators InnerProductSpace |
| 16 | |
| 17 | namespace Poincare.Analysis.Elliptic |
| 18 | |
| 19 | /-- The actual coordinate derivative of a Lipschitz function as an L2 class. -/ |
| 20 | def lipschitzPartialL2 {d : ℕ} {O : Set (EuclideanSpace ℝ (Fin d))} |
| 21 | [IsFiniteMeasure (volume.restrict O)] (hO : IsOpen O) |
| 22 | {u : EuclideanSpace ℝ (Fin d) → ℝ} {L : ℝ≥0} |
| 23 | (hu : LipschitzOnWith L u O) (i : Fin d) : Lp ℝ 2 (volume.restrict O) := |
| 24 | ((Poincare.Analysis.Sobolev.Weak.memLp_top_fderiv_apply_of_lipschitzOn hO hu |
| 25 | (EuclideanSpace.single i 1)).mono_exponent (p := 2) le_top).toLp _ |
| 26 | |
| 27 | theorem coeFn_lipschitzPartialL2 {d : ℕ} {O : Set (EuclideanSpace ℝ (Fin d))} |
| 28 | [IsFiniteMeasure (volume.restrict O)] (hO : IsOpen O) |
| 29 | {u : EuclideanSpace ℝ (Fin d) → ℝ} {L : ℝ≥0} |
| 30 | (hu : LipschitzOnWith L u O) (i : Fin d) : |
| 31 | lipschitzPartialL2 hO hu i =ᵐ[volume.restrict O] |
| 32 | fun x => fderiv ℝ u x (EuclideanSpace.single i 1) := |
| 33 | MemLp.coeFn_toLp _ |
| 34 | |
| 35 | /-- The squared L2 distance is the integral of the squared pointwise difference. -/ |
| 36 | theorem norm_toLp_sub_sq_eq_integral |
| 37 | {X : Type*} [MeasurableSpace X] {μ : Measure X} {f g : X → ℝ} |
| 38 | (hf : MemLp f 2 μ) (hg : MemLp g 2 μ) : |
| 39 | ‖hf.toLp f - hg.toLp g‖ ^ 2 = ∫ x, (f x - g x) ^ 2 ∂μ := by |
| 40 | rw [← MemLp.toLp_sub hf hg, ← real_inner_self_eq_norm_sq, L2.inner_def] |
| 41 | apply integral_congr_ae |
| 42 | filter_upwards [(hf.sub hg).coeFn_toLp] with x hx |
| 43 | rw [hx] |
| 44 | simp only [Pi.sub_apply, real_inner_self_eq_norm_sq, Real.norm_eq_abs, sq_abs] |
| 45 | |
| 46 | /-- A nonnegative weighted energy on a larger domain bounds a local L2 distance. -/ |
| 47 | theorem norm_toLp_sub_sq_le_integral |
| 48 | {X : Type*} [MeasurableSpace X] {μ : Measure X} {U O : Set X} |
| 49 | (hU : MeasurableSet U) (hO : MeasurableSet O) (hUO : U ⊆ O) |
| 50 | {f g energy : X → ℝ} |
| 51 | (hf : MemLp f 2 (μ.restrict U)) (hg : MemLp g 2 (μ.restrict U)) |
| 52 | (he : IntegrableOn energy O μ) |
| 53 | (he0 : ∀ x ∈ O, 0 ≤ energy x) |
| 54 | (hbound : ∀ x ∈ U, (f x - g x) ^ 2 ≤ energy x) : |
| 55 | ‖hf.toLp f - hg.toLp g‖ ^ 2 ≤ ∫ x in O, energy x ∂μ := by |
| 56 | rw [norm_toLp_sub_sq_eq_integral] |
| 57 | have hsq : IntegrableOn (fun x => (f x - g x) ^ 2) U μ := by |
| 58 | have heq : (fun x => (f x - g x) ^ 2) = (f - g) * (f - g) := by |
| 59 | funext x |
| 60 | simp only [pow_two, Pi.mul_apply, Pi.sub_apply] |
| 61 | rw [IntegrableOn, heq] |
| 62 | exact (hf.sub hg).integrable_mul (hf.sub hg) |
| 63 | refine (setIntegral_mono_on hsq (he.mono_set hUO) hU hbound).trans ?_ |
| 64 | apply setIntegral_mono_set he |
| 65 | · filter_upwards [ae_restrict_mem hO] with x hx |
| 66 | exact he0 x hx |
| 67 | · exact Eventually.of_forall hUO |
| 68 | |
| 69 | end Poincare.Analysis.Elliptic |