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.Variation.Action.VariationAction |
| 2 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Paths.SquareRoot.Action.SquareRootAction |
| 3 | |
| 4 | /-! |
| 5 | # Actual clock identities of a generalized variation |
| 6 | |
| 7 | Morgan-Tian Definitions 6.1-6.2, equation (6.2) and Lemma 6.4, |
| 8 | pp. 105-108. Parameter tangents are genuinely horizontal; the closed |
| 9 | square-time tangent has clock -2s. At parameter zero the actual velocity |
| 10 | agrees with the base square-root velocity even at the endpoints. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | -- Scalar tangent fibers in the time chain rule are identified with the reals. |
| 15 | set_option backward.isDefEq.respectTransparency false |
| 16 | |
| 17 | open scoped Manifold ContDiff Bundle Topology |
| 18 | |
| 19 | universe u |
| 20 | |
| 21 | namespace PoincareMT.M14 |
| 22 | |
| 23 | variable {n : ℕ} {X : Type u} [TopologicalSpace X] {time : X → ℝ} |
| 24 | {I : SpacetimeInterval} {G : GeneralizedLGeometryTransport n X time I} |
| 25 | {T τ₁ τ₂ : ℝ} {x y : G.Point} {p : M14BackwardPath G T τ₁ τ₂ x y} |
| 26 | {R : M14SquareRootPath G p} |
| 27 | |
| 28 | private theorem parameterDomain_isOpen (V : M14LVariationData G p R) : |
| 29 | IsOpen V.parameterDomain := V.parameterDomain_eq ▸ isOpen_Ioo |
| 30 | |
| 31 | /-- The actual square family has the prescribed clock on the full |
| 32 | closed-by-open rectangle, equation (6.2), p. 106. -/ |
| 33 | theorem variation_squareFamily_time (V : M14LVariationData G p R) |
| 34 | {s u : ℝ} (hs : s ∈ M14SqrtParameterInterval τ₁ τ₂) |
| 35 | (hu : u ∈ V.parameterDomain) : |
| 36 | G.spacetime.timeFunction (V.squareFamily s u) = T - s ^ 2 := by |
| 37 | rw [V.square_agrees s hs u hu] |
| 38 | apply V.family_time u hu |
| 39 | have hs0 := (Real.sqrt_nonneg τ₁).trans hs.1 |
| 40 | constructor |
| 41 | · nlinarith [Real.sq_sqrt p.tau_nonneg, Real.sqrt_nonneg τ₁, hs.1] |
| 42 | · nlinarith [Real.sq_sqrt (p.tau_nonneg.trans p.tau_lt.le), hs.2, |
| 43 | Real.sqrt_nonneg τ₂] |
| 44 | |
| 45 | /-- Parameter slices of the square family are smooth throughout their |
| 46 | open domain, even at a time endpoint, Lemma 6.4, pp. 107-108. -/ |
| 47 | theorem variation_parameter_smooth (V : M14LVariationData G p R) |
| 48 | {s : ℝ} (hs : s ∈ M14SqrtParameterInterval τ₁ τ₂) : |
| 49 | ContMDiffOn (𝓘(ℝ, ℝ)) (spacetimeModel n) ∞ |
| 50 | (fun u => V.squareFamily s u) V.parameterDomain := |
| 51 | (V.square_smooth.mono V.square_contains).comp |
| 52 | ((contMDiff_const (c := s)).prodMk contMDiff_id).contMDiffOn (fun _ hu => ⟨hs, hu⟩) |
| 53 | |
| 54 | /-- The actual parameter tangent has zero clock component, so the |
| 55 | variation field is horizontal, Lemma 6.4, pp. 107-108. -/ |
| 56 | theorem variation_parameter_clock_eq_zero (V : M14LVariationData G p R) |
| 57 | {s u : ℝ} (hs : s ∈ M14SqrtParameterInterval τ₁ τ₂) |
| 58 | (hu : u ∈ V.parameterDomain) : |
| 59 | (show ℝ from mfderiv (spacetimeModel n) 𝓘(ℝ) G.spacetime.timeFunction |
| 60 | (V.squareFamily s u) |
| 61 | (mfderiv (𝓘(ℝ, ℝ)) (spacetimeModel n) (fun r => V.squareFamily s r) u (1 : ℝ))) = 0 := by |
| 62 | have hγ := ((variation_parameter_smooth V hs u hu).contMDiffAt |
| 63 | ((parameterDomain_isOpen V).mem_nhds hu)).mdifferentiableAt (by simp) |
| 64 | have htime : ContMDiff (spacetimeModel n) 𝓘(ℝ) ∞ G.spacetime.timeFunction := |
| 65 | G.spacetime.time_smooth |
| 66 | have ht := (htime.mdifferentiable (by simp) |
| 67 | (V.squareFamily s u)).hasMFDerivAt.comp u hγ.hasMFDerivAt |
| 68 | have hd := ht.hasFDerivAt.hasDerivAt |
| 69 | have hc : HasDerivAt (fun r => G.spacetime.timeFunction (V.squareFamily s r)) 0 u := by |
| 70 | apply (hasDerivAt_const u (T - s ^ 2)).congr_of_eventuallyEq |
| 71 | filter_upwards [(parameterDomain_isOpen V).mem_nhds hu] with r hr |
| 72 | exact variation_squareFamily_time V hs hr |
| 73 | exact hd.unique hc |
| 74 | |
| 75 | /-- The frozen horizontal endpoint field has exactly the actual |
| 76 | parameter tangent as its underlying vector, Lemma 6.4, pp. 107-108. -/ |
| 77 | theorem endpointVariationField_val_eq_tangent (V : M14LVariationData G p R) |
| 78 | {s u : ℝ} (hs : s ∈ M14SqrtParameterInterval τ₁ τ₂) |
| 79 | (hu : u ∈ V.parameterDomain) : |
| 80 | (M14EndpointVariationField V s u).val = |
| 81 | mfderiv (𝓘(ℝ, ℝ)) (spacetimeModel n) (fun r => V.squareFamily s r) u (1 : ℝ) := by |
| 82 | let v : TangentSpace (spacetimeModel n) (V.squareFamily s u) := |
| 83 | mfderiv (𝓘(ℝ, ℝ)) (spacetimeModel n) (fun r => V.squareFamily s r) u (1 : ℝ) |
| 84 | change (G.spacetime.horizontalProjection (V.squareFamily s u) v).val = v |
| 85 | rw [G.spacetime.horizontalProjection_eq] |
| 86 | change v - (show ℝ from mfderiv (spacetimeModel n) 𝓘(ℝ) G.spacetime.timeFunction |
| 87 | (V.squareFamily s u) v) • G.spacetime.timeVector (V.squareFamily s u) = v |
| 88 | rw [show (show ℝ from mfderiv (spacetimeModel n) 𝓘(ℝ) G.spacetime.timeFunction |
| 89 | (V.squareFamily s u) v) = 0 from variation_parameter_clock_eq_zero V hs hu, |
| 90 | zero_smul, sub_zero] |
| 91 | |
| 92 | /-- The actual square-time tangent has clock -2s at every closed |
| 93 | interval point, the within form of equation (6.2), p. 106. -/ |
| 94 | theorem variation_square_tangent_clock (V : M14LVariationData G p R) |
| 95 | {s u : ℝ} (hs : s ∈ M14SqrtParameterInterval τ₁ τ₂) |
| 96 | (hu : u ∈ V.parameterDomain) : |
| 97 | (show ℝ from mfderiv (spacetimeModel n) 𝓘(ℝ) G.spacetime.timeFunction |
| 98 | (V.squareFamily s u) |
| 99 | (mfderivWithin (𝓘(ℝ, ℝ)) (spacetimeModel n) (fun r => V.squareFamily r u) |
| 100 | (M14SqrtParameterInterval τ₁ τ₂) s (1 : ℝ))) = -(2 * s) := by |
| 101 | have hγ := (V.square_smooth.mono V.square_contains).comp |
| 102 | (contMDiff_id.prodMk (contMDiff_const (c := u))).contMDiffOn (fun _ hr => ⟨hr, hu⟩) |
| 103 | have htime : ContMDiff (spacetimeModel n) 𝓘(ℝ) ∞ G.spacetime.timeFunction := |
| 104 | G.spacetime.time_smooth |
| 105 | have ht := (htime.mdifferentiable (by simp) |
| 106 | (V.squareFamily s u)).hasMFDerivAt.comp_hasMFDerivWithinAt s |
| 107 | ((hγ s hs).mdifferentiableWithinAt (by simp)).hasMFDerivWithinAt |
| 108 | have hd := ht.hasFDerivWithinAt.hasDerivWithinAt |
| 109 | have hc : HasDerivWithinAt (fun r => G.spacetime.timeFunction (V.squareFamily r u)) |
| 110 | (-(2 * s)) (M14SqrtParameterInterval τ₁ τ₂) s := by |
| 111 | have hpoly : HasDerivAt (fun r : ℝ => T - r ^ 2) (-(2 * s)) s := by |
| 112 | convert! (hasDerivAt_const s T).sub (hasDerivAt_pow 2 s) using 1 |
| 113 | simp |
| 114 | exact hpoly.hasDerivWithinAt.congr_of_mem (fun r hr => variation_squareFamily_time V hr hu) hs |
| 115 | have hJ := uniqueDiffOn_Icc (Real.sqrt_lt_sqrt p.tau_nonneg p.tau_lt) s hs |
| 116 | exact (hd.derivWithin hJ).symm.trans (hc.derivWithin hJ) |
| 117 | |
| 118 | /-- The actual square-root horizontal velocity is its tangent plus the |
| 119 | compensating 2s time vector, including endpoints, equation (6.2), p. 106. -/ |
| 120 | theorem variationSquareVelocity_val_eq_tangent_add_time (V : M14LVariationData G p R) |
| 121 | {s u : ℝ} (hs : s ∈ M14SqrtParameterInterval τ₁ τ₂) |
| 122 | (hu : u ∈ V.parameterDomain) : |
| 123 | (variationSquareVelocity V s u).val = |
| 124 | mfderivWithin (𝓘(ℝ, ℝ)) (spacetimeModel n) (fun r => V.squareFamily r u) |
| 125 | (M14SqrtParameterInterval τ₁ τ₂) s (1 : ℝ) + |
| 126 | (2 * s) • G.spacetime.timeVector (V.squareFamily s u) := by |
| 127 | let v : TangentSpace (spacetimeModel n) (V.squareFamily s u) := |
| 128 | mfderivWithin (𝓘(ℝ, ℝ)) (spacetimeModel n) (fun r => V.squareFamily r u) |
| 129 | (M14SqrtParameterInterval τ₁ τ₂) s (1 : ℝ) |
| 130 | change (G.spacetime.horizontalProjection (V.squareFamily s u) v).val = |
| 131 | v + (2 * s) • G.spacetime.timeVector (V.squareFamily s u) |
| 132 | rw [G.spacetime.horizontalProjection_eq] |
| 133 | change v - (show ℝ from mfderiv (spacetimeModel n) 𝓘(ℝ) G.spacetime.timeFunction |
| 134 | (V.squareFamily s u) v) • G.spacetime.timeVector (V.squareFamily s u) = _ |
| 135 | rw [show (show ℝ from mfderiv (spacetimeModel n) 𝓘(ℝ) G.spacetime.timeFunction |
| 136 | (V.squareFamily s u) v) = -(2 * s) from variation_square_tangent_clock V hs hu, |
| 137 | neg_smul, sub_neg_eq_add] |
| 138 | |
| 139 | private theorem horizontal_transport_val {q r : G.Point} (h : q = r) |
| 140 | (v : G.Horizontal r) : (h.symm ▸ v : G.Horizontal q).val = v.val := by |
| 141 | cases h |
| 142 | rfl |
| 143 | |
| 144 | /-- At parameter zero the actual square velocity is the transported base |
| 145 | velocity at every closed interval point, including time zero, |
| 146 | equation (6.2) and Lemma 6.4, pp. 106-108. -/ |
| 147 | theorem variationSquareVelocity_zero (V : M14LVariationData G p R) |
| 148 | {s : ℝ} (hs : s ∈ M14SqrtParameterInterval τ₁ τ₂) : |
| 149 | variationSquareVelocity V s 0 = (V.square_base s).symm ▸ R.horizontal_velocity s := by |
| 150 | apply Subtype.ext |
| 151 | rw [horizontal_transport_val (V.square_base s)] |
| 152 | have hd := mfderivWithin_congr_of_mem (I := 𝓘(ℝ, ℝ)) (I' := spacetimeModel n) |
| 153 | (fun r (_ : r ∈ M14SqrtParameterInterval τ₁ τ₂) => V.square_base r) hs |
| 154 | have hv := congrArg (fun L : ℝ →L[ℝ] SpacetimeModelVector n => L 1) hd |
| 155 | unfold variationSquareVelocity |
| 156 | erw [hv, V.square_base s] |
| 157 | exact congrArg Subtype.val (squareRoot_horizontalVelocity_eq_projection R hs).symm |
| 158 | |
| 159 | private theorem inner_transport {q r : G.Point} (h : q = r) (v w : G.Horizontal r) : |
| 160 | G.spacetime.horizontalMetric.inner q (h.symm ▸ v) (h.symm ▸ w) = |
| 161 | G.spacetime.horizontalMetric.inner r v w := by |
| 162 | cases h |
| 163 | rfl |
| 164 | |
| 165 | /-- The smooth variation density at parameter zero is exactly the base |
| 166 | square-root density, with its actual endpoint values, equation (6.2), p. 106. -/ |
| 167 | theorem variationActionDensity_zero (V : M14LVariationData G p R) |
| 168 | {s : ℝ} (hs : s ∈ M14SqrtParameterInterval τ₁ τ₂) : |
| 169 | variationActionDensity V (s, 0) = squareRootLIntegrand R s := by |
| 170 | unfold variationActionDensity squareRootLIntegrand |
| 171 | rw [variationSquareVelocity_zero V hs, inner_transport (V.square_base s), V.square_base s] |
| 172 | |
| 173 | end PoincareMT.M14 |