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.TimeIdentification |
| 2 | |
| 3 | /-! # Identification of bounded almost-everywhere derivative limits -/ |
| 4 | |
| 5 | noncomputable section |
| 6 | set_option autoImplicit false |
| 7 | |
| 8 | open Set Filter MeasureTheory |
| 9 | open scoped ContDiff Topology NNReal ENNReal |
| 10 | |
| 11 | namespace Poincare.Analysis.Elliptic |
| 12 | |
| 13 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 14 | [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] |
| 15 | {μ : Measure E} [μ.IsAddHaarMeasure] |
| 16 | |
| 17 | theorem ae_directional_fderiv_eq_of_bounded_tendsto |
| 18 | {U : Set E} (hU : IsOpen U) [IsFiniteMeasure (μ.restrict U)] |
| 19 | {u : ℕ → E → ℝ} {v F : E → ℝ} {L : ℝ≥0} {C : ℝ} |
| 20 | (hu : ∀ᶠ k in atTop, LipschitzOnWith L (u k) U) |
| 21 | (hv : LipschitzOnWith L v U) |
| 22 | (hub : ∀ᶠ k in atTop, ∀ x ∈ U, ‖u k x‖ ≤ C) |
| 23 | (hlim : ∀ x ∈ U, Tendsto (fun k => u k x) atTop (𝓝 (v x))) |
| 24 | (w : E) |
| 25 | (hdlim : ∀ᵐ x ∂μ.restrict U, |
| 26 | Tendsto (fun k => fderiv ℝ (u k) x w) atTop (𝓝 (F x))) : |
| 27 | (fun x => fderiv ℝ v x w) =ᵐ[μ.restrict U] F := by |
| 28 | obtain ⟨N, hN⟩ := eventually_atTop.1 hu |
| 29 | have hm (k : ℕ) : AEStronglyMeasurable |
| 30 | (fun x => fderiv ℝ (u (k + N)) x w) (μ.restrict U) := |
| 31 | (memLp_top_directional_fderiv_of_lipschitzOn (μ := μ) hU |
| 32 | (hN _ (Nat.le_add_left N k)) w).aestronglyMeasurable |
| 33 | have hFm : AEStronglyMeasurable F (μ.restrict U) := |
| 34 | aestronglyMeasurable_of_tendsto_ae atTop hm |
| 35 | (hdlim.mono fun x hx => hx.comp (tendsto_add_atTop_nat N)) |
| 36 | have hFb : ∀ᵐ x ∂μ.restrict U, ‖F x‖ ≤ (L : ℝ) * ‖w‖ := by |
| 37 | filter_upwards [hdlim, ae_restrict_mem hU.measurableSet] with x hx hxU |
| 38 | apply le_of_tendsto hx.norm |
| 39 | filter_upwards [hu] with k hk |
| 40 | exact ((fderiv ℝ (u k) x).le_opNorm w).trans |
| 41 | (mul_le_mul_of_nonneg_right |
| 42 | (norm_fderiv_le_of_lipschitzOn ℝ (hU.mem_nhds hxU) hk) (norm_nonneg _)) |
| 43 | exact ae_directional_fderiv_eq_of_tendsto hU hu hv hub hlim w |
| 44 | ((memLp_top_of_bound hFm _ hFb).integrable le_top) hdlim |
| 45 | |
| 46 | end Poincare.Analysis.Elliptic |