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 | /- |
| 2 | Provenance and modification notice (recorded 2026-09-29). |
| 3 | Source: https://github.com/qinz1yang/differential-geometry |
| 4 | DifferentialGeometry/Analysis/Parabolic/Euclidean/HeatKernelSPD.lean |
| 5 | Comparison revision: 1b535dd102b94cc42b107cca27059687888f08b3. |
| 6 | Changes: Imports, module paths, and namespaces were adapted to the subject-organized PoincareLib library. |
| 7 | License: Apache-2.0. Source licenses and notices are retained under |
| 8 | PoincareConjecture/provenance/2026-09-29/licenses/. |
| 9 | See PoincareConjecture/MODIFICATIONS.md for the reviewed source mapping. |
| 10 | -/ |
| 11 | |
| 12 | import PoincareLib.Analysis.Parabolic.Interior.Kernel.LinearChange |
| 13 | import Mathlib.Analysis.CStarAlgebra.Matrix |
| 14 | import Mathlib.Analysis.Matrix.Order |
| 15 | import Mathlib.Analysis.SpecialFunctions.Gaussian.FourierTransform |
| 16 | |
| 17 | /-! |
| 18 | # PositiveDefinite for interior heat equations |
| 19 | |
| 20 | Adapted from Chow--Liao--Qin, HeatKernelSPD.lean, revision |
| 21 | 1b535dd102b94cc42b107cca27059687888f08b3. |
| 22 | Copyright 2026 The DifferentialGeometry contributors. Apache-2.0. |
| 23 | See references/ricci-flow/chow-liao-qin-2026/interior-hessian-reuse.md. |
| 24 | The adaptation changes import paths and namespaces. |
| 25 | -/ |
| 26 | |
| 27 | noncomputable section |
| 28 | |
| 29 | open Matrix Real |
| 30 | open scoped MatrixOrder RealInnerProductSpace |
| 31 | |
| 32 | namespace Poincare.Parabolic.Interior.Kernel |
| 33 | |
| 34 | section PositiveDefinite |
| 35 | |
| 36 | variable {n : Type*} [Fintype n] [DecidableEq n] |
| 37 | private abbrev matrixCLM (A : Matrix n n ℝ) : |
| 38 | EuclideanSpace ℝ n →L[ℝ] EuclideanSpace ℝ n := |
| 39 | Matrix.toEuclideanCLM (n := n) (𝕜 := ℝ) A |
| 40 | def spdSqrtEquiv (A : Matrix n n ℝ) (hA : A.PosDef) : |
| 41 | EuclideanSpace ℝ n ≃L[ℝ] EuclideanSpace ℝ n := |
| 42 | let S := CFC.sqrt A |
| 43 | let hS : S.PosDef := hA.isStrictlyPositive.sqrt.posDef |
| 44 | let L := matrixCLM S |
| 45 | have hunit : IsUnit S := |
| 46 | (Matrix.isUnit_iff_isUnit_det S).mpr |
| 47 | (isUnit_iff_ne_zero.mpr hS.det_pos.ne') |
| 48 | have hinj : Function.Injective L := by |
| 49 | intro x y hxy |
| 50 | apply WithLp.ofLp_injective |
| 51 | apply Matrix.mulVec_injective_of_isUnit hunit |
| 52 | simpa only [L, matrixCLM, Matrix.ofLp_toEuclideanCLM] using |
| 53 | congrArg WithLp.ofLp hxy |
| 54 | ContinuousLinearEquiv.ofBijective L |
| 55 | (LinearMap.ker_eq_bot.mpr hinj) |
| 56 | (LinearMap.range_eq_top.mpr |
| 57 | (L.toLinearMap.surjective_of_injective hinj)) |
| 58 | |
| 59 | @[simp] |
| 60 | theorem spdSqrtEquiv_apply (A : Matrix n n ℝ) (hA : A.PosDef) |
| 61 | (x : EuclideanSpace ℝ n) : |
| 62 | spdSqrtEquiv A hA x = |
| 63 | matrixCLM (CFC.sqrt A) x := by |
| 64 | rfl |
| 65 | |
| 66 | theorem spdSqrt_comp (A : Matrix n n ℝ) (hA : A.PosDef) |
| 67 | (x : EuclideanSpace ℝ n) : |
| 68 | spdSqrtEquiv A hA (spdSqrtEquiv A hA x) = |
| 69 | matrixCLM A x := by |
| 70 | simp only [spdSqrtEquiv_apply] |
| 71 | rw [← ContinuousLinearMap.comp_apply, ← ContinuousLinearMap.mul_def, ← map_mul, |
| 72 | CFC.sqrt_mul_sqrt_self A hA.posSemidef.nonneg] |
| 73 | |
| 74 | theorem spdSqrt_selfAdj (A : Matrix n n ℝ) (hA : A.PosDef) : |
| 75 | IsSelfAdjoint |
| 76 | (spdSqrtEquiv A hA : EuclideanSpace ℝ n →L[ℝ] EuclideanSpace ℝ n) := by |
| 77 | have heq : |
| 78 | (spdSqrtEquiv A hA : EuclideanSpace ℝ n →L[ℝ] EuclideanSpace ℝ n) = |
| 79 | matrixCLM (CFC.sqrt A) := by |
| 80 | apply ContinuousLinearMap.ext |
| 81 | intro x |
| 82 | exact spdSqrtEquiv_apply A hA x |
| 83 | rw [heq] |
| 84 | apply ContinuousLinearMap.isSelfAdjoint_iff_isSymmetric.mpr |
| 85 | rw [show |
| 86 | (matrixCLM (CFC.sqrt A) : |
| 87 | EuclideanSpace ℝ n →ₗ[ℝ] EuclideanSpace ℝ n) = |
| 88 | Matrix.toEuclideanLin (CFC.sqrt A) from |
| 89 | Matrix.coe_toEuclideanCLM_eq_toEuclideanLin (CFC.sqrt A)] |
| 90 | exact Matrix.isSymmetric_toEuclideanLin_iff.mpr |
| 91 | (CFC.sqrt_nonneg A).isSelfAdjoint.isHermitian |
| 92 | theorem spdSqrt_norm_sq (A : Matrix n n ℝ) (hA : A.PosDef) |
| 93 | (x : EuclideanSpace ℝ n) : |
| 94 | ‖spdSqrtEquiv A hA x‖ ^ 2 = |
| 95 | inner ℝ x (matrixCLM A x) := by |
| 96 | calc |
| 97 | ‖spdSqrtEquiv A hA x‖ ^ 2 = |
| 98 | inner ℝ (spdSqrtEquiv A hA x) (spdSqrtEquiv A hA x) := |
| 99 | (real_inner_self_eq_norm_sq _).symm |
| 100 | _ = inner ℝ x (spdSqrtEquiv A hA (spdSqrtEquiv A hA x)) := |
| 101 | (spdSqrt_selfAdj A hA).isSymmetric x (spdSqrtEquiv A hA x) |
| 102 | _ = inner ℝ x (matrixCLM A x) := by |
| 103 | rw [spdSqrt_comp] |
| 104 | |
| 105 | theorem spdSqrt_det (A : Matrix n n ℝ) (hA : A.PosDef) : |
| 106 | LinearMap.det |
| 107 | ((spdSqrtEquiv A hA : EuclideanSpace ℝ n →L[ℝ] EuclideanSpace ℝ n) : |
| 108 | EuclideanSpace ℝ n →ₗ[ℝ] EuclideanSpace ℝ n) = |
| 109 | Real.sqrt A.det := by |
| 110 | let b := (EuclideanSpace.basisFun n ℝ).toBasis |
| 111 | have hlin : |
| 112 | ((spdSqrtEquiv A hA : EuclideanSpace ℝ n →L[ℝ] EuclideanSpace ℝ n) : |
| 113 | EuclideanSpace ℝ n →ₗ[ℝ] EuclideanSpace ℝ n) = |
| 114 | Matrix.toLin b b (CFC.sqrt A) := by |
| 115 | apply LinearMap.ext |
| 116 | intro x |
| 117 | change spdSqrtEquiv A hA x = Matrix.toLin b b (CFC.sqrt A) x |
| 118 | rw [spdSqrtEquiv_apply] |
| 119 | rfl |
| 120 | calc |
| 121 | LinearMap.det |
| 122 | ((spdSqrtEquiv A hA : EuclideanSpace ℝ n →L[ℝ] EuclideanSpace ℝ n) : |
| 123 | EuclideanSpace ℝ n →ₗ[ℝ] EuclideanSpace ℝ n) = |
| 124 | (LinearMap.toMatrix b b |
| 125 | ((spdSqrtEquiv A hA : EuclideanSpace ℝ n →L[ℝ] |
| 126 | EuclideanSpace ℝ n) : EuclideanSpace ℝ n →ₗ[ℝ] |
| 127 | EuclideanSpace ℝ n)).det := |
| 128 | (LinearMap.det_toMatrix b _).symm |
| 129 | _ = (CFC.sqrt A).det := by rw [hlin, LinearMap.toMatrix_toLin] |
| 130 | _ = Real.sqrt A.det := by simpa using hA.posSemidef.det_sqrt |
| 131 | |
| 132 | theorem gaussSPD_int (A : Matrix n n ℝ) (hA : A.PosDef) : |
| 133 | ∫ x : EuclideanSpace ℝ n, |
| 134 | Real.exp (-inner ℝ x (matrixCLM A x)) = |
| 135 | (Real.sqrt A.det)⁻¹ * |
| 136 | (Real.pi : ℝ) ^ (Fintype.card n / 2 : ℝ) := by |
| 137 | let L := spdSqrtEquiv A hA |
| 138 | let f : EuclideanSpace ℝ n → ℝ := fun y => Real.exp (-‖y‖ ^ 2) |
| 139 | have hdet : LinearMap.det (L : EuclideanSpace ℝ n →ₗ[ℝ] |
| 140 | EuclideanSpace ℝ n) = Real.sqrt A.det := spdSqrt_det A hA |
| 141 | have hdet_pos : 0 < LinearMap.det (L : EuclideanSpace ℝ n →ₗ[ℝ] |
| 142 | EuclideanSpace ℝ n) := hdet ▸ Real.sqrt_pos.2 hA.det_pos |
| 143 | have hmap : MeasureTheory.Measure.map |
| 144 | (L : EuclideanSpace ℝ n →ₗ[ℝ] EuclideanSpace ℝ n) |
| 145 | (MeasureTheory.volume : MeasureTheory.Measure (EuclideanSpace ℝ n)) = |
| 146 | ENNReal.ofReal ((LinearMap.det (L : EuclideanSpace ℝ n →ₗ[ℝ] |
| 147 | EuclideanSpace ℝ n))⁻¹) • MeasureTheory.volume := by |
| 148 | simpa [abs_of_pos hdet_pos] using |
| 149 | MeasureTheory.Measure.map_linearMap_addHaar_eq_smul_addHaar |
| 150 | (MeasureTheory.volume : MeasureTheory.Measure (EuclideanSpace ℝ n)) hdet_pos.ne' |
| 151 | calc |
| 152 | ∫ x : EuclideanSpace ℝ n, Real.exp (-inner ℝ x (matrixCLM A x)) = |
| 153 | ∫ x : EuclideanSpace ℝ n, f (L x) := by |
| 154 | congr 1 |
| 155 | funext x |
| 156 | simp only [f, L, spdSqrt_norm_sq] |
| 157 | _ = ∫ y : EuclideanSpace ℝ n, f y ∂MeasureTheory.Measure.map |
| 158 | (L : EuclideanSpace ℝ n →ₗ[ℝ] EuclideanSpace ℝ n) |
| 159 | MeasureTheory.volume := by |
| 160 | rw [MeasureTheory.integral_map] |
| 161 | · rfl |
| 162 | · exact (L : EuclideanSpace ℝ n →L[ℝ] |
| 163 | EuclideanSpace ℝ n).continuous.aemeasurable |
| 164 | · exact Real.continuous_exp.comp |
| 165 | (continuous_neg.comp (continuous_norm.pow 2)) |>.aestronglyMeasurable |
| 166 | _ = (LinearMap.det (L : EuclideanSpace ℝ n →ₗ[ℝ] |
| 167 | EuclideanSpace ℝ n))⁻¹ * ∫ y : EuclideanSpace ℝ n, f y := by |
| 168 | rw [hmap, MeasureTheory.integral_smul_measure] |
| 169 | simp [ENNReal.toReal_ofReal, hdet_pos.le, smul_eq_mul] |
| 170 | _ = (Real.sqrt A.det)⁻¹ * |
| 171 | (Real.pi : ℝ) ^ (Fintype.card n / 2 : ℝ) := by |
| 172 | rw [hdet] |
| 173 | simp only [f] |
| 174 | have hg := GaussianFourier.integral_rexp_neg_mul_sq_norm |
| 175 | (V := EuclideanSpace ℝ n) (b := 1) zero_lt_one |
| 176 | simpa only [neg_one_mul, div_one, finrank_euclideanSpace] using |
| 177 | congrArg (fun z => (Real.sqrt A.det)⁻¹ * z) hg |
| 178 | |
| 179 | theorem spdSqrt_apply_le (A : Matrix n n ℝ) (hA : A.PosDef) |
| 180 | {ellMax : ℝ} (hMax : 0 ≤ ellMax) |
| 181 | (hupper : ∀ x : EuclideanSpace ℝ n, |
| 182 | inner ℝ x (matrixCLM A x) ≤ ellMax * ‖x‖ ^ 2) |
| 183 | (x : EuclideanSpace ℝ n) : |
| 184 | ‖spdSqrtEquiv A hA x‖ ≤ √ellMax * ‖x‖ := by |
| 185 | rw [← sq_le_sq₀ (norm_nonneg _) (mul_nonneg (sqrt_nonneg _) (norm_nonneg _)), |
| 186 | spdSqrt_norm_sq, mul_pow, Real.sq_sqrt hMax] |
| 187 | exact hupper x |
| 188 | |
| 189 | theorem spdSqrt_norm_le (A : Matrix n n ℝ) (hA : A.PosDef) |
| 190 | {ellMax : ℝ} (hMax : 0 ≤ ellMax) |
| 191 | (hupper : ∀ x : EuclideanSpace ℝ n, |
| 192 | inner ℝ x (matrixCLM A x) ≤ ellMax * ‖x‖ ^ 2) : |
| 193 | ‖(spdSqrtEquiv A hA : EuclideanSpace ℝ n →L[ℝ] EuclideanSpace ℝ n)‖ ≤ |
| 194 | √ellMax := by |
| 195 | exact ContinuousLinearMap.opNorm_le_bound _ (sqrt_nonneg ellMax) |
| 196 | (spdSqrt_apply_le A hA hMax hupper) |
| 197 | |
| 198 | theorem spdSqrt_symm_le (A : Matrix n n ℝ) (hA : A.PosDef) |
| 199 | {ellMin : ℝ} (hMin : 0 < ellMin) |
| 200 | (hlower : ∀ x : EuclideanSpace ℝ n, |
| 201 | ellMin * ‖x‖ ^ 2 ≤ inner ℝ x (matrixCLM A x)) |
| 202 | (y : EuclideanSpace ℝ n) : |
| 203 | ‖(spdSqrtEquiv A hA).symm y‖ ≤ (√ellMin)⁻¹ * ‖y‖ := by |
| 204 | have hsq := hlower ((spdSqrtEquiv A hA).symm y) |
| 205 | rw [← spdSqrt_norm_sq A hA, |
| 206 | ContinuousLinearEquiv.apply_symm_apply] at hsq |
| 207 | rw [inv_mul_eq_div, le_div_iff₀ (Real.sqrt_pos.2 hMin)] |
| 208 | have hsqrt : |
| 209 | √ellMin * ‖(spdSqrtEquiv A hA).symm y‖ ≤ ‖y‖ := by |
| 210 | rw [← sq_le_sq₀ |
| 211 | (mul_nonneg (sqrt_nonneg _) (norm_nonneg _)) (norm_nonneg _), |
| 212 | mul_pow, Real.sq_sqrt hMin.le] |
| 213 | exact hsq |
| 214 | simpa [mul_comm] using hsqrt |
| 215 | |
| 216 | theorem spdSqrt_inv_le (A : Matrix n n ℝ) (hA : A.PosDef) |
| 217 | {ellMin : ℝ} (hMin : 0 < ellMin) |
| 218 | (hlower : ∀ x : EuclideanSpace ℝ n, |
| 219 | ellMin * ‖x‖ ^ 2 ≤ inner ℝ x (matrixCLM A x)) : |
| 220 | ‖((spdSqrtEquiv A hA).symm : |
| 221 | EuclideanSpace ℝ n →L[ℝ] EuclideanSpace ℝ n)‖ ≤ (√ellMin)⁻¹ := by |
| 222 | exact ContinuousLinearMap.opNorm_le_bound _ (inv_nonneg.mpr (sqrt_nonneg ellMin)) |
| 223 | (spdSqrt_symm_le A hA hMin hlower) |
| 224 | |
| 225 | end PositiveDefinite |
| 226 | |
| 227 | end Poincare.Parabolic.Interior.Kernel |