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 Mathlib.Analysis.InnerProductSpace.Trace |
| 2 | import Mathlib.Analysis.Calculus.FDeriv.Mul |
| 3 | |
| 4 | /-! |
| 5 | # Traces in normalized metric coordinates |
| 6 | |
| 7 | A single fixed linear change of coordinates identifies the metric trace |
| 8 | with the ordinary trace. The scalar product rule then gives the trace |
| 9 | of the density-weighted coordinate field, in every finite dimension. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | open scoped BigOperators |
| 15 | |
| 16 | namespace PoincareMT.ReducedVolume |
| 17 | |
| 18 | variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] |
| 19 | [FiniteDimensional ℝ E] |
| 20 | |
| 21 | omit [FiniteDimensional ℝ E] in |
| 22 | /-- A metric-orthonormal coordinate frame computes the ordinary endomorphism trace. -/ |
| 23 | theorem trace_eq_sum_normalized_metric {ι : Type*} [Fintype ι] |
| 24 | (b : OrthonormalBasis ι ℝ E) (B : E →L[ℝ] E →L[ℝ] ℝ) |
| 25 | (C : E ≃L[ℝ] E) (hC : ∀ v w, B (C v) (C w) = inner ℝ v w) |
| 26 | (A : E →ₗ[ℝ] E) : |
| 27 | LinearMap.trace ℝ E A = ∑ i, B (A (C (b i))) (C (b i)) := by |
| 28 | rw [← LinearMap.trace_conj' A C.toLinearEquiv.symm, |
| 29 | LinearMap.trace_eq_sum_inner _ b] |
| 30 | apply Finset.sum_congr rfl |
| 31 | intro i _ |
| 32 | rw [LinearEquiv.conj_apply_apply] |
| 33 | change inner ℝ (b i) (C.symm (A (C (b i)))) = _ |
| 34 | have h := hC (C.symm (A (C (b i)))) (b i) |
| 35 | simpa only [ContinuousLinearEquiv.apply_symm_apply, real_inner_comm] using h.symm |
| 36 | |
| 37 | /-- The trace of a weighted field derivative is its weighted trace plus the density derivative. -/ |
| 38 | theorem trace_fderiv_smul {ρ : E → ℝ} {a : E → E} {y : E} |
| 39 | (hρ : DifferentiableAt ℝ ρ y) (ha : DifferentiableAt ℝ a y) : |
| 40 | LinearMap.trace ℝ E (fderiv ℝ (fun z ↦ ρ z • a z) y).toLinearMap = |
| 41 | ρ y * LinearMap.trace ℝ E (fderiv ℝ a y).toLinearMap + |
| 42 | fderiv ℝ ρ y (a y) := by |
| 43 | rw [fderiv_fun_smul hρ ha, ContinuousLinearMap.toLinearMap_add, |
| 44 | ContinuousLinearMap.toLinearMap_smul, map_add, map_smul] |
| 45 | change ρ y * LinearMap.trace ℝ E (fderiv ℝ a y).toLinearMap + |
| 46 | LinearMap.trace ℝ E ((fderiv ℝ ρ y).toLinearMap.smulRight (a y)) = _ |
| 47 | rw [LinearMap.trace_smulRight] |
| 48 | rfl |
| 49 | |
| 50 | end PoincareMT.ReducedVolume |