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.Parabolic.WeakRegularity.CanonicalEquation |
| 2 | import PoincareLib.Analysis.Calculus.WeakDerivative.LipschitzGreen |
| 3 | import Mathlib.MeasureTheory.Group.Prod |
| 4 | |
| 5 | /-! |
| 6 | # Weak spacetime integration by parts for a diffusion density |
| 7 | |
| 8 | The density and the scalar function may be merely Lipschitz. Smooth flux |
| 9 | coefficients need only be defined on the open domain of the compact test. |
| 10 | -/ |
| 11 | |
| 12 | noncomputable section |
| 13 | |
| 14 | open Set Filter MeasureTheory |
| 15 | open scoped ContDiff Topology NNReal |
| 16 | |
| 17 | namespace Poincare.Analysis.Parabolic.WeakRegularity.Canonical |
| 18 | |
| 19 | variable {n : ℕ} {U : Set (Spacetime n)} |
| 20 | |
| 21 | local instance : (volume : Measure (Spacetime n)).IsAddHaarMeasure := by |
| 22 | change ((volume : Measure (Euclid n)).prod (volume : Measure ℝ)).IsAddHaarMeasure |
| 23 | infer_instance |
| 24 | |
| 25 | private theorem smooth_of_supported (hU : IsOpen U) {f : Spacetime n → ℝ} |
| 26 | (hf : ContDiffOn ℝ ∞ f U) (hs : tsupport f ⊆ U) : ContDiff ℝ ∞ f := by |
| 27 | rw [contDiff_iff_contDiffAt] |
| 28 | intro z |
| 29 | by_cases hz : z ∈ tsupport f |
| 30 | · exact (hf z (hs hz)).contDiffAt (hU.mem_nhds (hs hz)) |
| 31 | · exact contDiffAt_const.congr_of_eventuallyEq |
| 32 | (notMem_tsupport_iff_eventuallyEq.mp hz) |
| 33 | |
| 34 | /-- Transfer the time derivative of the density and the spatial gradient of |
| 35 | the scalar to the same smooth compact test, with both pairings integrable. -/ |
| 36 | theorem integral_density_flux_eq_neg |
| 37 | (hU : IsOpen U) {u w : Spacetime n → ℝ} {Cu Cw : ℝ≥0} |
| 38 | (hu : LipschitzOnWith Cu u U) (hw : LipschitzOnWith Cw w U) |
| 39 | {A : Fin n → Fin n → Spacetime n → ℝ} |
| 40 | (hA : ∀ i j, ContDiffOn ℝ ∞ (A i j) U) |
| 41 | {φ : Spacetime n → ℝ} (hφ : ContDiff ℝ ∞ φ) |
| 42 | (hφc : HasCompactSupport φ) (hφU : tsupport φ ⊆ U) : |
| 43 | let Q := fun i z => ∑ j, A i j z * spatialDeriv j φ z |
| 44 | Integrable (fun z => timeDeriv w z * φ z + ∑ i, spatialDeriv i u z * Q i z) ∧ |
| 45 | Integrable (fun z => w z * timeDeriv φ z + u z * ∑ i, spatialDeriv i (Q i) z) ∧ |
| 46 | (∫ z, timeDeriv w z * φ z + ∑ i, spatialDeriv i u z * Q i z) = |
| 47 | -(∫ z, w z * timeDeriv φ z + u z * ∑ i, spatialDeriv i (Q i) z) := by |
| 48 | classical |
| 49 | let Q := fun i z => ∑ j, A i j z * spatialDeriv j φ z |
| 50 | have hd (j) : ContDiff ℝ ∞ (spatialDeriv j φ) := |
| 51 | (hφ.fderiv_right (by simp)).clm_apply contDiff_const |
| 52 | have hQs (i) : tsupport (Q i) ⊆ tsupport φ := by |
| 53 | apply closure_minimal ?_ (isClosed_tsupport φ) |
| 54 | intro z hz |
| 55 | by_contra hzφ |
| 56 | have hzj (j) : spatialDeriv j φ z = 0 := |
| 57 | image_eq_zero_of_notMem_tsupport |
| 58 | (fun h => hzφ (tsupport_fderiv_apply_subset ℝ (spatialDirection j) h)) |
| 59 | exact hz (by simp only [Q, hzj, mul_zero, Finset.sum_const_zero]) |
| 60 | have hQc (i) : HasCompactSupport (Q i) := |
| 61 | hφc.of_isClosed_subset (isClosed_tsupport _) (hQs i) |
| 62 | have hQ (i) : ContDiff ℝ ∞ (Q i) := by |
| 63 | apply smooth_of_supported hU ?_ ((hQs i).trans hφU) |
| 64 | exact ContDiffOn.sum (fun j _ => (hA i j).mul (hd j).contDiffOn) |
| 65 | have ht := WeakDerivative.integral_mul_fderiv_eq_neg volume hU hw hφ hφc hφU (0, 1) |
| 66 | have hs := WeakDerivative.integral_mul_sum_fderiv_eq_neg volume hU hu spatialDirection Q |
| 67 | hQ hQc (fun i => (hQs i).trans hφU) |
| 68 | refine ⟨ht.1.add hs.1, ht.2.1.add hs.2.1, ?_⟩ |
| 69 | change (∫ z, fderiv ℝ w z (0, 1) * φ z + |
| 70 | ∑ i, fderiv ℝ u z (spatialDirection i) * Q i z) = |
| 71 | -(∫ z, w z * fderiv ℝ φ z (0, 1) + |
| 72 | u z * ∑ i, fderiv ℝ (Q i) z (spatialDirection i)) |
| 73 | rw [integral_add ht.1 hs.1, integral_add ht.2.1 hs.2.1] |
| 74 | linarith [ht.2.2, hs.2.2] |
| 75 | |
| 76 | end Poincare.Analysis.Parabolic.WeakRegularity.Canonical |