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.Tensor.HeatGradient |
| 2 | import PoincareLib.Geometry.Riemannian.Tensor.Laplacian.Product |
| 3 | |
| 4 | /-! # Covariant heat operators on tensor products and permutations -/ |
| 5 | |
| 6 | set_option autoImplicit false |
| 7 | set_option backward.isDefEq.respectTransparency false |
| 8 | |
| 9 | open scoped Manifold ContDiff Bundle Topology BigOperators |
| 10 | |
| 11 | universe u |
| 12 | |
| 13 | namespace PoincareMT |
| 14 | |
| 15 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 16 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 17 | {g : RiemannianMetric n M} {J : Set ℝ} |
| 18 | |
| 19 | lemma LeviCivitaData.ricciTensorAction_reindex {k : ℕ} (D : LeviCivitaData g) |
| 20 | (T : CovariantTensorEvaluation n M k) (σ : Equiv.Perm (Fin k)) |
| 21 | (x : M) (v : Fin k → TangentSpace (𝓡 n) x) : |
| 22 | D.ricciTensorAction (fun y w => T y (w ∘ σ)) x v = |
| 23 | D.ricciTensorAction T x (v ∘ σ) := by |
| 24 | unfold LeviCivitaData.ricciTensorAction |
| 25 | rw [← Equiv.sum_comp σ] |
| 26 | simp only [Function.update_comp_eq_of_injective v σ.injective, Function.comp_apply] |
| 27 | |
| 28 | lemma RicciFlow.tensorHeatOperator_reindex {k : ℕ} (F : RicciFlow n M J) |
| 29 | (T : ℝ → CovariantTensorEvaluation n M k) (σ : Equiv.Perm (Fin k)) |
| 30 | (t : ℝ) (x : M) (v : Fin k → TangentSpace (𝓡 n) x) : |
| 31 | F.tensorHeatOperator (fun s y w => T s y (w ∘ σ)) t x v = |
| 32 | F.tensorHeatOperator T t x (v ∘ σ) := by |
| 33 | simp only [RicciFlow.tensorHeatOperator, LeviCivitaData.ricciTensorAction_reindex, |
| 34 | LeviCivitaData.tensorLaplacian_reindex] |
| 35 | |
| 36 | lemma LeviCivitaData.ricciTensorAction_tensorProduct {k l : ℕ} |
| 37 | (D : LeviCivitaData g) (S : CovariantTensorEvaluation n M k) |
| 38 | (T : CovariantTensorEvaluation n M l) |
| 39 | (x : M) (v : Fin (k + l) → TangentSpace (𝓡 n) x) : |
| 40 | D.ricciTensorAction (tensorProduct S T) x v = |
| 41 | D.ricciTensorAction S x (fun i => v (Fin.castAdd l i)) * |
| 42 | T x (fun i => v (Fin.natAdd k i)) + |
| 43 | S x (fun i => v (Fin.castAdd l i)) * |
| 44 | D.ricciTensorAction T x (fun i => v (Fin.natAdd k i)) := by |
| 45 | have hne (i : Fin k) (j : Fin l) : Fin.castAdd l i ≠ Fin.natAdd k j := by |
| 46 | intro h |
| 47 | have hh := congrArg Fin.val h |
| 48 | simp only [Fin.val_castAdd, Fin.val_natAdd] at hh |
| 49 | omega |
| 50 | simp only [LeviCivitaData.ricciTensorAction, tensorProduct, Fin.sum_univ_add, |
| 51 | Function.update_comp_eq_of_injective' v (Fin.castAdd_injective k l), |
| 52 | Function.update_comp_eq_of_injective' v (Fin.natAdd_injective l k), |
| 53 | Function.update_comp_eq_of_forall_ne' v _ (fun j => (hne _ j).symm), |
| 54 | Function.update_comp_eq_of_forall_ne' v _ (fun i => hne i _), |
| 55 | Finset.sum_mul, Finset.mul_sum, mul_assoc, mul_left_comm] |
| 56 | |
| 57 | lemma RicciFlow.tensorHeatOperator_tensorProduct_four_two |
| 58 | (F : RicciFlow n M J) |
| 59 | {S : ℝ → CovariantTensorEvaluation n M 4} |
| 60 | {T : ℝ → CovariantTensorEvaluation n M 2} {t : ℝ} |
| 61 | (hS : IsSmoothCovariantTensor (S t)) (hT : IsSmoothCovariantTensor (T t)) |
| 62 | (hDS : IsSmoothCovariantTensor ((F.connection t).covariantTensorDerivative (S t))) |
| 63 | (hDT : IsSmoothCovariantTensor ((F.connection t).covariantTensorDerivative (T t))) |
| 64 | (hSt : ∀ y z, DifferentiableAt ℝ (fun s => S s y z) t) |
| 65 | (hTt : ∀ y z, DifferentiableAt ℝ (fun s => T s y z) t) |
| 66 | (x : M) (a b c d e f : TangentSpace (𝓡 n) x) : |
| 67 | F.tensorHeatOperator (fun s => tensorProduct (S s) (T s)) t x ![a,b,c,d,e,f] = |
| 68 | F.tensorHeatOperator S t x ![a,b,c,d] * T t x ![e,f] + |
| 69 | S t x ![a,b,c,d] * F.tensorHeatOperator T t x ![e,f] - |
| 70 | 2 * ∑ i, |
| 71 | (F.connection t).covariantTensorDerivative (S t) x |
| 72 | ![(F.metric t).orthonormalBasis x i,a,b,c,d] * |
| 73 | (F.connection t).covariantTensorDerivative (T t) x |
| 74 | ![(F.metric t).orthonormalBasis x i,e,f] := by |
| 75 | have hp (s : ℝ) : tensorProduct (S s) (T s) x ![a,b,c,d,e,f] = |
| 76 | S s x ![a,b,c,d] * T s x ![e,f] := by |
| 77 | unfold tensorProduct |
| 78 | congr 1 <;> congr 1 <;> ext i <;> fin_cases i <;> rfl |
| 79 | have ha := (F.connection t).ricciTensorAction_tensorProduct (S t) (T t) |
| 80 | x ![a,b,c,d,e,f] |
| 81 | have hv₁ : (fun i : Fin 4 => ![a,b,c,d,e,f] (Fin.castAdd 2 i)) = ![a,b,c,d] := by |
| 82 | ext i; fin_cases i <;> rfl |
| 83 | have hv₂ : (fun i : Fin 2 => ![a,b,c,d,e,f] (Fin.natAdd 4 i)) = ![e,f] := by |
| 84 | ext i; fin_cases i <;> rfl |
| 85 | rw [hv₁, hv₂] at ha |
| 86 | simp only [RicciFlow.tensorHeatOperator, hp, deriv_fun_mul (hSt _ _) (hTt _ _), ha, |
| 87 | LeviCivitaData.tensorLaplacian_tensorProduct_four_two _ hS hT hDS hDT] |
| 88 | ring |
| 89 | |
| 90 | end PoincareMT |