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.TimeDerivative |
| 2 | |
| 3 | /-! |
| 4 | # Time differentiation at arbitrary covariant order |
| 5 | |
| 6 | The time derivative of a covariant derivative has one connection-variation |
| 7 | term in every tensor slot. In particular, this applies to Hamilton's |
| 8 | three-tensor before taking its divergence in the two-tensor evolution. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | set_option backward.isDefEq.respectTransparency false |
| 13 | |
| 14 | open scoped Manifold ContDiff Bundle Topology BigOperators |
| 15 | open Filter Set |
| 16 | |
| 17 | universe u |
| 18 | |
| 19 | namespace PoincareMT.RicciFlow |
| 20 | |
| 21 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 22 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 23 | {J : Set ℝ} |
| 24 | |
| 25 | private lemma contDiffAt_clm_of_apply |
| 26 | {E G : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 27 | [NormedAddCommGroup G] [NormedSpace ℝ G] [FiniteDimensional ℝ E] |
| 28 | {f : ℝ → E →L[ℝ] G} {t : ℝ} |
| 29 | (hf : ∀ v, ContDiffAt ℝ ∞ (fun s => f s v) t) : |
| 30 | ContDiffAt ℝ ∞ f t := by |
| 31 | let d := Module.finrank ℝ E |
| 32 | have hd : d = Module.finrank ℝ (Fin d → ℝ) := (Module.finrank_fin_fun ℝ).symm |
| 33 | let e₁ : E ≃L[ℝ] (Fin d → ℝ) := ContinuousLinearEquiv.ofFinrankEq hd |
| 34 | let e₂ := (e₁.arrowCongr (1 : G ≃L[ℝ] G)).trans |
| 35 | (ContinuousLinearEquiv.piRing (Fin d)) |
| 36 | rw [← Function.id_comp f, ← e₂.symm_comp_self] |
| 37 | exact e₂.symm.contDiff.contDiffAt.comp t |
| 38 | (contDiffAt_pi.mpr fun i => hf _) |
| 39 | |
| 40 | /-- Differentiate an arbitrary tensor evaluation with one moving input. -/ |
| 41 | lemma hasDerivAt_covariantTensorEvaluation_update |
| 42 | (F : RicciFlow n M J) {k : ℕ} {T W : ℝ → CovariantTensorEvaluation n M k} |
| 43 | {t : ℝ} {x : M} |
| 44 | (hT : ∀ s, IsSmoothCovariantTensor (T s)) |
| 45 | (hreg : ∀ (y : M) (X : Fin k → (z : M) → TangentSpace (𝓡 n) z), |
| 46 | (∀ i, ContMDiffAt (𝓡 n) ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ |
| 47 | (T% (X i)) y) → |
| 48 | ContMDiffAt (𝓘(ℝ, ℝ).prod (𝓡 n)) 𝓘(ℝ, ℝ) ∞ |
| 49 | (fun p : ℝ × M => T p.1 p.2 (fun i => X i p.2)) (t, y)) |
| 50 | (hW : ∀ (y : M) (z : Fin k → TangentSpace (𝓡 n) y), |
| 51 | HasDerivAt (fun s => T s y z) (W t y z) t) |
| 52 | (v : Fin k → TangentSpace (𝓡 n) x) (i : Fin k) |
| 53 | {V : ℝ → TangentSpace (𝓡 n) x} {V' : TangentSpace (𝓡 n) x} |
| 54 | (hV : HasDerivAt V V' t) : |
| 55 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 56 | ⟨(F.metric t).toRiemannianMetric⟩ |
| 57 | HasDerivAt (fun s => T s x (Function.update v i (V s))) |
| 58 | (W t x (Function.update v i (V t)) + T t x (Function.update v i V')) t := by |
| 59 | classical |
| 60 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 61 | ⟨(F.metric t).toRiemannianMetric⟩ |
| 62 | let : FiniteDimensional ℝ (TangentSpace (𝓡 n) x) := |
| 63 | VectorBundle.finiteDimensional ℝ (EuclideanSpace ℝ (Fin n)) |
| 64 | (TangentSpace (𝓡 n) : M → Type _) x |
| 65 | choose B hB using fun s => (hT s).1 x |
| 66 | let L : ℝ → TangentSpace (𝓡 n) x →L[ℝ] ℝ := fun s => |
| 67 | ((B s).toLinearMap v i).toContinuousLinearMap |
| 68 | have hL (s : ℝ) (q : TangentSpace (𝓡 n) x) : L s q = T s x (Function.update v i q) := |
| 69 | (hB s _).symm |
| 70 | have hLs : ContDiffAt ℝ ∞ L t := by |
| 71 | apply contDiffAt_clm_of_apply |
| 72 | intro q |
| 73 | let X := fun j => FiberBundle.extend (EuclideanSpace ℝ (Fin n)) (Function.update v i q j) |
| 74 | have hX (j : Fin k) := FiberBundle.contMDiffAt_extend (𝓡 n) |
| 75 | (EuclideanSpace ℝ (Fin n)) (k := ∞) (Function.update v i q j) |
| 76 | have h := ((hreg x X hX).comp t |
| 77 | (contMDiffAt_id.prodMk contMDiffAt_const)).contDiffAt |
| 78 | simpa only [Function.comp_def, id_eq, X, FiberBundle.extend_apply_self, hL] using h |
| 79 | have hLd := (hLs.differentiableAt (by simp)).hasDerivAt |
| 80 | have hfixed := hLd.clm_apply (hasDerivAt_const t (V t)) |
| 81 | have hcoef : (deriv L t) (V t) = W t x (Function.update v i (V t)) := by |
| 82 | simpa only [map_zero, add_zero] using hfixed.unique |
| 83 | ((hW x (Function.update v i (V t))).congr_of_eventuallyEq |
| 84 | (Eventually.of_forall fun s => hL s (V t))) |
| 85 | simpa only [hL, hcoef, add_comm] using hLd.clm_apply hV |
| 86 | |
| 87 | /-- Time differentiation of the canonical covariant derivative, at every |
| 88 | tensor order, including the variation of each covariant input. -/ |
| 89 | lemma hasDerivAt_covariantTensorDerivative_time_all |
| 90 | (F : RicciFlow n M J) {k : ℕ} {T W : ℝ → CovariantTensorEvaluation n M k} |
| 91 | {t : ℝ} (ht : t ∈ interior J) (x : M) |
| 92 | (hT : ∀ s, IsSmoothCovariantTensor (T s)) |
| 93 | (hreg : ∀ (y : M) (X : Fin k → (z : M) → TangentSpace (𝓡 n) z), |
| 94 | (∀ i, ContMDiffAt (𝓡 n) ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ |
| 95 | (T% (X i)) y) → |
| 96 | ContMDiffAt (𝓘(ℝ, ℝ).prod (𝓡 n)) 𝓘(ℝ, ℝ) ∞ |
| 97 | (fun p : ℝ × M => T p.1 p.2 (fun i => X i p.2)) (t, y)) |
| 98 | (hW : ∀ (y : M) (z : Fin k → TangentSpace (𝓡 n) y), |
| 99 | HasDerivAt (fun s => T s y z) (W t y z) t) |
| 100 | (u : TangentSpace (𝓡 n) x) (v : Fin k → TangentSpace (𝓡 n) x) : |
| 101 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 102 | ⟨(F.metric t).toRiemannianMetric⟩ |
| 103 | let A := fun z : TangentSpace (𝓡 n) x => deriv (fun s => |
| 104 | (F.connection s).connection (FiberBundle.extend (EuclideanSpace ℝ (Fin n)) z) x) t |
| 105 | HasDerivAt (fun s => (F.connection s).covariantTensorDerivative (T s) x (Fin.cons u v)) |
| 106 | ((F.connection t).covariantTensorDerivative (W t) x (Fin.cons u v) - |
| 107 | ∑ i, T t x (Function.update v i (A (v i) u))) t := by |
| 108 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 109 | ⟨(F.metric t).toRiemannianMetric⟩ |
| 110 | let X := fun i => FiberBundle.extend (EuclideanSpace ℝ (Fin n)) (v i) |
| 111 | have hX (i : Fin k) := |
| 112 | FiberBundle.contMDiffAt_extend (𝓡 n) (EuclideanSpace ℝ (Fin n)) (k := ∞) (v i) |
| 113 | have hconn (i : Fin k) := |
| 114 | ((F.contDiffAt_connection ht (hX i)).differentiableAt (by simp)).hasDerivAt |
| 115 | have hconnU (i : Fin k) := (hconn i).clm_apply (hasDerivAt_const t u) |
| 116 | simp only [map_zero, add_zero] at hconnU |
| 117 | have hraw := Poincare.Manifold.hasDerivAt_mvfderiv_time |
| 118 | (hreg x X hX) (fun y => hW y (fun i => X i y)) u |
| 119 | have hslot (i : Fin k) := F.hasDerivAt_covariantTensorEvaluation_update hT hreg hW v i (hconnU i) |
| 120 | have hsum := HasDerivAt.sum (u := Finset.univ) fun i _ => hslot i |
| 121 | have h := hraw.sub hsum |
| 122 | convert h using 1 <;> try rfl |
| 123 | · funext s |
| 124 | simp only [LeviCivitaData.covariantTensorDerivative, Fin.cons_zero, Fin.cons_succ, |
| 125 | Pi.sub_apply, Finset.sum_apply, X] |
| 126 | · simp only [LeviCivitaData.covariantTensorDerivative, Fin.cons_zero, Fin.cons_succ, |
| 127 | Finset.sum_add_distrib, sub_sub, X] |
| 128 | |
| 129 | end PoincareMT.RicciFlow |