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.Variation.Index.UnitAdaptedIndexCoefficients |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Variation.Index.ScalarIndexForm |
| 3 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Variation.Index.RealizedIndexDensity |
| 4 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Variation.Differential.RealizedSquareVariation |
| 5 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Barrier.VariationHessianComparison |
| 6 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Tensor.LocalHessianTrace |
| 7 | |
| 8 | /-! |
| 9 | # Actual scalar index comparisons for every smooth weight |
| 10 | |
| 11 | Every scalar weight is realized by a genuine initial-fixed variation. |
| 12 | The scalar index agrees for any supplied second-variation derivative data. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | set_option maxSynthPendingDepth 3 |
| 17 | |
| 18 | open scoped Manifold ContDiff Bundle Topology intervalIntegral |
| 19 | open Filter |
| 20 | |
| 21 | universe u |
| 22 | |
| 23 | namespace PoincareMT.ReducedLength |
| 24 | |
| 25 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 26 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 27 | {J : Set ℝ} {F : RicciFlow n M J} {T τmax : ℝ} {p : M} |
| 28 | |
| 29 | local notation "E" => EuclideanSpace ℝ (Fin n) |
| 30 | |
| 31 | set_option backward.isDefEq.respectTransparency false in |
| 32 | theorem unit_adapted_scalar_index_eq (hM04 : RicciFlowCurvatureTheory.{u}) |
| 33 | (hτmax : 0 < τmax) (hwindow : Set.Icc (T - τmax) T ⊆ J) |
| 34 | (A : LExponentialFamily F T τmax p) (Z : TangentSpace (𝓡 n) p) |
| 35 | (b : ℝ) (hb : 0 < b) (hmax : b < τmax) |
| 36 | (P : ∀ s, TangentSpace (𝓡 n) (A.squareFamily Z s)) |
| 37 | (U : Set ℝ) (hU : IsOpen U) (hKU : Set.Icc 0 (Real.sqrt b) ⊆ U) |
| 38 | (htime : U ⊆ Set.Ioo (-Real.sqrt τmax) (Real.sqrt τmax)) |
| 39 | (hα : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ (A.squareFamily Z) U) |
| 40 | (hP : IsAdaptedFieldOn F T (A.squareFamily Z) P U) (B C : ℝ → ℝ) |
| 41 | (hcoeff : ∀ s ∈ Set.Icc 0 (Real.sqrt b), ∀ f fp : ℝ, |
| 42 | pointwiseSecondVariationDensity F T (A.squareFamily Z s) s |
| 43 | (curveVelocity (A.squareFamily Z) s) (f • P s) |
| 44 | (fp • P s - (2 * s * f) • |
| 45 | ricciOperator hM04 (F.connection (T - s ^ 2)) (A.squareFamily Z s) (P s)) = |
| 46 | fp ^ 2 + B s * f * fp + C s * f ^ 2) |
| 47 | (f : ℝ → ℝ) (hf : ContDiffOn ℝ ∞ f U) |
| 48 | (V : LVariation F T 0 b (A.path Z b hb hmax)) |
| 49 | (hbase : V.baseSquareCurve = A.squareFamily Z) |
| 50 | (hfield : ∀ s ∈ Set.Icc 0 (Real.sqrt b), (squareVariationField V s : E) = f s • P s) |
| 51 | (D : LVariationDerivativeData V) : |
| 52 | secondVariationIndexForm V D = scalarIndex B C (Real.sqrt b) f := by |
| 53 | let K := sqrtParameterInterval 0 b |
| 54 | have hKU' : K ⊆ U := by simpa only [K, sqrtParameterInterval, Real.sqrt_zero] using hKU |
| 55 | have hKd : UniqueDiffOn ℝ K := uniqueDiffOn_Icc (Real.sqrt_lt_sqrt (le_refl 0) hb) |
| 56 | let Y : ∀ s, TangentSpace (𝓡 n) (A.squareFamily Z s) := fun s ↦ f s • P s |
| 57 | have hY := field_smul_smooth (A.squareFamily Z) P f U hU hα hf hP.smooth |
| 58 | obtain ⟨HP⟩ := nonempty_parametricFieldExtensionOn_compact (A.squareFamily Z) P U K |
| 59 | hU hKU' isCompact_Icc hα hP.smooth |
| 60 | obtain ⟨HY⟩ := nonempty_parametricFieldExtensionOn_compact (A.squareFamily Z) Y U K |
| 61 | hU hKU' isCompact_Icc hα hY |
| 62 | have hfieldK : ∀ s ∈ K, (squareVariationField V s : E) = Y s := by |
| 63 | simpa only [K, sqrtParameterInterval, Real.sqrt_zero, Y] using hfield |
| 64 | change (∫ s in Real.sqrt 0..Real.sqrt b, secondVariationIndexDensity V D s) = _ |
| 65 | rw [Real.sqrt_zero] |
| 66 | unfold scalarIndex |
| 67 | apply intervalIntegral.integral_congr |
| 68 | intro s hs |
| 69 | have hs' : s ∈ Set.Icc 0 (Real.sqrt b) := by |
| 70 | simpa only [Set.uIcc_of_le (Real.sqrt_nonneg b)] using hs |
| 71 | have hsK : s ∈ K := by simpa only [K, sqrtParameterInterval, Real.sqrt_zero] using hs' |
| 72 | rw [realized_variation_indexDensity A Z b hb hmax Y HY V hbase hfieldK D s hsK, |
| 73 | IsAdaptedFieldOn.scaled_pullback F hM04 T τmax hτmax hwindow (A.squareFamily Z) |
| 74 | P f K U hU hα hf hP HP HY s hsK (hKU hs') (hKd s hsK) (htime (hKU hs'))] |
| 75 | exact hcoeff s hs' (f s) (deriv f s) |
| 76 | |
| 77 | set_option maxHeartbeats 1200000 in |
| 78 | -- The comparison uses the exact derivative witness returned by second variation. |
| 79 | set_option backward.isDefEq.respectTransparency false in |
| 80 | theorem unit_adapted_scalar_index_comparison [ConnectedSpace M] |
| 81 | (hM04 : RicciFlowCurvatureTheory.{u}) (hL : LGeodesicTheory F T τmax) |
| 82 | (hτmax : 0 < τmax) (hwindow : Set.Icc (T - τmax) T ⊆ J) |
| 83 | (A : LExponentialFamily F T τmax p) (Z : TangentSpace (𝓡 n) p) |
| 84 | (b : ℝ) (hb : 0 < b) (hmax : b < τmax) |
| 85 | (hmin : IsMinimizingBackwardLPath F T 0 b (A.path Z b hb hmax)) |
| 86 | (ψ : M → ℝ) (O : Set M) (hO : IsOpen O) (hqO : A.gamma Z b ∈ O) |
| 87 | (hψ : ContMDiffOn (𝓡 n) (𝓘(ℝ, ℝ)) ∞ ψ O) |
| 88 | (hvalue : ψ (A.gamma Z b) = A.action Z b / (2 * Real.sqrt b)) |
| 89 | (hlower : ∀ᶠ q in 𝓝 (A.gamma Z b), ψ q ≤ reducedLength F T p q b) |
| 90 | (P : ∀ s, TangentSpace (𝓡 n) (A.squareFamily Z s)) |
| 91 | (U : Set ℝ) (hU : IsOpen U) (hKU : Set.Icc 0 (Real.sqrt b) ⊆ U) |
| 92 | (htime : U ⊆ Set.Ioo (-Real.sqrt τmax) (Real.sqrt τmax)) |
| 93 | (hα : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ (A.squareFamily Z) U) |
| 94 | (hP : IsAdaptedFieldOn F T (A.squareFamily Z) P U) (B C : ℝ → ℝ) |
| 95 | (hcoeff : ∀ s ∈ Set.Icc 0 (Real.sqrt b), ∀ f fp : ℝ, |
| 96 | pointwiseSecondVariationDensity F T (A.squareFamily Z s) s |
| 97 | (curveVelocity (A.squareFamily Z) s) (f • P s) |
| 98 | (fp • P s - (2 * s * f) • |
| 99 | ricciOperator hM04 (F.connection (T - s ^ 2)) (A.squareFamily Z s) (P s)) = |
| 100 | fp ^ 2 + B s * f * fp + C s * f ^ 2) : |
| 101 | ∀ f : ℝ → ℝ, ContDiffOn ℝ ∞ f U → f 0 = 0 → |
| 102 | (2 * Real.sqrt b * (F.connection (T - b)).hessian ψ (A.gamma Z b) |
| 103 | (P (Real.sqrt b)) (P (Real.sqrt b))) * f (Real.sqrt b) ^ 2 ≤ |
| 104 | scalarIndex B C (Real.sqrt b) f := by |
| 105 | intro f hf hf0 |
| 106 | let c := Real.sqrt b |
| 107 | have hc : 0 < c := Real.sqrt_pos.mpr hb |
| 108 | have hcK : c ∈ Set.Icc 0 c := ⟨hc.le, le_rfl⟩ |
| 109 | have hc2 : c ^ 2 = b := Real.sq_sqrt hb.le |
| 110 | have hY := field_smul_smooth (A.squareFamily Z) P f U hU hα hf hP.smooth |
| 111 | obtain ⟨V, hbase, hfield⟩ := exists_initialFixedLVariation_of_smooth_field hM04 |
| 112 | hτmax hwindow A Z b hb hmax (fun s ↦ f s • P s) U hU hKU hα hY (by simp [hf0]) |
| 113 | obtain ⟨D, hcompare⟩ := lExponentialFamily_hessian_le_variation_index hM04 hL hτmax hwindow |
| 114 | A Z b hb hmax hmin ψ O hO hqO hψ hvalue hlower V hbase |
| 115 | rw [unit_adapted_scalar_index_eq hM04 hτmax hwindow A Z b hb hmax P U hU hKU htime |
| 116 | hα hP B C hcoeff f hf V.toLVariation hbase hfield D, hfield c hcK] at hcompare |
| 117 | obtain ⟨H, hH⟩ := squareTime_hessian_exists_bilinear_local F T τmax hτmax hwindow |
| 118 | (A.gamma Z b) c (htime (hKU hcK)) ψ O hO hqO hψ |
| 119 | rw [hc2] at hH |
| 120 | have hscale : (F.connection (T - b)).hessian ψ (A.gamma Z b) (f c • P c) (f c • P c) = |
| 121 | f c ^ 2 * (F.connection (T - b)).hessian ψ (A.gamma Z b) (P c) (P c) := by |
| 122 | rw [hH, hH] |
| 123 | simp only [map_smul, smul_apply, smul_eq_mul] |
| 124 | ring |
| 125 | rw [hscale] at hcompare |
| 126 | have h := (le_div_iff₀ (by positivity : 0 < 2 * c)).mp hcompare |
| 127 | nlinarith |
| 128 | |
| 129 | end PoincareMT.ReducedLength |