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.Geometry.RicciFlow.ReducedGeometry.ReducedVolume.Analysis.Integration.DivergenceIntegration |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedVolume.Analysis.Integration.SupportedCalculus |
| 3 | import Mathlib.Analysis.Calculus.ContDiff.Comp |
| 4 | |
| 5 | /-! |
| 6 | # Compact-support producers for divergence integration |
| 7 | |
| 8 | The scalar or the vector factor may have compact support. In either |
| 9 | case local C1 regularity on an open neighborhood of that support |
| 10 | produces every integrability hypothesis of integration by parts. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open Set MeasureTheory |
| 16 | open scoped ContDiff BigOperators |
| 17 | |
| 18 | namespace PoincareMT.ReducedVolume |
| 19 | |
| 20 | variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] |
| 21 | [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] |
| 22 | {μ : Measure E} [Measure.IsAddHaarMeasure μ] |
| 23 | {ι : Type*} [Fintype ι] |
| 24 | |
| 25 | /-- A compactly supported C1 vector field gives a local scalar integration-by-parts identity. -/ |
| 26 | theorem integral_mul_trace_fderiv_of_compact_vector |
| 27 | (b : OrthonormalBasis ι ℝ E) {U : Set E} (hU : IsOpen U) |
| 28 | {u : E → ℝ} {V : E → E} (hu : ContDiffOn ℝ 1 u U) (hV : ContDiff ℝ 1 V) |
| 29 | (hc : HasCompactSupport V) (hs : tsupport V ⊆ U) : |
| 30 | Integrable (fun x ↦ u x * LinearMap.trace ℝ E (fderiv ℝ V x).toLinearMap) μ ∧ |
| 31 | Integrable (fun x ↦ fderiv ℝ u x (V x)) μ ∧ |
| 32 | (∫ x, u x * LinearMap.trace ℝ E (fderiv ℝ V x).toLinearMap ∂μ) = |
| 33 | -(∫ x, fderiv ℝ u x (V x) ∂μ) := by |
| 34 | have hdu : ContinuousOn (fderiv ℝ u) U := hu.continuousOn_fderiv_of_isOpen hU le_rfl |
| 35 | have hdV : Continuous (fderiv ℝ V) := hV.continuous_fderiv one_ne_zero |
| 36 | have hinner (i : ι) : tsupport (fun x ↦ inner ℝ (b i) (V x)) ⊆ tsupport V := |
| 37 | tsupport_comp_subset (g := fun v : E ↦ inner ℝ (b i) v) (by simp) V |
| 38 | have hinnerD (i : ι) : |
| 39 | tsupport (fun x ↦ inner ℝ (b i) (fderiv ℝ V x (b i))) ⊆ tsupport V := |
| 40 | (tsupport_comp_subset (g := fun v : E ↦ inner ℝ (b i) v) (by simp) |
| 41 | (fun x ↦ fderiv ℝ V x (b i))).trans (tsupport_fderiv_apply_subset ℝ (b i)) |
| 42 | apply integral_mul_trace_fderiv b |
| 43 | (fun x hx ↦ (hu.contDiffAt (hU.mem_nhds (hs hx))).differentiableAt one_ne_zero) |
| 44 | (fun x _ ↦ hV.differentiable one_ne_zero x) |
| 45 | · intro i |
| 46 | apply integrable_of_continuousOn_of_tsupport_subset hU hc hs |
| 47 | · exact (hdu.clm_apply continuousOn_const).mul |
| 48 | (continuousOn_const.inner hV.continuous.continuousOn) |
| 49 | · exact tsupport_mul_subset_right.trans (hinner i) |
| 50 | · intro i |
| 51 | apply integrable_of_continuousOn_of_tsupport_subset hU hc hs |
| 52 | · exact hu.continuousOn.mul |
| 53 | (continuousOn_const.inner ((hdV.clm_apply continuous_const).continuousOn)) |
| 54 | · exact tsupport_mul_subset_right.trans (hinnerD i) |
| 55 | · intro i |
| 56 | apply integrable_of_continuousOn_of_tsupport_subset hU hc hs |
| 57 | · exact hu.continuousOn.mul (continuousOn_const.inner hV.continuous.continuousOn) |
| 58 | · exact tsupport_mul_subset_right.trans (hinner i) |
| 59 | |
| 60 | /-- A compactly supported scalar test gives integration by parts against a locally C1 field. -/ |
| 61 | theorem integral_mul_trace_fderiv_of_compact_scalar |
| 62 | (b : OrthonormalBasis ι ℝ E) {U : Set E} (hU : IsOpen U) |
| 63 | {u : E → ℝ} {V : E → E} (hu : ContDiff ℝ 1 u) (hV : ContDiffOn ℝ 1 V U) |
| 64 | (hc : HasCompactSupport u) (hs : tsupport u ⊆ U) : |
| 65 | Integrable (fun x ↦ u x * LinearMap.trace ℝ E (fderiv ℝ V x).toLinearMap) μ ∧ |
| 66 | Integrable (fun x ↦ fderiv ℝ u x (V x)) μ ∧ |
| 67 | (∫ x, u x * LinearMap.trace ℝ E (fderiv ℝ V x).toLinearMap ∂μ) = |
| 68 | -(∫ x, fderiv ℝ u x (V x) ∂μ) := by |
| 69 | have hdu : Continuous (fderiv ℝ u) := hu.continuous_fderiv one_ne_zero |
| 70 | have hdV : ContinuousOn (fderiv ℝ V) U := hV.continuousOn_fderiv_of_isOpen hU le_rfl |
| 71 | apply integral_mul_trace_fderiv b |
| 72 | (fun x _ ↦ hu.differentiable one_ne_zero x) |
| 73 | (fun x hx ↦ (hV.contDiffAt (hU.mem_nhds (hs hx))).differentiableAt one_ne_zero) |
| 74 | · intro i |
| 75 | apply integrable_of_continuousOn_of_tsupport_subset hU hc hs |
| 76 | · exact (hdu.clm_apply continuous_const).continuousOn.mul |
| 77 | (continuousOn_const.inner hV.continuousOn) |
| 78 | · exact tsupport_mul_subset_left.trans (tsupport_fderiv_apply_subset ℝ (b i)) |
| 79 | · intro i |
| 80 | apply integrable_of_continuousOn_of_tsupport_subset hU hc hs |
| 81 | · exact hu.continuous.continuousOn.mul |
| 82 | (continuousOn_const.inner (hdV.clm_apply continuousOn_const)) |
| 83 | · exact tsupport_mul_subset_left |
| 84 | · intro i |
| 85 | apply integrable_of_continuousOn_of_tsupport_subset hU hc hs |
| 86 | · exact hu.continuous.continuousOn.mul (continuousOn_const.inner hV.continuousOn) |
| 87 | · exact tsupport_mul_subset_left |
| 88 | |
| 89 | end PoincareMT.ReducedVolume |