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.Minimum.Variation.Geometry.Tangent |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Minimum.Variation.Geometry.ParameterIntegral |
| 3 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Minimum.Variational.Action |
| 4 | |
| 5 | /-! |
| 6 | # Action and boundary terms of smooth variations |
| 7 | |
| 8 | Adapted from Mapher `Proofs/M08/VariationAction.lean`, commit |
| 9 | `49331b7d7ecad38f53e4300c3b35d6a84b2cc648`. The hypothesis concerns |
| 10 | smoothness of the literal square-time potential, proved for ancient surfaces. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | set_option backward.isDefEq.respectTransparency false |
| 15 | |
| 16 | noncomputable section |
| 17 | |
| 18 | open Set Filter Topology MeasureTheory |
| 19 | open scoped Manifold ContDiff Bundle intervalIntegral |
| 20 | |
| 21 | universe u v |
| 22 | |
| 23 | namespace PoincareMT.ReducedLengthMinimum.Variation.Geometry |
| 24 | |
| 25 | open ReducedLengthMinimum.Variational |
| 26 | |
| 27 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 28 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 29 | |
| 30 | local instance variationActionDualGroup : NormedAddCommGroup (EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ) := |
| 31 | ContinuousLinearMap.toNormedAddCommGroup |
| 32 | local instance variationActionDualSpace : NormedSpace ℝ (EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ) := |
| 33 | ContinuousLinearMap.toNormedSpace |
| 34 | local instance variationActionBilinGroup : |
| 35 | NormedAddCommGroup (EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ) := |
| 36 | ContinuousLinearMap.toNormedAddCommGroup |
| 37 | local instance variationActionBilinSpace : |
| 38 | NormedSpace ℝ (EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ) := |
| 39 | ContinuousLinearMap.toNormedSpace |
| 40 | |
| 41 | set_option maxHeartbeats 800000 in |
| 42 | theorem movingMetric_pair_contMDiffOn {X : Type v} |
| 43 | [NormedAddCommGroup X] [NormedSpace ℝ X] {S : Set X} {J : Set ℝ} |
| 44 | (F : RicciFlow n M J) (time : X → ℝ) (α : X → M) |
| 45 | (V W : ∀ z, TangentSpace (𝓡 n) (α z)) |
| 46 | (htime : ContMDiffOn (𝓘(ℝ, X)) (𝓘(ℝ, ℝ)) ∞ time S) |
| 47 | (hα : ContMDiffOn (𝓘(ℝ, X)) (𝓡 n) ∞ α S) |
| 48 | (hV : ContMDiffOn (𝓘(ℝ, X)) ((𝓡 n).prod (𝓡 n)) ∞ |
| 49 | (fun z ↦ Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) (α z) (V z)) S) |
| 50 | (hW : ContMDiffOn (𝓘(ℝ, X)) ((𝓡 n).prod (𝓡 n)) ∞ |
| 51 | (fun z ↦ Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) (α z) (W z)) S) |
| 52 | (hmem : MapsTo time S J) : |
| 53 | ContMDiffOn (𝓘(ℝ, X)) (𝓘(ℝ, ℝ)) ∞ |
| 54 | (fun z ↦ (F.metric (time z)).inner (α z) (V z) (W z)) S := by |
| 55 | have hmetric := F.smooth.comp (htime.prodMk hα) (fun z hz ↦ ⟨hmem hz, mem_univ _⟩) |
| 56 | have hp := hmetric.clm_bundle_apply₂ (F₃ := ℝ) (E₃ := Bundle.Trivial M ℝ) hV hW |
| 57 | intro z hz |
| 58 | simpa only [Bundle.Trivial.fiberBundle_trivializationAt', Bundle.Trivial.trivialization_apply] |
| 59 | using (Bundle.contMDiffWithinAt_totalSpace.mp (hp z hz)).2 |
| 60 | |
| 61 | def variationActionDensity {J : Set ℝ} {F : RicciFlow n M J} |
| 62 | {T τ₁ τ₂ : ℝ} {p : BackwardTimePath F T τ₁ τ₂} |
| 63 | (V : LVariation F T τ₁ τ₂ p) (z : ℝ × ℝ) : ℝ := |
| 64 | regularizedLIntegrand F T (fun s ↦ V.squareFamily s z.2) z.1 |
| 65 | |
| 66 | /-- The square-time action of a smooth variation, before normalization. -/ |
| 67 | def variationSquareAction {J : Set ℝ} {F : RicciFlow n M J} |
| 68 | {T τ₁ τ₂ : ℝ} {p : BackwardTimePath F T τ₁ τ₂} |
| 69 | (V : LVariation F T τ₁ τ₂ p) (u : ℝ) : ℝ := |
| 70 | ∫ s in Real.sqrt τ₁..Real.sqrt τ₂, variationActionDensity V (s, u) |
| 71 | |
| 72 | theorem variationSquareAction_eq_regularizedLAction {J : Set ℝ} {F : RicciFlow n M J} |
| 73 | {T τ : ℝ} {p : BackwardTimePath F T 0 τ} |
| 74 | (V : LVariation F T 0 τ p) (u : ℝ) : |
| 75 | variationSquareAction V u = |
| 76 | regularizedLAction F T τ (fun s => V.squareFamily s u) := by |
| 77 | simp only [variationSquareAction, Real.sqrt_zero, regularizedLAction, variationActionDensity] |
| 78 | |
| 79 | set_option maxHeartbeats 1000000 in |
| 80 | theorem variationActionDensity_contDiffOn {J : Set ℝ} {F : RicciFlow n M J} |
| 81 | {T τ₁ τ₂ : ℝ} (hpotential : ContMDiff (𝓘(ℝ, ℝ).prod (𝓡 n)) 𝓘(ℝ, ℝ) ∞ |
| 82 | (fun z : ℝ × M => 2 * z.1 ^ 2 * |
| 83 | (F.connection (T - z.1 ^ 2)).scalarCurvature z.2)) |
| 84 | {p : BackwardTimePath F T τ₁ τ₂} (V : LVariation F T τ₁ τ₂ p) : |
| 85 | ContDiffOn ℝ ∞ (variationActionDensity V) |
| 86 | (sqrtParameterInterval τ₁ τ₂ ×ˢ V.parameterDomain) := by |
| 87 | let S := sqrtParameterInterval τ₁ τ₂ ×ˢ V.parameterDomain |
| 88 | let H := fun z : ℝ × ℝ ↦ V.squareFamily z.1 z.2 |
| 89 | have hH : ContMDiffOn (𝓘(ℝ, ℝ × ℝ)) (𝓡 n) ∞ H S := by |
| 90 | rw [modelWithCornersSelf_prod, ← chartedSpaceSelf_prod] |
| 91 | exact V.square_smooth.mono V.square_contains |
| 92 | have hA : ContMDiffOn (𝓘(ℝ, ℝ × ℝ)) ((𝓡 n).prod (𝓡 n)) ∞ |
| 93 | (fun z : ℝ × ℝ ↦ Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) (H z) |
| 94 | (curveVelocity (n := n) (fun r ↦ H (r, z.2)) z.1)) S := by |
| 95 | rw [modelWithCornersSelf_prod, ← chartedSpaceSelf_prod] |
| 96 | exact (contMDiffOn_curveVelocity_fst V.square_open H V.square_smooth).mono V.square_contains |
| 97 | have ht : ContMDiffOn (𝓘(ℝ, ℝ × ℝ)) (𝓘(ℝ, ℝ)) ∞ |
| 98 | (fun z : ℝ × ℝ ↦ T - z.1 ^ 2) S := |
| 99 | (contDiff_const.sub (contDiff_fst.pow 2)).contMDiff.contMDiffOn |
| 100 | have hmem : MapsTo (fun z : ℝ × ℝ ↦ T - z.1 ^ 2) S J := by |
| 101 | intro z hz |
| 102 | apply p.time_mem |
| 103 | have hz0 : 0 ≤ z.1 := (Real.sqrt_nonneg τ₁).trans hz.1.1 |
| 104 | constructor |
| 105 | · nlinarith [Real.sq_sqrt p.nonnegative, Real.sqrt_nonneg τ₁, hz.1.1] |
| 106 | · nlinarith [Real.sq_sqrt (p.nonnegative.trans p.ordered.le), Real.sqrt_nonneg τ₂, hz.1.2] |
| 107 | have hg := (movingMetric_pair_contMDiffOn F (fun z : ℝ × ℝ ↦ T - z.1 ^ 2) H |
| 108 | (fun z ↦ curveVelocity (n := n) (fun r ↦ H (r, z.2)) z.1) |
| 109 | (fun z ↦ curveVelocity (n := n) (fun r ↦ H (r, z.2)) z.1) ht hH hA hA hmem).contDiffOn |
| 110 | have hV := (hpotential.comp_contMDiffOn |
| 111 | (contDiff_fst.contMDiff.contMDiffOn.prodMk hH)).contDiffOn |
| 112 | exact hV.add (contDiffOn_const.mul hg) |
| 113 | |
| 114 | theorem hasDerivAt_variationSquareAction_integral {J : Set ℝ} {F : RicciFlow n M J} |
| 115 | {T τ₁ τ₂ : ℝ} (hpotential : ContMDiff (𝓘(ℝ, ℝ).prod (𝓡 n)) 𝓘(ℝ, ℝ) ∞ |
| 116 | (fun z : ℝ × M => 2 * z.1 ^ 2 * |
| 117 | (F.connection (T - z.1 ^ 2)).scalarCurvature z.2)) |
| 118 | {p : BackwardTimePath F T τ₁ τ₂} (V : LVariation F T τ₁ τ₂ p) |
| 119 | {u : ℝ} (hu : u ∈ V.parameterDomain) : |
| 120 | HasDerivAt (variationSquareAction V) |
| 121 | (∫ s in Real.sqrt τ₁..Real.sqrt τ₂, |
| 122 | variationParameterDeriv (sqrtParameterInterval τ₁ τ₂) V.parameterDomain |
| 123 | (variationActionDensity V) (s, u)) u := by |
| 124 | have h := hasDerivAt_variationIntegral (Real.sqrt_lt_sqrt p.nonnegative p.ordered) |
| 125 | isOpen_Ioo (variationActionDensity V) (variationActionDensity_contDiffOn hpotential V) hu |
| 126 | exact h |
| 127 | |
| 128 | theorem hasDerivAt_deriv_variationSquareAction_integral {J : Set ℝ} {F : RicciFlow n M J} |
| 129 | {T τ₁ τ₂ : ℝ} (hpotential : ContMDiff (𝓘(ℝ, ℝ).prod (𝓡 n)) 𝓘(ℝ, ℝ) ∞ |
| 130 | (fun z : ℝ × M => 2 * z.1 ^ 2 * |
| 131 | (F.connection (T - z.1 ^ 2)).scalarCurvature z.2)) |
| 132 | {p : BackwardTimePath F T τ₁ τ₂} (V : LVariation F T τ₁ τ₂ p) |
| 133 | {u : ℝ} (hu : u ∈ V.parameterDomain) : |
| 134 | HasDerivAt (fun v ↦ deriv (variationSquareAction V) v) |
| 135 | (∫ s in Real.sqrt τ₁..Real.sqrt τ₂, |
| 136 | variationParameterDeriv (sqrtParameterInterval τ₁ τ₂) V.parameterDomain |
| 137 | (variationParameterDeriv (sqrtParameterInterval τ₁ τ₂) V.parameterDomain |
| 138 | (variationActionDensity V)) (s, u)) u := by |
| 139 | have hC : UniqueDiffOn ℝ (sqrtParameterInterval τ₁ τ₂) := |
| 140 | uniqueDiffOn_Icc (Real.sqrt_lt_sqrt p.nonnegative p.ordered) |
| 141 | have hd := hasDerivAt_variationIntegral (Real.sqrt_lt_sqrt p.nonnegative p.ordered) |
| 142 | isOpen_Ioo (variationParameterDeriv (sqrtParameterInterval τ₁ τ₂) V.parameterDomain |
| 143 | (variationActionDensity V)) |
| 144 | (variationParameterDeriv_contDiffOn hC isOpen_Ioo _ |
| 145 | (variationActionDensity_contDiffOn hpotential V)) hu |
| 146 | apply hd.congr_of_eventuallyEq |
| 147 | filter_upwards [isOpen_Ioo.mem_nhds hu] with v hv |
| 148 | exact (hasDerivAt_variationSquareAction_integral hpotential V hv).deriv |
| 149 | |
| 150 | def variationBoundaryPair {J : Set ℝ} {F : RicciFlow n M J} |
| 151 | {T τ₁ τ₂ : ℝ} {p : BackwardTimePath F T τ₁ τ₂} |
| 152 | (V : LVariation F T τ₁ τ₂ p) (s : ℝ) : ℝ := |
| 153 | (F.metric (T - s ^ 2)).inner (V.baseSquareCurve s) |
| 154 | (curveVelocityWithin (n := n) V.baseSquareCurve (sqrtParameterInterval τ₁ τ₂) s) |
| 155 | (squareVariationField V s) |
| 156 | |
| 157 | set_option maxHeartbeats 1000000 in |
| 158 | theorem variationBoundaryPair_contDiffOn {J : Set ℝ} {F : RicciFlow n M J} |
| 159 | {T τ₁ τ₂ : ℝ} {p : BackwardTimePath F T τ₁ τ₂} |
| 160 | (V : LVariation F T τ₁ τ₂ p) : |
| 161 | ContDiffOn ℝ ∞ (variationBoundaryPair V) (sqrtParameterInterval τ₁ τ₂) := by |
| 162 | let C := sqrtParameterInterval τ₁ τ₂ |
| 163 | let U := (fun s : ℝ ↦ (s, (0 : ℝ))) ⁻¹' V.squareDomain |
| 164 | have hU : IsOpen U := V.square_open.preimage (continuous_id.prodMk continuous_const) |
| 165 | have hCU : C ⊆ U := fun s hs ↦ |
| 166 | V.square_contains ⟨hs, neg_neg_of_pos V.radius_pos, V.radius_pos⟩ |
| 167 | have hC : UniqueDiffOn ℝ C := uniqueDiffOn_Icc (Real.sqrt_lt_sqrt p.nonnegative p.ordered) |
| 168 | have hα : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ V.baseSquareCurve U := |
| 169 | V.square_smooth.comp (contMDiff_id.prodMk contMDiff_const).contMDiffOn (fun s hs ↦ hs) |
| 170 | have hA : ContMDiffOn (𝓘(ℝ, ℝ)) ((𝓡 n).prod (𝓡 n)) ∞ |
| 171 | (fun s ↦ Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) (V.baseSquareCurve s) |
| 172 | (curveVelocityWithin (n := n) V.baseSquareCurve C s)) C := by |
| 173 | apply ((contMDiffOn_mfderiv_const_apply hU V.baseSquareCurve hα (1 : ℝ)).mono hCU).congr |
| 174 | intro s hs |
| 175 | apply congrArg (fun w : TangentSpace (𝓡 n) (V.baseSquareCurve s) ↦ |
| 176 | Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) (V.baseSquareCurve s) w) |
| 177 | unfold curveVelocityWithin |
| 178 | rw [mfderivWithin_eq_mfderiv (hC.uniqueMDiffOn s hs) |
| 179 | (((hα s (hCU hs)).contMDiffAt (hU.mem_nhds (hCU hs))).mdifferentiableAt (by simp))] |
| 180 | have ht : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓘(ℝ, ℝ)) ∞ (fun s : ℝ ↦ T - s ^ 2) C := |
| 181 | (contDiff_const.sub (contDiff_id.pow 2)).contMDiff.contMDiffOn |
| 182 | have hmem : MapsTo (fun s : ℝ ↦ T - s ^ 2) C J := by |
| 183 | intro s hs |
| 184 | apply p.time_mem |
| 185 | have hs0 : 0 ≤ s := (Real.sqrt_nonneg τ₁).trans hs.1 |
| 186 | constructor |
| 187 | · nlinarith [Real.sq_sqrt p.nonnegative, Real.sqrt_nonneg τ₁, hs.1] |
| 188 | · nlinarith [Real.sq_sqrt (p.nonnegative.trans p.ordered.le), Real.sqrt_nonneg τ₂, hs.2] |
| 189 | exact (movingMetric_pair_contMDiffOn F (fun s : ℝ ↦ T - s ^ 2) V.baseSquareCurve |
| 190 | (curveVelocityWithin (n := n) V.baseSquareCurve C) (squareVariationField V) |
| 191 | ht (hα.mono hCU) hA ((squareVariationField_contMDiffOn V).mono hCU) hmem).contDiffOn |
| 192 | |
| 193 | end PoincareMT.ReducedLengthMinimum.Variation.Geometry |