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.Calculus.Differential.RectanglePartialTangent |
| 2 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Paths.SquareRoot.Action.SquareRootVelocityExtension |
| 3 | import Mathlib.Analysis.Calculus.Deriv.Pow |
| 4 | |
| 5 | /-! |
| 6 | # The actual square-root velocity of a variation |
| 7 | |
| 8 | Morgan-Tian equations (6.1)-(6.2) and Lemma 6.4, pp. 106-108. |
| 9 | The actual within derivative is smooth on the closed rectangle. Its |
| 10 | identification with the supplied rescaled field is only asserted in the |
| 11 | interior, since the totalized original velocity does not prescribe the |
| 12 | square-root derivative at time zero. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | -- Tangent fibers at different basepoints share the selected spacetime vector model. |
| 17 | set_option backward.isDefEq.respectTransparency false |
| 18 | |
| 19 | open scoped Manifold ContDiff Bundle Topology |
| 20 | |
| 21 | universe u |
| 22 | |
| 23 | namespace PoincareMT.M14 |
| 24 | |
| 25 | variable {n : ℕ} {X : Type u} [TopologicalSpace X] {time : X → ℝ} |
| 26 | {I : SpacetimeInterval} {G : GeneralizedLGeometryTransport n X time I} |
| 27 | {T τ₁ τ₂ : ℝ} {x y : G.Point} {p : M14BackwardPath G T τ₁ τ₂ x y} |
| 28 | {R : M14SquareRootPath G p} |
| 29 | |
| 30 | /-- The actual horizontal square-root velocity, including its within |
| 31 | endpoint values, for the nonsingular density in equation (6.2), p. 106. -/ |
| 32 | noncomputable def variationSquareVelocity (V : M14LVariationData G p R) (s u : ℝ) : |
| 33 | G.Horizontal (V.squareFamily s u) := |
| 34 | G.spacetime.horizontalProjection (V.squareFamily s u) |
| 35 | (mfderivWithin (𝓘(ℝ, ℝ)) (spacetimeModel n) (fun r => V.squareFamily r u) |
| 36 | (M14SqrtParameterInterval τ₁ τ₂) s (1 : ℝ)) |
| 37 | |
| 38 | /-- The actual horizontal square-root velocity is smooth on the entire |
| 39 | closed-by-open variation rectangle, Lemma 6.4, pp. 107-108. -/ |
| 40 | theorem variationSquareVelocity_smooth (V : M14LVariationData G p R) : |
| 41 | ContMDiffOn ((𝓘(ℝ, ℝ)).prod (𝓘(ℝ, ℝ))) |
| 42 | ((spacetimeModel n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ |
| 43 | (fun z : ℝ × ℝ => Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) |
| 44 | (E := G.Horizontal) (V.squareFamily z.1 z.2) (variationSquareVelocity V z.1 z.2)) |
| 45 | (M14SqrtParameterInterval τ₁ τ₂ ×ˢ V.parameterDomain) := by |
| 46 | have hP : IsOpen V.parameterDomain := V.parameterDomain_eq ▸ isOpen_Ioo |
| 47 | have htan := (V.square_smooth.mono V.square_contains).contMDiffOn_partialTangentWithin_fst_prod |
| 48 | (uniqueDiffOn_Icc (Real.sqrt_lt_sqrt p.tau_nonneg p.tau_lt)) hP.uniqueDiffOn |
| 49 | (1 : ℝ) (k := ∞) (by simp) |
| 50 | have hproj : ContMDiff (spacetimeModel n).tangent |
| 51 | ((spacetimeModel n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ |
| 52 | (fun v : TangentBundle (spacetimeModel n) G.Point => |
| 53 | Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) |
| 54 | (E := G.Horizontal) v.proj (G.spacetime.horizontalProjection v.proj v.2)) := |
| 55 | G.spacetime.horizontalProjection_smooth |
| 56 | exact hproj.comp_contMDiffOn htan |
| 57 | |
| 58 | /-- The supplied family derivative equation forces genuine interior |
| 59 | differentiability; its clock component cannot be a totalized zero |
| 60 | derivative, Definitions 6.1-6.2, pp. 105-106. -/ |
| 61 | theorem variation_family_mdifferentiableAt (V : M14LVariationData G p R) |
| 62 | {u τ : ℝ} (hu : u ∈ V.parameterDomain) (hτ : τ ∈ Set.Ioo τ₁ τ₂) : |
| 63 | MDifferentiableAt (𝓘(ℝ, ℝ)) (spacetimeModel n) (fun r => V.family r u) τ := by |
| 64 | by_contra hnot |
| 65 | have hz := congrArg (fun L : ℝ →L[ℝ] SpacetimeModelVector n => L 1) |
| 66 | (mfderiv_zero_of_not_mdifferentiableAt hnot) |
| 67 | change mfderiv (𝓘(ℝ, ℝ)) (spacetimeModel n) (fun r => V.family r u) τ (1 : ℝ) = 0 at hz |
| 68 | rw [V.family_derivative u hu τ hτ] at hz |
| 69 | let dt : SpacetimeModelVector n →L[ℝ] ℝ := |
| 70 | mfderiv (spacetimeModel n) 𝓘(ℝ) G.spacetime.timeFunction (V.family τ u) |
| 71 | have ht := congrArg dt hz |
| 72 | have hc : dt (G.spacetime.timeVector (V.family τ u)) = 1 := |
| 73 | G.spacetime.timeVector_normalized (V.family τ u) |
| 74 | have hv : dt (V.family_velocity u τ).val = 0 := (V.family_velocity u τ).property |
| 75 | norm_num only [map_add, map_neg, map_zero, hc, hv, add_zero, neg_eq_zero, one_ne_zero] at ht |
| 76 | |
| 77 | private theorem square_tangent (V : M14LVariationData G p R) |
| 78 | {s u : ℝ} (hs : s ∈ Set.Ioo (Real.sqrt τ₁) (Real.sqrt τ₂)) |
| 79 | (hu : u ∈ V.parameterDomain) : |
| 80 | mfderivWithin (𝓘(ℝ, ℝ)) (spacetimeModel n) (fun r => V.squareFamily r u) |
| 81 | (M14SqrtParameterInterval τ₁ τ₂) s (1 : ℝ) = |
| 82 | (2 * s) • mfderiv (𝓘(ℝ, ℝ)) (spacetimeModel n) |
| 83 | (fun r => V.family r u) (s ^ 2) (1 : ℝ) := by |
| 84 | have hs0 : 0 < s := (Real.sqrt_nonneg τ₁).trans_lt hs.1 |
| 85 | have hτ : s ^ 2 ∈ Set.Ioo τ₁ τ₂ := |
| 86 | ⟨Real.lt_sq_of_sqrt_lt hs.1, (Real.lt_sqrt hs0.le).mp hs.2⟩ |
| 87 | have hnear : (fun r => V.squareFamily r u) =ᶠ[𝓝 s] fun r => V.family (r ^ 2) u := |
| 88 | Filter.eventually_of_mem (Ioo_mem_nhds hs.1 hs.2) |
| 89 | (fun r hr => V.square_agrees r ⟨hr.1.le, hr.2.le⟩ u hu) |
| 90 | have hg := congrArg (fun L : ℝ →L[ℝ] SpacetimeModelVector n => L 1) |
| 91 | (hnear.mfderiv_eq (I := 𝓘(ℝ, ℝ)) (I' := spacetimeModel n)) |
| 92 | have hw := congrArg (fun L : ℝ →L[ℝ] SpacetimeModelVector n => L 1) |
| 93 | (mfderivWithin_of_mem_nhds (I := 𝓘(ℝ, ℝ)) (I' := spacetimeModel n) |
| 94 | (f := fun r => V.squareFamily r u) (Icc_mem_nhds hs.1 hs.2)) |
| 95 | have hsq : HasDerivAt (fun r : ℝ => r ^ 2) (2 * s) s := by |
| 96 | simpa using hasDerivAt_pow 2 s |
| 97 | have hsqmf : mfderiv (𝓘(ℝ, ℝ)) (𝓘(ℝ, ℝ)) (fun r : ℝ => r ^ 2) s (1 : ℝ) = 2 * s := by |
| 98 | have hm := hsq.hasFDerivAt.hasMFDerivAt.mfderiv |
| 99 | have hv := congrArg (fun L : TangentSpace (𝓘(ℝ, ℝ)) s →L[ℝ] |
| 100 | TangentSpace (𝓘(ℝ, ℝ)) (s ^ 2) => L 1) hm |
| 101 | change mfderiv (𝓘(ℝ, ℝ)) (𝓘(ℝ, ℝ)) (fun r : ℝ => r ^ 2) s (1 : ℝ) = |
| 102 | (ContinuousLinearMap.toSpanSingleton ℝ (2 * s)) (1 : ℝ) at hv |
| 103 | simpa only [ContinuousLinearMap.toSpanSingleton_apply, one_smul] using hv |
| 104 | have hinput : mfderiv (𝓘(ℝ, ℝ)) (𝓘(ℝ, ℝ)) (fun r : ℝ => r ^ 2) s (1 : ℝ) = |
| 105 | (2 * s) • (1 : TangentSpace (𝓘(ℝ, ℝ)) s) := by |
| 106 | rw [hsqmf] |
| 107 | simp |
| 108 | have hchain := mfderiv_comp_apply s (f := fun r : ℝ => r ^ 2) |
| 109 | (g := fun r => V.family r u) (variation_family_mdifferentiableAt V hu hτ) |
| 110 | hsq.differentiableAt.mdifferentiableAt (1 : ℝ) |
| 111 | rw [hinput, map_smul] at hchain |
| 112 | exact hw.trans (hg.trans hchain) |
| 113 | |
| 114 | private theorem horizontal_transport_val {q r : G.Point} (h : q = r) |
| 115 | (v : G.Horizontal r) : (h.symm ▸ v : G.Horizontal q).val = v.val := by |
| 116 | cases h |
| 117 | rfl |
| 118 | |
| 119 | /-- The actual square-root horizontal velocity equals the supplied |
| 120 | rescaled original velocity on the interior, equations (6.1)-(6.2), p. 106. |
| 121 | No endpoint agreement of these totalized fields is asserted. -/ |
| 122 | theorem variationSquareVelocity_eq_rescaled (V : M14LVariationData G p R) |
| 123 | {s u : ℝ} (hs : s ∈ Set.Ioo (Real.sqrt τ₁) (Real.sqrt τ₂)) |
| 124 | (hu : u ∈ V.parameterDomain) : |
| 125 | variationSquareVelocity V s u = |
| 126 | (V.square_agrees s ⟨hs.1.le, hs.2.le⟩ u hu).symm ▸ |
| 127 | ((2 * s) • V.family_velocity u (s ^ 2)) := by |
| 128 | apply Subtype.ext |
| 129 | rw [horizontal_transport_val (V.square_agrees s ⟨hs.1.le, hs.2.le⟩ u hu)] |
| 130 | unfold variationSquareVelocity |
| 131 | rw [square_tangent V hs hu, V.square_agrees s ⟨hs.1.le, hs.2.le⟩ u hu] |
| 132 | have hs0 : 0 < s := (Real.sqrt_nonneg τ₁).trans_lt hs.1 |
| 133 | rw [V.family_derivative u hu (s ^ 2) |
| 134 | ⟨Real.lt_sq_of_sqrt_lt hs.1, (Real.lt_sqrt hs0.le).mp hs.2⟩, |
| 135 | map_smul, map_add, map_neg, horizontalProjection_timeVector_eq_zero, |
| 136 | neg_zero, zero_add, G.spacetime.horizontalProjection_identity] |
| 137 | |
| 138 | end PoincareMT.M14 |