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.ForwardEquation |
| 2 | |
| 3 | /-! # The local diffusion operator on smooth tests -/ |
| 4 | |
| 5 | noncomputable section |
| 6 | set_option autoImplicit false |
| 7 | set_option backward.isDefEq.respectTransparency false |
| 8 | |
| 9 | open Set |
| 10 | open scoped ContDiff |
| 11 | |
| 12 | namespace Poincare.Analysis.Parabolic.WeakRegularity.Canonical |
| 13 | |
| 14 | variable {n : ℕ} |
| 15 | |
| 16 | /-- The test operator paired with a forward density for a nondivergence |
| 17 | diffusion. On smooth coefficient domains it is the expanded canonical adjoint. -/ |
| 18 | def diffusionTest |
| 19 | (a : Fin n → Fin n → Spacetime n → ℝ) (b : Fin n → Spacetime n → ℝ) |
| 20 | (φ : Spacetime n → ℝ) (z : Spacetime n) : ℝ := |
| 21 | -timeDeriv φ z - (∑ i, ∑ j, a i j z * spatialDeriv j (spatialDeriv i φ) z) - |
| 22 | ∑ i, b i z * spatialDeriv i φ z |
| 23 | |
| 24 | theorem diffusionTest_add |
| 25 | (a : Fin n → Fin n → Spacetime n → ℝ) (b : Fin n → Spacetime n → ℝ) |
| 26 | {φ ψ : Spacetime n → ℝ} (hφ : ContDiff ℝ ∞ φ) (hψ : ContDiff ℝ ∞ ψ) : |
| 27 | diffusionTest a b (fun z => φ z + ψ z) = |
| 28 | fun z => diffusionTest a b φ z + diffusionTest a b ψ z := by |
| 29 | have hs (i) : spatialDeriv i (fun z => φ z + ψ z) = |
| 30 | fun z => spatialDeriv i φ z + spatialDeriv i ψ z := by |
| 31 | funext z |
| 32 | simp only [spatialDeriv, fderiv_fun_add (hφ.differentiable (by simp) z) |
| 33 | (hψ.differentiable (by simp) z), add_apply] |
| 34 | have hss (i j) (z) : spatialDeriv j (spatialDeriv i (fun y => φ y + ψ y)) z = |
| 35 | spatialDeriv j (spatialDeriv i φ) z + spatialDeriv j (spatialDeriv i ψ) z := by |
| 36 | rw [hs] |
| 37 | have hdφ : ContDiff ℝ ∞ (spatialDeriv i φ) := |
| 38 | (hφ.fderiv_right (by simp)).clm_apply contDiff_const |
| 39 | have hdψ : ContDiff ℝ ∞ (spatialDeriv i ψ) := |
| 40 | (hψ.fderiv_right (by simp)).clm_apply contDiff_const |
| 41 | change fderiv ℝ (fun y => spatialDeriv i φ y + spatialDeriv i ψ y) z |
| 42 | (spatialDirection j) = _ |
| 43 | rw [fderiv_fun_add (hdφ.differentiable (by simp) z) |
| 44 | (hdψ.differentiable (by simp) z)] |
| 45 | rfl |
| 46 | have ht (z) : timeDeriv (fun y => φ y + ψ y) z = timeDeriv φ z + timeDeriv ψ z := by |
| 47 | simp only [timeDeriv, fderiv_fun_add (hφ.differentiable (by simp) z) |
| 48 | (hψ.differentiable (by simp) z), add_apply] |
| 49 | funext z |
| 50 | simp only [diffusionTest, ht, hss] |
| 51 | simp only [hs, mul_add, Finset.sum_add_distrib] |
| 52 | ring |
| 53 | |
| 54 | theorem diffusionTest_eq_zero_of_notMem_tsupport |
| 55 | (a : Fin n → Fin n → Spacetime n → ℝ) (b : Fin n → Spacetime n → ℝ) |
| 56 | (φ : Spacetime n → ℝ) {z : Spacetime n} (hz : z ∉ tsupport φ) : |
| 57 | diffusionTest a b φ z = 0 := by |
| 58 | have ht : timeDeriv φ z = 0 := |
| 59 | image_eq_zero_of_notMem_tsupport (fun h => hz (tsupport_fderiv_apply_subset ℝ (0, 1) h)) |
| 60 | have hs (i) : spatialDeriv i φ z = 0 := |
| 61 | image_eq_zero_of_notMem_tsupport |
| 62 | (fun h => hz (tsupport_fderiv_apply_subset ℝ (spatialDirection i) h)) |
| 63 | have hss (i j) : spatialDeriv j (spatialDeriv i φ) z = 0 := |
| 64 | image_eq_zero_of_notMem_tsupport (fun h => hz |
| 65 | (tsupport_fderiv_apply_subset ℝ (spatialDirection i) |
| 66 | (tsupport_fderiv_apply_subset ℝ (spatialDirection j) h))) |
| 67 | simp only [diffusionTest, ht, hs, hss, mul_zero, Finset.sum_const_zero, |
| 68 | neg_zero, sub_zero] |
| 69 | |
| 70 | end Poincare.Analysis.Parabolic.WeakRegularity.Canonical |