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.Curvature.Integral.Bochner |
| 2 | import Mathlib.Geometry.Manifold.Algebra.LieGroup |
| 3 | |
| 4 | /-! |
| 5 | # Normalization of the weighted Bochner identity |
| 6 | |
| 7 | The reciprocal of the squared gradient is needed only on the support of the |
| 8 | test function. Critical points outside that support therefore cause no |
| 9 | regularity or integrability problem. The resulting formula supplies the |
| 10 | normal-direction curvature calculation in Petrunin, Section 2.2, pp. 3--4. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | set_option backward.isDefEq.respectTransparency false |
| 15 | |
| 16 | open Set MeasureTheory Filter |
| 17 | open scoped Manifold ContDiff Bundle Topology BigOperators |
| 18 | |
| 19 | universe u |
| 20 | |
| 21 | namespace PoincareMT.LeviCivitaData |
| 22 | |
| 23 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 24 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 25 | {g : RiemannianMetric n M} |
| 26 | |
| 27 | omit [IsManifold (𝓡 n) ∞ M] in |
| 28 | private lemma smooth_div_on_support {φ q : M → ℝ} |
| 29 | (hφ : ContMDiff (𝓡 n) 𝓘(ℝ, ℝ) ∞ φ) |
| 30 | (hq : ContMDiff (𝓡 n) 𝓘(ℝ, ℝ) ∞ q) |
| 31 | (hreg : ∀ x ∈ tsupport φ, q x ≠ 0) : |
| 32 | ContMDiff (𝓡 n) 𝓘(ℝ, ℝ) ∞ (fun x => φ x / q x) := by |
| 33 | intro x |
| 34 | by_cases hx : x ∈ tsupport φ |
| 35 | · simpa only [div_eq_mul_inv, Pi.mul_def] using (hφ x).mul ((hq x).inv₀ (hreg x hx)) |
| 36 | · apply (contMDiffAt_const (c := (0 : ℝ))).congr_of_eventuallyEq |
| 37 | filter_upwards [notMem_tsupport_iff_eventuallyEq.mp hx] with y hy |
| 38 | simp [hy] |
| 39 | |
| 40 | private lemma inner_gradient_div_on_support (D : LeviCivitaData g) |
| 41 | {φ q : M → ℝ} (hφ : ContMDiff (𝓡 n) 𝓘(ℝ, ℝ) ∞ φ) |
| 42 | (hq : ContMDiff (𝓡 n) 𝓘(ℝ, ℝ) ∞ q) |
| 43 | (hreg : ∀ x ∈ tsupport φ, q x ≠ 0) |
| 44 | (x : M) (v : TangentSpace (𝓡 n) x) : |
| 45 | g.inner x (D.gradient (fun y => φ y / q y) x) v = |
| 46 | g.inner x (D.gradient φ x) v / q x - |
| 47 | φ x / (q x) ^ 2 * g.inner x (D.gradient q x) v := by |
| 48 | have hw := smooth_div_on_support hφ hq hreg |
| 49 | have heq : (fun y => q y * (φ y / q y)) = φ := by |
| 50 | funext y |
| 51 | by_cases hy : y ∈ tsupport φ |
| 52 | · field_simp [hreg y hy] |
| 53 | · simp [image_eq_zero_of_notMem_tsupport hy] |
| 54 | by_cases hx : x ∈ tsupport φ |
| 55 | · have h := D.gradient_mul ((hq x).mdifferentiableAt (by simp)) |
| 56 | ((hw x).mdifferentiableAt (by simp)) |
| 57 | rw [heq] at h |
| 58 | have hi := congrArg (fun z => g.inner x z v) h |
| 59 | simp only [map_add, map_smul, add_apply, smul_apply, smul_eq_mul] at hi |
| 60 | have hqx := hreg x hx |
| 61 | field_simp |
| 62 | field_simp at hi |
| 63 | nlinarith only [hi] |
| 64 | · have hsupport : tsupport (fun y => φ y / q y) ⊆ tsupport φ := by |
| 65 | apply closure_mono |
| 66 | simp only [Function.support_div] |
| 67 | exact inter_subset_left |
| 68 | rw [D.gradient_eq_zero_of_notMem_tsupport (fun hy => hx (hsupport hy)), |
| 69 | D.gradient_eq_zero_of_notMem_tsupport hx, image_eq_zero_of_notMem_tsupport hx] |
| 70 | simp |
| 71 | |
| 72 | variable [MeasurableSpace M] [BorelSpace M] [T3Space M] |
| 73 | |
| 74 | /-- Dividing the weighted Bochner identity by the squared gradient produces |
| 75 | the normal curvature expression. Noncriticality is needed only on the test |
| 76 | support; the two correction terms come from differentiating that denominator. -/ |
| 77 | theorem integral_normalized_bochner (D : LeviCivitaData g) |
| 78 | {φ f : M → ℝ} (hφ : ContMDiff (𝓡 n) 𝓘(ℝ, ℝ) ∞ φ) |
| 79 | (hf : ContMDiff (𝓡 n) 𝓘(ℝ, ℝ) ∞ f) (hφc : HasCompactSupport φ) |
| 80 | (hreg : ∀ x ∈ tsupport φ, g.inner x (D.gradient f x) (D.gradient f x) ≠ 0) : |
| 81 | let q := fun x => g.inner x (D.gradient f x) (D.gradient f x) |
| 82 | (∫ x, φ x * (((D.laplacian f x) ^ 2 - |
| 83 | (∑ i, ∑ j, (D.hessian f x |
| 84 | (g.orthonormalBasis x i) (g.orthonormalBasis x j)) ^ 2)) / q x - |
| 85 | D.laplacian f x * g.inner x (D.gradient q x) (D.gradient f x) / (q x) ^ 2 + |
| 86 | g.inner x (D.gradient q x) (D.gradient q x) / (2 * (q x) ^ 2) - |
| 87 | D.ricci x (D.gradient f x) (D.gradient f x) / q x) ∂g.volumeMeasure) = |
| 88 | ∫ x, g.inner x (D.gradient φ x) (D.gradient q x) / (2 * q x) - |
| 89 | D.laplacian f x * g.inner x (D.gradient φ x) (D.gradient f x) / q x |
| 90 | ∂g.volumeMeasure := by |
| 91 | dsimp only |
| 92 | let q := fun x => g.inner x (D.gradient f x) (D.gradient f x) |
| 93 | let w := fun x => φ x / q x |
| 94 | let A := fun x => w x * ((D.laplacian f x) ^ 2 - |
| 95 | (∑ i, ∑ j, (D.hessian f x |
| 96 | (g.orthonormalBasis x i) (g.orthonormalBasis x j)) ^ 2) - |
| 97 | D.ricci x (D.gradient f x) (D.gradient f x)) |
| 98 | let B := fun x => (1 / 2 : ℝ) * g.inner x (D.gradient w x) (D.gradient q x) - |
| 99 | D.laplacian f x * g.inner x (D.gradient w x) (D.gradient f x) |
| 100 | let C := fun x => (φ x / (q x) ^ 2) * |
| 101 | (D.laplacian f x * g.inner x (D.gradient q x) (D.gradient f x) - |
| 102 | (1 / 2 : ℝ) * g.inner x (D.gradient q x) (D.gradient q x)) |
| 103 | have hq : ContMDiff (𝓡 n) 𝓘(ℝ, ℝ) ∞ q := D.contMDiff_inner_gradient hf hf |
| 104 | have hw : ContMDiff (𝓡 n) 𝓘(ℝ, ℝ) ∞ w := smooth_div_on_support hφ hq hreg |
| 105 | have hwc : HasCompactSupport w := by |
| 106 | apply HasCompactSupport.of_support_subset_isCompact hφc |
| 107 | intro x hx |
| 108 | by_contra hx' |
| 109 | exact hx (by simp [w, image_eq_zero_of_notMem_tsupport hx']) |
| 110 | have hA : Integrable A g.volumeMeasure := D.integrable_weighted_bochner hw hf hwc |
| 111 | have hB : Integrable B g.volumeMeasure := |
| 112 | ((D.integrable_inner_gradient hw hq hwc).const_mul _).sub |
| 113 | (((D.continuous_laplacian hf).mul (D.continuous_inner_gradient hw hf)).integrable_of_hasCompactSupport |
| 114 | (D.hasCompactSupport_inner_gradient hwc f).mul_left) |
| 115 | have hw₂ : ContMDiff (𝓡 n) 𝓘(ℝ, ℝ) ∞ (fun x => φ x / (q x) ^ 2) := |
| 116 | smooth_div_on_support hφ (hq.pow 2) (fun x hx => pow_ne_zero _ (hreg x hx)) |
| 117 | have hC : Integrable C g.volumeMeasure := by |
| 118 | apply (hw₂.continuous.mul |
| 119 | (((D.continuous_laplacian hf).mul (D.continuous_inner_gradient hq hf)).sub |
| 120 | ((D.continuous_inner_gradient hq hq).const_mul (1 / 2 : ℝ)))).integrable_of_hasCompactSupport |
| 121 | apply HasCompactSupport.of_support_subset_isCompact hφc |
| 122 | intro x hx |
| 123 | by_contra hx' |
| 124 | exact hx (by simp [image_eq_zero_of_notMem_tsupport hx']) |
| 125 | have hi : (∫ x, A x ∂g.volumeMeasure) = ∫ x, B x ∂g.volumeMeasure := |
| 126 | D.integral_weighted_bochner hw hf hwc |
| 127 | calc |
| 128 | _ = ∫ x, A x - C x ∂g.volumeMeasure := by |
| 129 | apply integral_congr_ae |
| 130 | filter_upwards [] with x |
| 131 | dsimp only [A, C, w] |
| 132 | dsimp only [q] at * |
| 133 | by_cases hx : q x = 0 |
| 134 | · dsimp only [q] at hx |
| 135 | simp [hx] |
| 136 | · dsimp only [q] at hx |
| 137 | field_simp |
| 138 | ring |
| 139 | _ = (∫ x, A x ∂g.volumeMeasure) - ∫ x, C x ∂g.volumeMeasure := integral_sub hA hC |
| 140 | _ = ∫ x, B x - C x ∂g.volumeMeasure := by rw [hi, integral_sub hB hC] |
| 141 | _ = _ := by |
| 142 | apply integral_congr_ae |
| 143 | filter_upwards [] with x |
| 144 | dsimp only [B, C, w] |
| 145 | rw [inner_gradient_div_on_support D hφ hq hreg, |
| 146 | inner_gradient_div_on_support D hφ hq hreg] |
| 147 | dsimp only [q] |
| 148 | by_cases hx : q x = 0 |
| 149 | · dsimp only [q] at hx |
| 150 | simp [hx] |
| 151 | · dsimp only [q] at hx |
| 152 | field_simp |
| 153 | ring |
| 154 | |
| 155 | end PoincareMT.LeviCivitaData |