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.Barrier.ComparisonLineVariation |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Barrier.ComparisonHessian |
| 3 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Variation.Index.AdaptedVariationIndex |
| 4 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Tensor.LocalHessianTrace |
| 5 | |
| 6 | /-! |
| 7 | # The exact Laplacian of the adapted comparison action |
| 8 | |
| 9 | Every scalar variation is a line in the same original comparison family. |
| 10 | The Hessian equalities therefore trace the actual constructed barrier. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | set_option maxSynthPendingDepth 3 |
| 15 | |
| 16 | open scoped Manifold ContDiff Bundle Topology BigOperators |
| 17 | open Filter |
| 18 | |
| 19 | universe u |
| 20 | |
| 21 | namespace PoincareMT.ReducedLength |
| 22 | |
| 23 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 24 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 25 | [IsManifold (𝓡 n) ∞ M] [ConnectedSpace M] |
| 26 | {J : Set ℝ} {F : RicciFlow n M J} {T τmax : ℝ} {p : M} |
| 27 | |
| 28 | local notation "E" => EuclideanSpace ℝ (Fin n) |
| 29 | local notation "V" => Fin n → ℝ |
| 30 | |
| 31 | set_option maxHeartbeats 2000000 in |
| 32 | -- The actual line fields, derivative witnesses and selected terminal metric are kept in the trace. |
| 33 | set_option backward.isDefEq.respectTransparency false in |
| 34 | theorem comparison_family_laplacian_eq |
| 35 | (hM04 : RicciFlowCurvatureTheory.{u}) (hL : LGeodesicTheory F T τmax) |
| 36 | (hτmax : 0 < τmax) (hwindow : Set.Icc (T - τmax) T ⊆ J) |
| 37 | (A : LExponentialFamily F T τmax p) (Z : TangentSpace (𝓡 n) p) |
| 38 | (b : ℝ) (hb : 0 < b) (hmax : b < τmax) |
| 39 | (hmin : IsMinimizingBackwardLPath F T 0 b (A.path Z b hb hmax)) |
| 40 | (P : Fin n → ∀ s, TangentSpace (𝓡 n) (A.squareFamily Z s)) |
| 41 | (U : Set ℝ) (hU : IsOpen U) (hKU : Set.Icc 0 (Real.sqrt b) ⊆ U) |
| 42 | (htime : U ⊆ Set.Ioo (-Real.sqrt τmax) (Real.sqrt τmax)) |
| 43 | (hα : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ (A.squareFamily Z) U) |
| 44 | (hP : ∀ i, IsAdaptedFieldOn F T (A.squareFamily Z) (P i) U) |
| 45 | (hpair : ∀ s ∈ U, ∀ i j, (F.metric (T - s ^ 2)).inner (A.squareFamily Z s) |
| 46 | (P i s) (P j s) = if i = j then 1 else 0) |
| 47 | (f : V × ℝ → M) (Ω : Set (V × ℝ)) (hΩ : IsOpen Ω) |
| 48 | (hf : ContMDiffOn (𝓘(ℝ, V × ℝ)) (𝓡 n) ∞ f Ω) |
| 49 | (hsegment : ∀ s ∈ Set.Icc 0 (Real.sqrt b), ((0 : V), s) ∈ Ω) |
| 50 | (hbase : ∀ s, f (0, s) = A.squareFamily Z s) |
| 51 | (hfixed : ∀ x, f (x, 0) = p) |
| 52 | (hfields : ∀ s ∈ Set.Icc 0 (Real.sqrt b), ∀ x : V, |
| 53 | (curveVelocity (n := n) (fun r : ℝ ↦ f (r • x, s)) 0 : E) = |
| 54 | ∑ i, x i • ((s / Real.sqrt b) • P i s)) |
| 55 | (B : M × ℝ → ℝ) (O : Set M) (hO : IsOpen O) (hqO : A.gamma Z b ∈ O) |
| 56 | (hB : ContMDiffOn (𝓡 n) (𝓘(ℝ, ℝ)) ∞ (fun q ↦ B (q, b)) O) |
| 57 | (hdf : ∀ v : TangentSpace (𝓡 n) (A.gamma Z b), |
| 58 | mvfderiv (𝓡 n) (fun q ↦ B (q, b)) (A.gamma Z b) v = |
| 59 | (F.metric (T - b)).inner (A.gamma Z b) (curveVelocity (A.gamma Z) b) v) |
| 60 | (hpull : (fun z : V × ℝ ↦ B (f (z.1, Real.sqrt z.2), z.2)) =ᶠ[𝓝 (0, b)] |
| 61 | (fun z ↦ backwardLLength F T 0 z.2 (fun t ↦ f (z.1, Real.sqrt t)) / |
| 62 | (2 * Real.sqrt z.2))) : |
| 63 | reducedLengthLaplacian F T B b (A.gamma Z b) = |
| 64 | (n : ℝ) / (2 * b) - (F.connection (T - b)).scalarCurvature (A.gamma Z b) - |
| 65 | reducedHarnackIntegral F T (A.gamma Z) |
| 66 | (backwardScalarEvolutionAlong F T (A.gamma Z)) b / (2 * b * Real.sqrt b) := by |
| 67 | classical |
| 68 | let c := Real.sqrt b |
| 69 | let K := sqrtParameterInterval 0 b |
| 70 | have hc : 0 < c := Real.sqrt_pos.mpr hb |
| 71 | have hc2 : c ^ 2 = b := Real.sq_sqrt hb.le |
| 72 | have hcK : c ∈ K := ⟨Real.sqrt_le_sqrt hb.le, le_rfl⟩ |
| 73 | have hKU' : K ⊆ U := by simpa only [K, sqrtParameterInterval, Real.sqrt_zero] using hKU |
| 74 | have hend : A.squareFamily Z c = A.gamma Z b := by |
| 75 | rw [A.square_agrees Z c ⟨hc.le, Real.sqrt_lt_sqrt hb.le hmax⟩, hc2] |
| 76 | let Y : Fin n → ∀ s, TangentSpace (𝓡 n) (A.squareFamily Z s) := |
| 77 | fun i s ↦ (s / c) • P i s |
| 78 | have hY (i : Fin n) : ContMDiffOn (𝓘(ℝ, ℝ)) ((𝓡 n).prod (𝓡 n)) ∞ |
| 79 | (fun s ↦ (⟨A.squareFamily Z s, Y i s⟩ : TangentBundle (𝓡 n) M)) U := |
| 80 | field_smul_smooth (A.squareFamily Z) (P i) (fun s ↦ s / c) U hU hα |
| 81 | (contDiffOn_id.div_const c) (hP i).smooth |
| 82 | let HP (i : Fin n) := Classical.choice (nonempty_parametricFieldExtensionOn_compact |
| 83 | (A.squareFamily Z) (P i) U K hU hKU' isCompact_Icc hα (hP i).smooth) |
| 84 | let HY (i : Fin n) := Classical.choice (nonempty_parametricFieldExtensionOn_compact |
| 85 | (A.squareFamily Z) (Y i) U K hU hKU' isCompact_Icc hα (hY i)) |
| 86 | choose W hWbase hWf hWa using fun i : Fin n ↦ |
| 87 | exists_initialFixedLVariation_of_parameter_line hM04 hτmax hwindow A Z b hb hmax |
| 88 | f Ω hΩ hf hsegment hbase hfixed (Pi.single i (1 : ℝ)) |
| 89 | have hfield (i : Fin n) (s : ℝ) (hs : s ∈ K) : |
| 90 | (squareVariationField (W i).toLVariation s : E) = (s / c) • P i s := by |
| 91 | have hline : (fun u ↦ (W i).squareFamily s u) = |
| 92 | (fun u : ℝ ↦ f (u • Pi.single i (1 : ℝ), s)) := funext (hWf i s) |
| 93 | change (curveVelocity (fun u ↦ (W i).squareFamily s u) 0 : E) = _ |
| 94 | rw [hline] |
| 95 | have hs' : s ∈ Set.Icc 0 (Real.sqrt b) := by |
| 96 | simpa only [K, sqrtParameterInterval, Real.sqrt_zero] using hs |
| 97 | simpa [Pi.single_apply] using hfields s hs' (Pi.single i (1 : ℝ)) |
| 98 | have hpullLine (i : Fin n) : (fun u ↦ B ((W i).squareFamily c u, b)) =ᶠ[𝓝 (0 : ℝ)] |
| 99 | (fun u ↦ variationLLength (W i).toLVariation u / (2 * c)) := by |
| 100 | have htend : Tendsto (fun u : ℝ ↦ (u • Pi.single i (1 : ℝ), b)) (𝓝 0) (𝓝 (0, b)) := by |
| 101 | have hcont : Continuous (fun u : ℝ ↦ (u • Pi.single i (1 : ℝ), b)) := |
| 102 | (continuous_id.smul continuous_const).prodMk continuous_const |
| 103 | simpa only [zero_smul] using hcont.tendsto (0 : ℝ) |
| 104 | have h := hpull.comp_tendsto htend |
| 105 | filter_upwards [h] with u hu |
| 106 | rw [hWf i c u, hWa i u] |
| 107 | exact hu |
| 108 | choose D hH using fun i : Fin n ↦ lExponentialFamily_hessian_eq_variation_index |
| 109 | hM04 hL hτmax hwindow A Z b hb hmax hmin (fun q ↦ B (q, b)) O hO hqO hB |
| 110 | hdf (W i) (hWbase i) (hpullLine i) |
| 111 | have hterminal (i : Fin n) : (squareVariationField (W i).toLVariation c : E) = P i c := by |
| 112 | rw [hfield i c hcK, div_self hc.ne', one_smul] |
| 113 | have hdiag (i : Fin n) : |
| 114 | (F.connection (T - b)).hessian (fun q ↦ B (q, b)) (A.gamma Z b) (P i c) (P i c) = |
| 115 | secondVariationIndexForm (W i).toLVariation (D i) / (2 * c) := by |
| 116 | have h := hH i |
| 117 | change (F.connection (T - b)).hessian (fun q ↦ B (q, b)) (A.gamma Z b) |
| 118 | (squareVariationField (W i).toLVariation c) (squareVariationField (W i).toLVariation c) = |
| 119 | secondVariationIndexForm (W i).toLVariation (D i) / (2 * c) at h |
| 120 | rw [hterminal i] at h |
| 121 | exact h |
| 122 | have htrace : (∑ i, (F.connection (T - b)).hessian (fun q ↦ B (q, b)) |
| 123 | (A.gamma Z b) (P i c) (P i c)) = reducedLengthLaplacian F T B b (A.gamma Z b) := by |
| 124 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 125 | ⟨(F.metric (T - c ^ 2)).toRiemannianMetric⟩ |
| 126 | have hePair (i j : Fin n) : (F.metric (T - c ^ 2)).inner (A.gamma Z b) (P i c) (P j c) = |
| 127 | if i = j then 1 else 0 := by |
| 128 | rw [← hend] |
| 129 | exact hpair c (hKU' hcK) i j |
| 130 | obtain ⟨e, he⟩ := exists_orthonormalBasis_of_metric_pairing (F.metric (T - c ^ 2)) |
| 131 | (A.gamma Z b) (fun i ↦ (P i c : E)) hePair |
| 132 | have h := squareTime_laplacian_orthonormal_trace_local F T τmax hτmax hwindow |
| 133 | (A.gamma Z b) c (htime (hKU' hcK)) (fun q ↦ B (q, b)) O hO hqO hB e |
| 134 | have h' : (∑ i, (F.connection (T - c ^ 2)).hessian (fun q ↦ B (q, b)) |
| 135 | (A.gamma Z b) (P i c) (P i c)) = |
| 136 | (F.connection (T - c ^ 2)).laplacian (fun q ↦ B (q, b)) (A.gamma Z b) := by |
| 137 | simpa only [he] using h |
| 138 | rw [hc2] at h' |
| 139 | exact h' |
| 140 | have hsum := Finset.sum_congr (s₁ := Finset.univ) (s₂ := Finset.univ) rfl (fun i _ ↦ hdiag i) |
| 141 | rw [htrace, ← Finset.sum_div, |
| 142 | realized_adapted_variations_index_sum hM04 hτmax hwindow A Z b hb hmax P U hU hKU' |
| 143 | htime hα hP hpair HP HY W hWbase hfield D] at hsum |
| 144 | change reducedLengthLaplacian F T B b (A.gamma Z b) = |
| 145 | ((n : ℝ) / c - 2 * c * (F.connection (T - c ^ 2)).scalarCurvature (A.squareFamily Z c) - |
| 146 | reducedHarnackIntegral F T (A.gamma Z) |
| 147 | (backwardScalarEvolutionAlong F T (A.gamma Z)) b / c ^ 2) / (2 * c) at hsum |
| 148 | rw [hc2, hend] at hsum |
| 149 | have halgebra (R Q : ℝ) : ((n : ℝ) / c - 2 * c * R - Q / b) / (2 * c) = |
| 150 | (n : ℝ) / (2 * b) - R - Q / (2 * b * c) := by |
| 151 | rw [← hc2] |
| 152 | field_simp [hc.ne'] <;> ring |
| 153 | exact hsum.trans (halgebra _ _) |
| 154 | |
| 155 | end PoincareMT.ReducedLength |