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.Generalized.BoundedDistance.GeometryImports |
| 2 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.Persistence.NeckAnalysis.SphereGram |
| 3 | |
| 4 | /-! |
| 5 | # Positive contractions and weighted perturbation of the actual cylinder jets |
| 6 | |
| 7 | Morgan--Tian Definition 2.16, p. 30, and Proposition 9.79, pp. 232-234. |
| 8 | All contractions below are the frozen inverse-Gram contractions at the |
| 9 | actual chosen chart center. Difference terms are differences of error jets, |
| 10 | not error jets of a tensor difference. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open scoped Manifold ContDiff Bundle BigOperators |
| 16 | |
| 17 | namespace PoincareMT.Proofs.M28.NeckAnalysis |
| 18 | |
| 19 | /-- The positive inverse-Gram weight attached to one covariant multi-index. -/ |
| 20 | noncomputable def cylinderTensorWeight (u : ℝ) {r : ℕ} (a : Fin r → Fin 3) : ℝ := |
| 21 | ∏ i : Fin r, (cylinderGramDiagonal u (a i))⁻¹ |
| 22 | |
| 23 | /-- Every inverse-Gram multi-index weight is positive, including rank zero. -/ |
| 24 | theorem cylinderTensorWeight_pos {u : ℝ} (hu : u < 1) {r : ℕ} |
| 25 | (a : Fin r → Fin 3) : 0 < cylinderTensorWeight u a := by |
| 26 | apply Finset.prod_pos |
| 27 | intro i _ |
| 28 | exact inv_pos.mpr (cylinderGramDiagonal_pos hu (a i)) |
| 29 | |
| 30 | /-- The frozen tensor contraction is an actual weighted sum of squares at |
| 31 | the point used by the frozen jet error. -/ |
| 32 | theorem roundCylinderTensorNormSquared_eq_sum {u : ℝ} (hu : u < 1) |
| 33 | (z : RoundCylinderSpace) {r : ℕ} (T : (Fin r → Fin 3) → ℝ) : |
| 34 | roundCylinderTensorNormSquared u (chartAt (EuclideanSpace ℝ (Fin 2)) z.1) |
| 35 | (chartAt (EuclideanSpace ℝ (Fin 2)) z.1 z.1, z.2) T = |
| 36 | ∑ a : Fin r → Fin 3, cylinderTensorWeight u a * (T a) ^ 2 := by |
| 37 | classical |
| 38 | unfold roundCylinderTensorNormSquared |
| 39 | rw [roundCylinderGram_inverse_chosen_center hu] |
| 40 | apply Finset.sum_congr rfl |
| 41 | intro a _ |
| 42 | rw [Finset.sum_eq_single a] |
| 43 | · simp [Matrix.diagonal, cylinderTensorWeight, pow_two, mul_assoc] |
| 44 | · intro b _ hba |
| 45 | have hab : ¬ ∀ i, a i = b i := by |
| 46 | intro h |
| 47 | exact hba (funext h).symm |
| 48 | change (∏ i, if a i = b i then (cylinderGramDiagonal u (a i))⁻¹ else 0) * |
| 49 | T a * T b = 0 |
| 50 | simp only [Fintype.prod_ite_zero, if_neg hab, zero_mul] |
| 51 | · simp |
| 52 | |
| 53 | /-- Nonnegativity requires only the actual model time, not regularity of |
| 54 | the array being contracted. -/ |
| 55 | theorem roundCylinderTensorNormSquared_nonneg {u : ℝ} (hu : u < 1) |
| 56 | (z : RoundCylinderSpace) {r : ℕ} (T : (Fin r → Fin 3) → ℝ) : |
| 57 | 0 ≤ roundCylinderTensorNormSquared u (chartAt (EuclideanSpace ℝ (Fin 2)) z.1) |
| 58 | (chartAt (EuclideanSpace ℝ (Fin 2)) z.1 z.1, z.2) T := by |
| 59 | rw [roundCylinderTensorNormSquared_eq_sum hu] |
| 60 | exact Finset.sum_nonneg fun a _ => |
| 61 | mul_nonneg (cylinderTensorWeight_pos hu a).le (sq_nonneg _) |
| 62 | |
| 63 | /-- A weighted scalar square estimate with an arbitrary positive margin. -/ |
| 64 | theorem square_le_weighted_square_sub {theta : ℝ} (htheta : 0 < theta) |
| 65 | (x y : ℝ) : x ^ 2 ≤ (1 + theta) * y ^ 2 + |
| 66 | (1 + theta⁻¹) * (x - y) ^ 2 := by |
| 67 | have hs := sq_nonneg (theta * y - (x - y)) |
| 68 | have hid : ((1 + theta) * y ^ 2 + (1 + theta⁻¹) * (x - y) ^ 2) * theta - |
| 69 | x ^ 2 * theta = (theta * y - (x - y)) ^ 2 := by |
| 70 | field_simp [ne_of_gt htheta] |
| 71 | ring |
| 72 | exact (mul_le_mul_iff_right₀ htheta).mp (by nlinarith [hs, hid]) |
| 73 | |
| 74 | /-- Sharp weighted perturbation for the frozen tensor norm. The arbitrary |
| 75 | positive weight preserves any fixed strict epsilon gap. -/ |
| 76 | theorem roundCylinderTensorNormSquared_perturbation {u : ℝ} (hu : u < 1) |
| 77 | (z : RoundCylinderSpace) {r : ℕ} (T S : (Fin r → Fin 3) → ℝ) |
| 78 | {theta : ℝ} (htheta : 0 < theta) : |
| 79 | let c := chartAt (EuclideanSpace ℝ (Fin 2)) z.1 |
| 80 | let p : RoundCylinderCoordinates := (c z.1, z.2) |
| 81 | roundCylinderTensorNormSquared u c p T ≤ |
| 82 | (1 + theta) * roundCylinderTensorNormSquared u c p S + |
| 83 | (1 + theta⁻¹) * roundCylinderTensorNormSquared u c p (fun a => T a - S a) := by |
| 84 | dsimp only |
| 85 | simp only [roundCylinderTensorNormSquared_eq_sum hu] |
| 86 | rw [Finset.mul_sum, Finset.mul_sum, ← Finset.sum_add_distrib] |
| 87 | apply Finset.sum_le_sum |
| 88 | intro a _ |
| 89 | have h := mul_le_mul_of_nonneg_left |
| 90 | (square_le_weighted_square_sub htheta (T a) (S a)) |
| 91 | (cylinderTensorWeight_pos hu a).le |
| 92 | nlinarith [h] |
| 93 | |
| 94 | /-- Every actual finite sum of squared cylinder error jets is nonnegative. -/ |
| 95 | theorem roundCylinderJetErrorSquared_nonneg {u : ℝ} (hu : u < 1) |
| 96 | (B : RoundCylinderTwoTensor) (order : ℕ) (z : RoundCylinderSpace) : |
| 97 | 0 ≤ roundCylinderJetErrorSquared u B order z := by |
| 98 | apply Finset.sum_nonneg |
| 99 | intro k _ |
| 100 | exact roundCylinderTensorNormSquared_nonneg hu z _ |
| 101 | |
| 102 | /-- Dropping derivative orders reduces the actual frozen error. -/ |
| 103 | theorem roundCylinderJetErrorSquared_mono_order {u : ℝ} (hu : u < 1) |
| 104 | (B : RoundCylinderTwoTensor) {m n : ℕ} (hmn : m ≤ n) |
| 105 | (z : RoundCylinderSpace) : |
| 106 | roundCylinderJetErrorSquared u B m z ≤ roundCylinderJetErrorSquared u B n z := by |
| 107 | apply Finset.sum_le_sum_of_subset_of_nonneg (Finset.range_mono (Nat.add_le_add_right hmn 1)) |
| 108 | intro k _ _ |
| 109 | exact roundCylinderTensorNormSquared_nonneg hu z _ |
| 110 | |
| 111 | /-- The perturbation energy compares the actual frozen error arrays. In |
| 112 | particular it does not subtract the model a second time. -/ |
| 113 | noncomputable def cylinderJetDifferenceSquared (u : ℝ) (B C : RoundCylinderTwoTensor) |
| 114 | (order : ℕ) (z : RoundCylinderSpace) : ℝ := |
| 115 | let c := chartAt (EuclideanSpace ℝ (Fin 2)) z.1 |
| 116 | let p : RoundCylinderCoordinates := (c z.1, z.2) |
| 117 | ∑ k ∈ Finset.range (order + 1), roundCylinderTensorNormSquared u c p |
| 118 | (fun a => roundCylinderIteratedDerivative u c B k p a - |
| 119 | roundCylinderIteratedDerivative u c C k p a) |
| 120 | |
| 121 | /-- Weighted perturbation of all requested actual spatial error jets. -/ |
| 122 | theorem roundCylinderJetErrorSquared_perturbation {u : ℝ} (hu : u < 1) |
| 123 | (B C : RoundCylinderTwoTensor) (order : ℕ) (z : RoundCylinderSpace) |
| 124 | {theta : ℝ} (htheta : 0 < theta) : |
| 125 | roundCylinderJetErrorSquared u B order z ≤ |
| 126 | (1 + theta) * roundCylinderJetErrorSquared u C order z + |
| 127 | (1 + theta⁻¹) * cylinderJetDifferenceSquared u B C order z := by |
| 128 | unfold roundCylinderJetErrorSquared cylinderJetDifferenceSquared |
| 129 | dsimp only |
| 130 | rw [Finset.mul_sum, Finset.mul_sum, ← Finset.sum_add_distrib] |
| 131 | apply Finset.sum_le_sum |
| 132 | intro k _ |
| 133 | exact roundCylinderTensorNormSquared_perturbation hu z _ _ htheta |
| 134 | |
| 135 | end PoincareMT.Proofs.M28.NeckAnalysis |