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.Connection.Variation |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Minimum.Variation.Frame.AdaptedCoefficient |
| 3 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Minimum.Variation.Frame.CoefficientRegularity |
| 4 | |
| 5 | /-! |
| 6 | # Square-time variation of the retained chart connection |
| 7 | |
| 8 | The time derivative of the connection is tensorial in the extended field. |
| 9 | Combining the actual Ricci-flow connection variation with the square-time chain |
| 10 | rule identifies the time derivative of the retained chart coefficient. |
| 11 | |
| 12 | The tensoriality argument follows the private `deriv_connection_eq_extend` in |
| 13 | `Curvature/ScalarEvolution/CurvatureVariation.lean`. The resulting identity is |
| 14 | the interior-time counterpart of Mapher `Proofs/M08/ConnectionTimeIdentity.lean` |
| 15 | and `SecondVariationCoefficients.lean`, commit |
| 16 | `49331b7d7ecad38f53e4300c3b35d6a84b2cc648`; it uses the Ricci-flow equation |
| 17 | directly, with no curvature-theory service. |
| 18 | -/ |
| 19 | |
| 20 | set_option autoImplicit false |
| 21 | set_option backward.isDefEq.respectTransparency false |
| 22 | |
| 23 | open Set Filter Topology |
| 24 | open scoped Manifold ContDiff Bundle |
| 25 | |
| 26 | noncomputable section |
| 27 | |
| 28 | universe u |
| 29 | |
| 30 | namespace PoincareMT.ReducedLengthMinimum.Variation.Geometry |
| 31 | |
| 32 | open PoincareMT.ReducedLengthMinimum.Variational |
| 33 | open PoincareMT.ReducedLengthMinimum.Variation.Frame |
| 34 | |
| 35 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 36 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 37 | [IsManifold (𝓡 n) ∞ M] |
| 38 | |
| 39 | local instance connectionTimeEndGroup : |
| 40 | NormedAddCommGroup (EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin n)) := |
| 41 | ContinuousLinearMap.toNormedAddCommGroup |
| 42 | local instance connectionTimeEndSpace : |
| 43 | NormedSpace ℝ (EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin n)) := |
| 44 | ContinuousLinearMap.toNormedSpace |
| 45 | local instance connectionTimeBilinearGroup : |
| 46 | NormedAddCommGroup (EuclideanSpace ℝ (Fin n) →L[ℝ] |
| 47 | EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin n)) := |
| 48 | ContinuousLinearMap.toNormedAddCommGroup |
| 49 | local instance connectionTimeBilinearSpace : |
| 50 | NormedSpace ℝ (EuclideanSpace ℝ (Fin n) →L[ℝ] |
| 51 | EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin n)) := |
| 52 | ContinuousLinearMap.toNormedSpace |
| 53 | |
| 54 | /-- The time derivative of a connection does not depend on the smooth field |
| 55 | chosen to extend its second tangent argument. -/ |
| 56 | theorem connection_time_deriv_eq_extend |
| 57 | {J : Set ℝ} (F : RicciFlow n M J) {t : ℝ} (ht : t ∈ interior J) {y : M} |
| 58 | {Y : (z : M) → TangentSpace (𝓡 n) z} |
| 59 | (hY : ContMDiffAt (𝓡 n) ((𝓡 n).prod (𝓡 n)) ∞ (T% Y) y) : |
| 60 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 61 | ⟨(F.metric t).toRiemannianMetric⟩ |
| 62 | deriv (fun r => (F.connection r).connection Y y) t = |
| 63 | deriv (fun r => (F.connection r).connection |
| 64 | (FiberBundle.extend (EuclideanSpace ℝ (Fin n)) (Y y)) y) t := by |
| 65 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 66 | ⟨(F.metric t).toRiemannianMetric⟩ |
| 67 | let Z := FiberBundle.extend (EuclideanSpace ℝ (Fin n)) (Y y) |
| 68 | have hZ := FiberBundle.contMDiffAt_extend (𝓡 n) (EuclideanSpace ℝ (Fin n)) |
| 69 | (k := ∞) (Y y) |
| 70 | have heq (r : ℝ) : |
| 71 | (F.connection r).connection Y y - (F.connection t).connection Y y = |
| 72 | (F.connection r).connection Z y - (F.connection t).connection Z y := by |
| 73 | have h₁ := (F.connection r).connection.isCovariantDerivativeOnUniv.difference_apply |
| 74 | (F.connection t).connection.isCovariantDerivativeOnUniv (by simp) |
| 75 | (hY.mdifferentiableAt (by simp)) |
| 76 | have h₂ := (F.connection r).connection.isCovariantDerivativeOnUniv.difference_apply |
| 77 | (F.connection t).connection.isCovariantDerivativeOnUniv (by simp) |
| 78 | (hZ.mdifferentiableAt (by simp)) |
| 79 | simp only [FiberBundle.extend_apply_self] at h₂ |
| 80 | exact h₁.symm.trans h₂ |
| 81 | have h₁ := ((F.contDiffAt_connection ht hY).differentiableAt (by simp)).hasDerivAt.sub_const |
| 82 | ((F.connection t).connection Y y) |
| 83 | have h₂ := ((F.contDiffAt_connection ht hZ).differentiableAt (by simp)).hasDerivAt.sub_const |
| 84 | ((F.connection t).connection Z y) |
| 85 | exact h₁.unique (h₂.congr_of_eventuallyEq (Eventually.of_forall heq)) |
| 86 | |
| 87 | /-- The retained connection-time derivative is the negative backward-time |
| 88 | Ricci derivative combination, for every locally smooth extending field. -/ |
| 89 | theorem connection_time_deriv_pairing |
| 90 | {J : Set ℝ} (F : RicciFlow n M J) {t : ℝ} (ht : t ∈ interior J) {y : M} |
| 91 | {Y : (z : M) → TangentSpace (𝓡 n) z} |
| 92 | (hY : ContMDiffAt (𝓡 n) ((𝓡 n).prod (𝓡 n)) ∞ (T% Y) y) |
| 93 | (v w : TangentSpace (𝓡 n) y) : |
| 94 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 95 | ⟨(F.metric t).toRiemannianMetric⟩ |
| 96 | (F.metric t).inner y ((deriv (fun r => (F.connection r).connection Y y) t) v) w = |
| 97 | -backwardConnectionVariationPairing (F.connection t) y v (Y y) w := by |
| 98 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 99 | ⟨(F.metric t).toRiemannianMetric⟩ |
| 100 | rw [connection_time_deriv_eq_extend F ht hY, |
| 101 | F.inner_deriv_connection_extend_of_equation ht] |
| 102 | unfold backwardConnectionVariationPairing ricciDerivativePairing |
| 103 | ring |
| 104 | |
| 105 | /-- Composing the actual retained connection with `T - s^2` multiplies the |
| 106 | backward connection variation pairing by `2 * s`. -/ |
| 107 | theorem squareTime_connection_deriv_pairing |
| 108 | {J : Set ℝ} (F : RicciFlow n M J) (T : ℝ) {s : ℝ} |
| 109 | (ht : T - s ^ 2 ∈ interior J) {y : M} |
| 110 | {Y : (z : M) → TangentSpace (𝓡 n) z} |
| 111 | (hY : ContMDiffAt (𝓡 n) ((𝓡 n).prod (𝓡 n)) ∞ (T% Y) y) |
| 112 | (v w : TangentSpace (𝓡 n) y) : |
| 113 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 114 | ⟨(F.metric (T - s ^ 2)).toRiemannianMetric⟩ |
| 115 | (F.metric (T - s ^ 2)).inner y |
| 116 | (deriv (fun r => (F.connection (T - r ^ 2)).connection Y y v) s) w = |
| 117 | 2 * s * backwardConnectionVariationPairing (F.connection (T - s ^ 2)) y v (Y y) w := by |
| 118 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 119 | ⟨(F.metric (T - s ^ 2)).toRiemannianMetric⟩ |
| 120 | have hC := ((F.contDiffAt_connection ht hY).differentiableAt (by simp)).hasDerivAt |
| 121 | have hCv := hC.clm_apply (hasDerivAt_const (T - s ^ 2) v) |
| 122 | have htime : HasDerivAt (fun r : ℝ => T - r ^ 2) (-(2 * s)) s := by |
| 123 | simpa using (hasDerivAt_pow 2 s).const_sub T |
| 124 | have hd := (hCv.scomp s htime).deriv |
| 125 | simp only [Function.comp_def, map_zero, add_zero] at hd |
| 126 | rw [hd] |
| 127 | simp only [map_smul, smul_apply, smul_eq_mul] |
| 128 | rw [connection_time_deriv_pairing F ht hY] |
| 129 | ring |
| 130 | |
| 131 | /-- The time derivative of the actual chart connection coefficient is the |
| 132 | retained backward connection variation, with its square-time factor. -/ |
| 133 | theorem chartConnectionBilinear_time_pairing |
| 134 | {J : Set ℝ} (F : RicciFlow n M J) (T s : ℝ) (x y : M) |
| 135 | (hy : y ∈ (chartAt (EuclideanSpace ℝ (Fin n)) x).source) |
| 136 | (ht : T - s ^ 2 ∈ interior J) (v w z : EuclideanSpace ℝ (Fin n)) : |
| 137 | chartActionMetric F T x (s, extChartAt (𝓡 n) x y) |
| 138 | (fderiv ℝ (chartConnectionBilinear (chartActionMetric F T x)) |
| 139 | (s, extChartAt (𝓡 n) x y) (1, 0) v w) z = |
| 140 | 2 * s * backwardConnectionVariationPairing (F.connection (T - s ^ 2)) y |
| 141 | (chartFrame x v y) (chartFrame x w y) (chartFrame x z y) := by |
| 142 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 143 | ⟨(F.metric (T - s ^ 2)).toRiemannianMetric⟩ |
| 144 | have hy' : y ∈ (extChartAt (𝓡 n) x).source := by |
| 145 | simpa only [extChartAt_source] using hy |
| 146 | have hq : (s, extChartAt (𝓡 n) x y) ∈ chartActionDomain F T x := |
| 147 | ⟨squareTime_mem_interior_preimage ht, (extChartAt (𝓡 n) x).map_source hy'⟩ |
| 148 | have hC := ((chartConnectionBilinear_contDiffOn (chartActionMetric F T x) |
| 149 | (chartActionDomain F T x) (chartActionDomain_open F T x) |
| 150 | (chartActionMetric_contDiffOn F T x) |
| 151 | (fun z hz => chartActionMetric_pos F T x hz)) _ hq).contDiffAt |
| 152 | ((chartActionDomain_open F T x).mem_nhds hq) |
| 153 | have hc := (hC.differentiableAt (by simp)).hasFDerivAt.comp_hasDerivAt s |
| 154 | ((hasDerivAt_id s).prodMk (hasDerivAt_const s (extChartAt (𝓡 n) x y))) |
| 155 | have hvw := (hc.clm_apply (hasDerivAt_const s v)).clm_apply (hasDerivAt_const s w) |
| 156 | simp only [Function.comp_def, map_zero, add_zero] at hvw |
| 157 | let e := trivializationAt (EuclideanSpace ℝ (Fin n)) (TangentSpace (𝓡 n)) x |
| 158 | have hframe := (e.symmL ℝ y).hasFDerivAt.comp_hasDerivAt s hvw |
| 159 | have heq : (fun r => (F.connection (T - r ^ 2)).connection |
| 160 | (chartFrame x w) y (chartFrame x v y)) =ᶠ[𝓝 s] |
| 161 | fun r => e.symmL ℝ y |
| 162 | (chartConnectionBilinear (chartActionMetric F T x) |
| 163 | (r, extChartAt (𝓡 n) x y) v w) := by |
| 164 | filter_upwards [(continuous_const.sub (continuous_id.pow 2)).continuousAt.preimage_mem_nhds |
| 165 | (isOpen_interior.mem_nhds ht)] with r hr |
| 166 | exact chartConnection_eq_retainedConnection F T r x y hy hr v w |
| 167 | have hd := (hframe.congr_of_eventuallyEq heq).deriv |
| 168 | have hY := (chartFrame_contMDiffOn x w y hy).contMDiffAt |
| 169 | ((chartAt (EuclideanSpace ℝ (Fin n)) x).open_source.mem_nhds hy) |
| 170 | rw [chartActionMetric_apply F T hy] |
| 171 | change (F.metric (T - s ^ 2)).inner y |
| 172 | (e.symmL ℝ y (fderiv ℝ (chartConnectionBilinear (chartActionMetric F T x)) |
| 173 | (s, extChartAt (𝓡 n) x y) (1, 0) v w)) (chartFrame x z y) = _ |
| 174 | rw [← hd] |
| 175 | exact squareTime_connection_deriv_pairing F T ht hY (chartFrame x v y) (chartFrame x z y) |
| 176 | |
| 177 | end PoincareMT.ReducedLengthMinimum.Variation.Geometry |