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.Generalized.ReducedGeometry.PathCalculus |
| 2 | |
| 3 | /-! Adapted from Mapher `PoincareMT/Definitions/M14PathCalculus.lean` at |
| 4 | `0c5d5c4e1ecbc12703b1994e226df1b15d2e8d39`. See the source mapping in |
| 5 | `references/ricci-flow/mapher/noncollapse/import.json`. -/ |
| 6 | |
| 7 | set_option autoImplicit false |
| 8 | |
| 9 | open scoped Manifold ContDiff Bundle intervalIntegral |
| 10 | |
| 11 | universe u |
| 12 | |
| 13 | namespace PoincareMT |
| 14 | |
| 15 | variable {n : ℕ} {X : Type u} [TopologicalSpace X] {time : X → ℝ} |
| 16 | {I : SpacetimeInterval} |
| 17 | variable {G : GeneralizedLGeometryTransport n X time I} |
| 18 | |
| 19 | /-- A variation of an actual backward path with a square-root representative. -/ |
| 20 | structure M14LVariationData |
| 21 | (G : GeneralizedLGeometryTransport n X time I) |
| 22 | {T τ₁ τ₂ : ℝ} {x y : G.Point} |
| 23 | (p : M14BackwardPath G T τ₁ τ₂ x y) |
| 24 | (R : M14SquareRootPath G p) where |
| 25 | family : ℝ → ℝ → G.Point |
| 26 | family_velocity : ∀ u τ, G.Horizontal (family τ u) |
| 27 | family_at_zero : ∀ τ, family τ 0 = p.curve τ |
| 28 | radius : ℝ |
| 29 | radius_pos : 0 < radius |
| 30 | parameterDomain : Set ℝ := Set.Ioo (-radius) radius |
| 31 | parameterDomain_eq : parameterDomain = Set.Ioo (-radius) radius |
| 32 | parameterDomain_nonempty : parameterDomain.Nonempty |
| 33 | family_time : ∀ u ∈ parameterDomain, ∀ τ ∈ Set.Icc τ₁ τ₂, |
| 34 | G.spacetime.timeFunction (family τ u) = T - τ |
| 35 | family_derivative : ∀ u ∈ parameterDomain, ∀ τ ∈ Set.Ioo τ₁ τ₂, |
| 36 | mfderiv (𝓘(ℝ, ℝ)) (spacetimeModel n) (fun r => family r u) τ (1 : ℝ) = |
| 37 | -G.spacetime.timeVector (family τ u) + (family_velocity u τ).val |
| 38 | squareFamily : ℝ → ℝ → G.Point |
| 39 | squareDomain : Set (ℝ × ℝ) |
| 40 | square_contains : M14SqrtParameterInterval τ₁ τ₂ ×ˢ parameterDomain ⊆ squareDomain |
| 41 | square_smooth : ContMDiffOn ((𝓘(ℝ, ℝ)).prod (𝓘(ℝ, ℝ))) |
| 42 | (spacetimeModel n) ∞ (fun z => squareFamily z.1 z.2) squareDomain |
| 43 | square_agrees : ∀ s ∈ M14SqrtParameterInterval τ₁ τ₂, |
| 44 | ∀ u ∈ parameterDomain, squareFamily s u = family (s ^ 2) u |
| 45 | square_base : ∀ s, squareFamily s 0 = R.curve s |
| 46 | square_horizontal_velocity : ∀ s u, G.Horizontal (squareFamily s u) |
| 47 | square_horizontal_agrees : ∀ s (hs : s ∈ M14SqrtParameterInterval τ₁ τ₂) |
| 48 | u (hu : u ∈ parameterDomain), |
| 49 | square_horizontal_velocity s u = |
| 50 | (square_agrees s hs u hu).symm ▸ ((2 * s) • family_velocity u (s ^ 2)) |
| 51 | /-- Endpoint conditions are recorded as propositions tied to this family. -/ |
| 52 | left_endpoint_fixed : Prop |
| 53 | left_endpoint_fixed_spec : left_endpoint_fixed ↔ |
| 54 | (∀ u ∈ parameterDomain, family τ₁ u = p.curve τ₁) |
| 55 | right_endpoint_fixed : Prop |
| 56 | right_endpoint_fixed_spec : right_endpoint_fixed ↔ |
| 57 | (∀ u ∈ parameterDomain, family τ₂ u = p.curve τ₂) |
| 58 | action_integrable : ∀ u ∈ parameterDomain, |
| 59 | IntervalIntegrable |
| 60 | (M14RawLIntegrand G (fun τ => family τ u) (family_velocity u)) |
| 61 | MeasureTheory.volume τ₁ τ₂ |
| 62 | |
| 63 | noncomputable def M14VariationAction |
| 64 | {T τ₁ τ₂ : ℝ} {x y : G.Point} |
| 65 | {p : M14BackwardPath G T τ₁ τ₂ x y} |
| 66 | {R : M14SquareRootPath G p} |
| 67 | (V : M14LVariationData G (p := p) (R := R)) (u : ℝ) : ℝ := |
| 68 | ∫ τ in τ₁..τ₂, |
| 69 | M14RawLIntegrand G (fun r => V.family r u) (V.family_velocity u) τ |
| 70 | |
| 71 | /-- The horizontal parameter field of a variation, on the base square curve. -/ |
| 72 | noncomputable def M14VariationField |
| 73 | {T τ₁ τ₂ : ℝ} {x y : G.Point} |
| 74 | {p : M14BackwardPath G T τ₁ τ₂ x y} |
| 75 | {R : M14SquareRootPath G p} |
| 76 | (V : M14LVariationData G (p := p) (R := R)) (s : ℝ) : |
| 77 | G.Horizontal (R.curve s) := |
| 78 | (V.square_base s).symm ▸ |
| 79 | G.spacetime.horizontalProjection (V.squareFamily s 0) |
| 80 | (mfderiv (𝓘(ℝ, ℝ)) (spacetimeModel n) |
| 81 | (fun u => V.squareFamily s u) 0 (1 : ℝ)) |
| 82 | |
| 83 | /-- The endpoint variation field before applying the endpoint connection. -/ |
| 84 | noncomputable def M14EndpointVariationField |
| 85 | {T τ₁ τ₂ : ℝ} {x y : G.Point} |
| 86 | {p : M14BackwardPath G T τ₁ τ₂ x y} |
| 87 | {R : M14SquareRootPath G p} |
| 88 | (V : M14LVariationData G (p := p) (R := R)) (s u : ℝ) : |
| 89 | G.Horizontal (V.squareFamily s u) := |
| 90 | G.spacetime.horizontalProjection (V.squareFamily s u) |
| 91 | (mfderiv (𝓘(ℝ, ℝ)) (spacetimeModel n) |
| 92 | (fun r => V.squareFamily s r) u (1 : ℝ)) |
| 93 | |
| 94 | /-- The local extensions needed for first and second variation formulas. -/ |
| 95 | structure M14VariationDerivativeData |
| 96 | {T τ₁ τ₂ : ℝ} {x y : G.Point} |
| 97 | {p : M14BackwardPath G T τ₁ τ₂ x y} |
| 98 | {R : M14SquareRootPath G p} |
| 99 | (V : M14LVariationData G (p := p) (R := R)) where |
| 100 | base_extension : M14PullbackExtension G R.curve |
| 101 | (M14SqrtParameterInterval τ₁ τ₂) R.horizontal_velocity |
| 102 | variation_extension : M14PullbackExtension G R.curve |
| 103 | (M14SqrtParameterInterval τ₁ τ₂) (M14VariationField V) |
| 104 | endpoint_extension : ∀ s ∈ M14SqrtParameterInterval τ₁ τ₂, |
| 105 | M14PullbackExtension G (fun u => V.squareFamily s u) V.parameterDomain |
| 106 | (M14EndpointVariationField V s) |
| 107 | |
| 108 | /-- Covariant acceleration of the endpoint variation at a square-root time. -/ |
| 109 | noncomputable def M14VariationEndpointAcceleration |
| 110 | {T τ₁ τ₂ : ℝ} {x y : G.Point} |
| 111 | {p : M14BackwardPath G T τ₁ τ₂ x y} |
| 112 | {R : M14SquareRootPath G p} |
| 113 | (V : M14LVariationData G (p := p) (R := R)) |
| 114 | (D : M14VariationDerivativeData V) (s : ℝ) |
| 115 | (hs : s ∈ M14SqrtParameterInterval τ₁ τ₂) : |
| 116 | G.Horizontal (R.curve s) := |
| 117 | (V.square_base s).symm ▸ |
| 118 | M14HorizontalCovariantDerivative G (fun u => V.squareFamily s u) |
| 119 | V.parameterDomain (M14EndpointVariationField V s) (D.endpoint_extension s hs) 0 |
| 120 | |
| 121 | /-- The first variation boundary contribution. -/ |
| 122 | noncomputable def M14FirstVariationBoundaryTerm |
| 123 | {T τ₁ τ₂ : ℝ} {x y : G.Point} |
| 124 | {p : M14BackwardPath G T τ₁ τ₂ x y} |
| 125 | {R : M14SquareRootPath G p} |
| 126 | (V : M14LVariationData G (p := p) (R := R)) : ℝ := |
| 127 | G.spacetime.horizontalMetric.inner (R.curve (Real.sqrt τ₂)) |
| 128 | (M14SquareRootVelocity R (Real.sqrt τ₂)) (M14VariationField V (Real.sqrt τ₂)) - |
| 129 | G.spacetime.horizontalMetric.inner (R.curve (Real.sqrt τ₁)) |
| 130 | (M14SquareRootVelocity R (Real.sqrt τ₁)) (M14VariationField V (Real.sqrt τ₁)) |
| 131 | |
| 132 | /-- The integrated paired Euler residual in the first variation. -/ |
| 133 | noncomputable def M14FirstVariationResidualIntegral |
| 134 | {T τ₁ τ₂ : ℝ} {x y : G.Point} |
| 135 | {p : M14BackwardPath G T τ₁ τ₂ x y} |
| 136 | {R : M14SquareRootPath G p} |
| 137 | (V : M14LVariationData G (p := p) (R := R)) |
| 138 | (D : M14VariationDerivativeData V) : ℝ := |
| 139 | ∫ s in Real.sqrt τ₁..Real.sqrt τ₂, |
| 140 | -M14SquareRootEulerResidual G R D.base_extension s (M14VariationField V s) |
| 141 | |
| 142 | /-- The acceleration boundary contribution retained in the general second variation. -/ |
| 143 | noncomputable def M14SecondVariationBoundaryTerm |
| 144 | {T τ₁ τ₂ : ℝ} {x y : G.Point} |
| 145 | {p : M14BackwardPath G T τ₁ τ₂ x y} |
| 146 | {R : M14SquareRootPath G p} |
| 147 | (V : M14LVariationData G (p := p) (R := R)) |
| 148 | (D : M14VariationDerivativeData V) : ℝ := |
| 149 | let h₂ : Real.sqrt τ₂ ∈ M14SqrtParameterInterval τ₁ τ₂ := |
| 150 | ⟨Real.sqrt_le_sqrt (le_of_lt p.tau_lt), le_rfl⟩ |
| 151 | let h₁ : Real.sqrt τ₁ ∈ M14SqrtParameterInterval τ₁ τ₂ := |
| 152 | ⟨le_rfl, Real.sqrt_le_sqrt (le_of_lt p.tau_lt)⟩ |
| 153 | G.spacetime.horizontalMetric.inner (R.curve (Real.sqrt τ₂)) |
| 154 | (M14SquareRootVelocity R (Real.sqrt τ₂)) |
| 155 | (M14VariationEndpointAcceleration V D (Real.sqrt τ₂) h₂) - |
| 156 | G.spacetime.horizontalMetric.inner (R.curve (Real.sqrt τ₁)) |
| 157 | (M14SquareRootVelocity R (Real.sqrt τ₁)) |
| 158 | (M14VariationEndpointAcceleration V D (Real.sqrt τ₁) h₁) |
| 159 | |
| 160 | /-- The expanded second-variation index density on actual horizontal fibers. -/ |
| 161 | noncomputable def M14SecondVariationIndexDensity |
| 162 | {T τ₁ τ₂ : ℝ} {x y : G.Point} |
| 163 | {p : M14BackwardPath G T τ₁ τ₂ x y} |
| 164 | {R : M14SquareRootPath G p} |
| 165 | (V : M14LVariationData G (p := p) (R := R)) |
| 166 | (D : M14VariationDerivativeData V) (s : ℝ) : ℝ := |
| 167 | let q := R.curve s |
| 168 | let A := M14SquareRootVelocity R s |
| 169 | let Y := M14VariationField V s |
| 170 | let DY := M14HorizontalCovariantDerivative G R.curve |
| 171 | (M14SqrtParameterInterval τ₁ τ₂) (M14VariationField V) |
| 172 | D.variation_extension s |
| 173 | G.spacetime.horizontalMetric.inner q DY DY + |
| 174 | horizontalRiemann G.leafwise q Y A A Y + |
| 175 | 2 * s ^ 2 * M14HorizontalHessianPairing G q Y Y - |
| 176 | 4 * s * M14HorizontalRicciDerivativePairing G q Y A Y + |
| 177 | 2 * s * M14HorizontalRicciDerivativePairing G q A Y Y |
| 178 | |
| 179 | /-- The actual index form, with the signed interval integral. -/ |
| 180 | noncomputable def M14SecondVariationIndexForm |
| 181 | {T τ₁ τ₂ : ℝ} {x y : G.Point} |
| 182 | {p : M14BackwardPath G T τ₁ τ₂ x y} |
| 183 | {R : M14SquareRootPath G p} |
| 184 | (V : M14LVariationData G (p := p) (R := R)) |
| 185 | (D : M14VariationDerivativeData V) : ℝ := |
| 186 | ∫ s in Real.sqrt τ₁..Real.sqrt τ₂, M14SecondVariationIndexDensity V D s |
| 187 | |
| 188 | /-! A fixed-endpoint Jacobi witness must use the variation field and the |
| 189 | same first pullback extension as the selected variation derivative data. The |
| 190 | extension types depend on those fields, so their agreement is heterogeneous. |
| 191 | -/ |
| 192 | def M14VariationJacobiCondition |
| 193 | {T τ₁ τ₂ : ℝ} {x y : G.Point} |
| 194 | {p : M14BackwardPath G T τ₁ τ₂ x y} |
| 195 | {R : M14SquareRootPath G p} |
| 196 | (V : M14LVariationData G (p := p) (R := R)) |
| 197 | (D : M14VariationDerivativeData V) : Prop := |
| 198 | ∃ Q : M14JacobiFieldData G R.curve |
| 199 | (M14SqrtParameterInterval τ₁ τ₂), |
| 200 | Q.field = M14VariationField V ∧ |
| 201 | HEq Q.extension D.variation_extension ∧ |
| 202 | Q.field (Real.sqrt τ₁) = 0 ∧ |
| 203 | Q.field (Real.sqrt τ₂) = 0 ∧ |
| 204 | (∀ s ∈ M14SqrtParameterInterval τ₁ τ₂, |
| 205 | ∀ W : G.Horizontal (R.curve s), M14JacobiResidual G R Q s W = 0) |
| 206 | |
| 207 | /-- The general first-variation identity as a proposition on the actual action. -/ |
| 208 | def M14FirstVariationIdentity |
| 209 | {T τ₁ τ₂ : ℝ} {x y : G.Point} |
| 210 | {p : M14BackwardPath G T τ₁ τ₂ x y} |
| 211 | {R : M14SquareRootPath G p} |
| 212 | (V : M14LVariationData G (p := p) (R := R)) |
| 213 | (D : M14VariationDerivativeData V) : Prop := |
| 214 | HasDerivAt (M14VariationAction V) |
| 215 | (M14FirstVariationBoundaryTerm V + M14FirstVariationResidualIntegral V D) 0 |
| 216 | |
| 217 | /-- The general second-variation identity, including both endpoint accelerations. -/ |
| 218 | def M14SecondVariationIdentity |
| 219 | {T τ₁ τ₂ : ℝ} {x y : G.Point} |
| 220 | {p : M14BackwardPath G T τ₁ τ₂ x y} |
| 221 | {R : M14SquareRootPath G p} |
| 222 | (V : M14LVariationData G (p := p) (R := R)) |
| 223 | (D : M14VariationDerivativeData V) : Prop := |
| 224 | (∃ d₁ : ℝ, |
| 225 | HasDerivAt (M14VariationAction V) d₁ 0 ∧ |
| 226 | d₁ = M14FirstVariationBoundaryTerm V + M14FirstVariationResidualIntegral V D) ∧ |
| 227 | (∃ d₂ : ℝ, |
| 228 | HasDerivAt (fun u => deriv (fun v => M14VariationAction V v) u) d₂ 0 ∧ |
| 229 | d₂ = M14SecondVariationBoundaryTerm V D + M14SecondVariationIndexForm V D) |
| 230 | |
| 231 | end PoincareMT |