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.LocalDivergenceIntegration |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedVolume.WeakInequality.Operator.WeightedMetricDual |
| 3 | |
| 4 | /-! |
| 5 | # Local Green identity for the actual weighted metric operator |
| 6 | |
| 7 | The two compact-support integration-by-parts identities have the same |
| 8 | middle integrand by symmetry of the invertible metric form. All three |
| 9 | integrability conclusions are produced on the open coordinate domain. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | open Set MeasureTheory |
| 15 | open scoped ContDiff |
| 16 | |
| 17 | namespace PoincareMT.ReducedVolume |
| 18 | |
| 19 | variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] |
| 20 | [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] |
| 21 | {μ : Measure E} [Measure.IsAddHaarMeasure μ] |
| 22 | |
| 23 | omit [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] in |
| 24 | /-- Symmetry of an invertible form gives symmetry of its inverse differential pairing. -/ |
| 25 | theorem inverse_bilinear_pairing_symm (B : E →L[ℝ] E →L[ℝ] ℝ) |
| 26 | (hi : B.IsInvertible) (hs : ∀ v w, B v w = B w v) (d e : E →L[ℝ] ℝ) : |
| 27 | d (B.inverse e) = e (B.inverse d) := by |
| 28 | have hd := congrArg (fun a : E →L[ℝ] ℝ ↦ a (B.inverse e)) (hi.self_apply_inverse d) |
| 29 | have he := congrArg (fun a : E →L[ℝ] ℝ ↦ a (B.inverse d)) (hi.self_apply_inverse e) |
| 30 | exact hd.symm.trans ((hs _ _).trans he) |
| 31 | |
| 32 | /-- A compactly supported test gives the local weighted Green identity and integrability. -/ |
| 33 | theorem integral_weighted_green {ι : Type*} [Fintype ι] (b : OrthonormalBasis ι ℝ E) |
| 34 | {U : Set E} (hU : IsOpen U) {B : E → E →L[ℝ] E →L[ℝ] ℝ} {ρ u ψ : E → ℝ} |
| 35 | (hB : ContDiffOn ℝ 1 B U) (hρ : ContDiffOn ℝ 1 ρ U) |
| 36 | (hi : ∀ x ∈ U, (B x).IsInvertible) (hBs : ∀ x ∈ U, ∀ v w, B x v w = B x w v) |
| 37 | (hu : ContDiffOn ℝ 2 u U) (hψ : ContDiff ℝ 2 ψ) |
| 38 | (hc : HasCompactSupport ψ) (hs : tsupport ψ ⊆ U) : |
| 39 | Integrable (fun x ↦ u x * LinearMap.trace ℝ E |
| 40 | (fderiv ℝ (weightedMetricDual B ρ ψ) x).toLinearMap) μ ∧ |
| 41 | Integrable (fun x ↦ ψ x * LinearMap.trace ℝ E |
| 42 | (fderiv ℝ (weightedMetricDual B ρ u) x).toLinearMap) μ ∧ |
| 43 | (∫ x, u x * LinearMap.trace ℝ E |
| 44 | (fderiv ℝ (weightedMetricDual B ρ ψ) x).toLinearMap ∂μ) = |
| 45 | ∫ x, ψ x * LinearMap.trace ℝ E |
| 46 | (fderiv ℝ (weightedMetricDual B ρ u) x).toLinearMap ∂μ := by |
| 47 | have hVu : ContDiffOn ℝ 1 (weightedMetricDual B ρ u) U := by |
| 48 | intro x hx |
| 49 | exact (weightedMetricDual_contDiffAt (hB.contDiffAt (hU.mem_nhds hx)) |
| 50 | (hρ.contDiffAt (hU.mem_nhds hx)) (hu.contDiffAt (hU.mem_nhds hx)) |
| 51 | (hi x hx)).contDiffWithinAt |
| 52 | have hVψ := weightedMetricDual_contDiff_of_tsupport_subset hU hB hρ hψ.contDiffOn hi hs |
| 53 | have hleft := integral_mul_trace_fderiv_of_compact_vector (μ := μ) b hU |
| 54 | (hu.of_le (by norm_num)) hVψ (weightedMetricDual_hasCompactSupport B ρ hc) |
| 55 | ((tsupport_weightedMetricDual_subset B ρ ψ).trans hs) |
| 56 | have hright := integral_mul_trace_fderiv_of_compact_scalar (μ := μ) b hU |
| 57 | (hψ.of_le (by norm_num)) hVu hc hs |
| 58 | refine ⟨hleft.1, hright.1, hleft.2.2.trans ?_⟩ |
| 59 | rw [hright.2.2] |
| 60 | congr 1 |
| 61 | apply integral_congr_ae |
| 62 | exact Filter.Eventually.of_forall (fun x ↦ by |
| 63 | by_cases hx : x ∈ U |
| 64 | · simp only [weightedMetricDual, map_smul, smul_eq_mul] |
| 65 | rw [inverse_bilinear_pairing_symm (B x) (hi x hx) (hBs x hx)] |
| 66 | · have hxs : x ∉ tsupport ψ := fun h ↦ hx (hs h) |
| 67 | simp only [weightedMetricDual, fderiv_of_notMem_tsupport ℝ hxs, map_zero, |
| 68 | smul_zero, zero_apply]) |
| 69 | |
| 70 | end PoincareMT.ReducedVolume |