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.ReducedLength.Tensor.BilinearTrace |
| 2 | import Mathlib.Geometry.Manifold.MFDeriv.NormedSpace |
| 3 | import Mathlib.Geometry.Manifold.MFDeriv.SpecificFunctions |
| 4 | import Mathlib.Geometry.Manifold.Instances.Real |
| 5 | |
| 6 | /-! |
| 7 | # Manifold derivatives of inverse metric traces |
| 8 | |
| 9 | The actual manifold chain rule and the noncommutative product rule transport |
| 10 | the fixed-fiber trace calculation to a tangent direction. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | set_option maxSynthPendingDepth 3 |
| 15 | |
| 16 | open scoped Manifold ContDiff RealInnerProductSpace |
| 17 | |
| 18 | namespace PoincareMT.ReducedLength |
| 19 | |
| 20 | variable {n : ℕ} {M : Type*} [TopologicalSpace M] |
| 21 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 22 | [IsManifold (𝓡 n) ∞ M] |
| 23 | |
| 24 | theorem mvfderiv_const_clm |
| 25 | {V W : Type*} [NormedAddCommGroup V] [NormedSpace ℝ V] |
| 26 | [NormedAddCommGroup W] [NormedSpace ℝ W] |
| 27 | (L : V →L[ℝ] W) (f : M → V) (p : M) |
| 28 | (hf : MDifferentiableAt (𝓡 n) (𝓘(ℝ, V)) f p) (X : TangentSpace (𝓡 n) p) : |
| 29 | mvfderiv (𝓡 n) (fun q ↦ L (f q)) p X = L (mvfderiv (𝓡 n) f p X) := by |
| 30 | have h := L.hasMFDerivAt.comp p hf.hasMFDerivAt |
| 31 | convert! congrArg (fun A : TangentSpace (𝓡 n) p →L[ℝ] W ↦ A X) h.mfderiv using 1 |
| 32 | |
| 33 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 34 | [FiniteDimensional ℝ E] |
| 35 | |
| 36 | theorem inverseMetricTrace_mvfderiv |
| 37 | (A B : M → E →L[ℝ] E) (p : M) (X : TangentSpace (𝓡 n) p) |
| 38 | (hA : MDifferentiableAt (𝓡 n) (𝓘(ℝ, E →L[ℝ] E)) A p) |
| 39 | (hB : MDifferentiableAt (𝓡 n) (𝓘(ℝ, E →L[ℝ] E)) B p) |
| 40 | (hunit : IsUnit (A p)) (P Q C : E →L[ℝ] E) |
| 41 | (hA' : mvfderiv (𝓡 n) A p X = A p * P + Q * A p) |
| 42 | (hB' : mvfderiv (𝓡 n) B p X = B p * P + Q * B p + C) : |
| 43 | mvfderiv (𝓡 n) (fun q ↦ continuousTrace (Ring.inverse (A q) * B q)) p X = |
| 44 | continuousTrace (Ring.inverse (A p) * C) := by |
| 45 | obtain ⟨a, ha⟩ := hunit |
| 46 | have hinv : HasMFDerivAt (𝓡 n) (𝓘(ℝ, E →L[ℝ] E)) |
| 47 | (fun q ↦ Ring.inverse (A q)) p |
| 48 | ((-ContinuousLinearMap.mulLeftRight ℝ (E →L[ℝ] E) ↑a⁻¹ ↑a⁻¹).comp |
| 49 | (mvfderiv (𝓡 n) A p)) := by |
| 50 | have hout := hasFDerivAt_ringInverse (𝕜 := ℝ) a |
| 51 | rw [ha] at hout |
| 52 | convert! hout.hasMFDerivAt.comp p hA.hasMFDerivAt using 1 |
| 53 | have hprod := hinv.mul' hB.hasMFDerivAt |
| 54 | have htrace := (continuousTrace (E := E)).hasMFDerivAt.comp p hprod |
| 55 | have hder : mvfderiv (𝓡 n) |
| 56 | (fun q ↦ continuousTrace (Ring.inverse (A q) * B q)) p X = |
| 57 | continuousTrace (Ring.inverse (A p) * mvfderiv (𝓡 n) B p X + |
| 58 | (-((↑a⁻¹ : E →L[ℝ] E) * mvfderiv (𝓡 n) A p X * (↑a⁻¹ : E →L[ℝ] E))) * B p) := by |
| 59 | convert! congrArg (fun L : TangentSpace (𝓡 n) p →L[ℝ] ℝ ↦ L X) htrace.mfderiv using 1 |
| 60 | have hinvt : Ring.inverse (A p) = (↑a⁻¹ : E →L[ℝ] E) := by |
| 61 | rw [← ha, Ring.inverse_unit] |
| 62 | have halgebra : Ring.inverse (A p) * mvfderiv (𝓡 n) B p X + |
| 63 | (-((↑a⁻¹ : E →L[ℝ] E) * mvfderiv (𝓡 n) A p X * (↑a⁻¹ : E →L[ℝ] E))) * B p = |
| 64 | (↑a⁻¹ : E →L[ℝ] E) * C + ((↑a⁻¹ : E →L[ℝ] E) * B p) * P - |
| 65 | P * ((↑a⁻¹ : E →L[ℝ] E) * B p) := by |
| 66 | rw [hA', hB', hinvt, ← ha] |
| 67 | noncomm_ring [a.inv_mul, a.mul_inv] |
| 68 | simp only [← mul_assoc, a.inv_mul, one_mul] |
| 69 | rw [hder, halgebra, map_sub, map_add, continuousTrace_mul_comm P, |
| 70 | add_sub_cancel_right, hinvt] |
| 71 | |
| 72 | section InnerProduct |
| 73 | |
| 74 | variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] |
| 75 | [FiniteDimensional ℝ V] |
| 76 | |
| 77 | theorem metricFormTrace_contDiffAt (G B : V →L[ℝ] V →L[ℝ] ℝ) |
| 78 | (hunit : IsUnit (formOperator G)) : |
| 79 | ContDiffAt ℝ ∞ (fun z : (V →L[ℝ] V →L[ℝ] ℝ) × (V →L[ℝ] V →L[ℝ] ℝ) ↦ |
| 80 | metricFormTrace z.1 z.2) (G, B) := by |
| 81 | have hG : ContDiffAt ℝ ∞ (fun z : (V →L[ℝ] V →L[ℝ] ℝ) × |
| 82 | (V →L[ℝ] V →L[ℝ] ℝ) ↦ formOperator z.1) (G, B) := by |
| 83 | exact ((formOperator (E := V)).contDiff.comp contDiff_fst).contDiffAt |
| 84 | have hB : ContDiffAt ℝ ∞ (fun z : (V →L[ℝ] V →L[ℝ] ℝ) × |
| 85 | (V →L[ℝ] V →L[ℝ] ℝ) ↦ formOperator z.2) (G, B) := by |
| 86 | exact ((formOperator (E := V)).contDiff.comp contDiff_snd).contDiffAt |
| 87 | obtain ⟨a, ha⟩ := hunit |
| 88 | have hinv := contDiffAt_ringInverse (n := ∞) ℝ a |
| 89 | rw [ha] at hinv |
| 90 | exact continuousTrace.contDiff.contDiffAt.comp (G, B) ((hinv.comp (G, B) hG).mul hB) |
| 91 | |
| 92 | theorem metricFormTrace_mvfderiv |
| 93 | (G B : M → V →L[ℝ] V →L[ℝ] ℝ) (p : M) (X : TangentSpace (𝓡 n) p) |
| 94 | (hG : MDifferentiableAt (𝓡 n) (𝓘(ℝ, V →L[ℝ] V →L[ℝ] ℝ)) G p) |
| 95 | (hB : MDifferentiableAt (𝓡 n) (𝓘(ℝ, V →L[ℝ] V →L[ℝ] ℝ)) B p) |
| 96 | (hunit : IsUnit (formOperator (G p))) (P : V →L[ℝ] V) |
| 97 | (C : V →L[ℝ] V →L[ℝ] ℝ) |
| 98 | (hG' : ∀ v w, mvfderiv (𝓡 n) G p X v w = G p (P v) w + G p v (P w)) |
| 99 | (hB' : ∀ v w, mvfderiv (𝓡 n) B p X v w = B p (P v) w + B p v (P w) + C v w) : |
| 100 | mvfderiv (𝓡 n) (fun q ↦ metricFormTrace (G q) (B q)) p X = |
| 101 | metricFormTrace (G p) C := by |
| 102 | have hGO := (formOperator (E := V)).mdifferentiableAt.comp p hG |
| 103 | have hBO := (formOperator (E := V)).mdifferentiableAt.comp p hB |
| 104 | apply inverseMetricTrace_mvfderiv _ _ p X hGO hBO hunit P P.adjoint (formOperator C) |
| 105 | · change mvfderiv (𝓡 n) (fun q ↦ formOperator (G q)) p X = _ |
| 106 | rw [mvfderiv_const_clm formOperator G p hG X] |
| 107 | ext v |
| 108 | apply ext_inner_right ℝ |
| 109 | intro w |
| 110 | simpa only [Function.comp_apply, add_apply, mul_apply_eq_comp, inner_add_left, |
| 111 | ContinuousLinearMap.adjoint_inner_left, formOperator_pairing] using hG' v w |
| 112 | · change mvfderiv (𝓡 n) (fun q ↦ formOperator (B q)) p X = _ |
| 113 | rw [mvfderiv_const_clm formOperator B p hB X] |
| 114 | ext v |
| 115 | apply ext_inner_right ℝ |
| 116 | intro w |
| 117 | simpa only [Function.comp_apply, add_apply, mul_apply_eq_comp, inner_add_left, |
| 118 | ContinuousLinearMap.adjoint_inner_left, formOperator_pairing] using hB' v w |
| 119 | |
| 120 | end InnerProduct |
| 121 | |
| 122 | end PoincareMT.ReducedLength |