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.SourceNames.LGeometry |
| 2 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Variation.Coordinates.GaugeCovariantFields |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Variation.Coordinates.GaugeVelocity |
| 4 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Variation.Pullback.PullbackCongruence |
| 5 | |
| 6 | /-! |
| 7 | # Actual fields along a closed gauge lift |
| 8 | |
| 9 | Morgan-Tian Lemmas 6.10 and 6.12, pp. 109-110. Smooth coordinate |
| 10 | fields give smooth horizontal fields along a reconstructed curve. |
| 11 | Their actual within derivatives and the supplied square velocity have |
| 12 | the ordinary coordinate formulas on every closed subinterval. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | -- Product and open-subset tangent fibers retain their fixed model aliases. |
| 17 | set_option backward.isDefEq.respectTransparency false |
| 18 | |
| 19 | open Set |
| 20 | open scoped Manifold ContDiff Bundle |
| 21 | |
| 22 | universe u |
| 23 | |
| 24 | namespace PoincareMT.M14 |
| 25 | |
| 26 | variable {n : ℕ} {X : Type u} [TopologicalSpace X] {time : X → ℝ} |
| 27 | {I : SpacetimeInterval} {G : GeneralizedLGeometryTransport n X time I} |
| 28 | (b : G.gaugeCover.index) |
| 29 | {β : ℝ → (G.timeIntervals.interval (G.gaugeCover.interval b)).Point × |
| 30 | G.gaugeCover.spatial b} {J : Set ℝ} |
| 31 | |
| 32 | /-- A smooth ambient coordinate field gives a smooth horizontal field |
| 33 | along the actual gauge curve, including within endpoints, |
| 34 | Lemmas 6.10 and 6.12, pp. 109-110. -/ |
| 35 | theorem gaugeHorizontalField_contMDiffOn |
| 36 | (hβ : ContMDiffOn (𝓘(ℝ, ℝ)) (spacetimeModel n) ∞ β J) |
| 37 | {f : ℝ → EuclideanSpace ℝ (Fin n)} (hf : ContDiffOn ℝ ∞ f J) : |
| 38 | ContMDiffOn (𝓘(ℝ, ℝ)) |
| 39 | ((spacetimeModel n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ |
| 40 | (fun s => Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) |
| 41 | ((G.gaugeCover.cylinder b).toSpacetime (β s)) |
| 42 | ((G.gaugeCover.metric b).spatialTangentEquiv (β s).1 (β s).2 (f s))) J := by |
| 43 | let D := G.timeIntervals.interval (G.gaugeCover.interval b) |
| 44 | let U := G.gaugeCover.spatial b |
| 45 | have hzero : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡∂ 1).tangent ∞ |
| 46 | (fun s => Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin 1)) |
| 47 | (E := (TangentSpace (𝓡∂ 1) : D.Point → Type _)) |
| 48 | (β s).1 0) J := |
| 49 | (Bundle.contMDiff_zeroSection ℝ |
| 50 | (TangentSpace (𝓡∂ 1) : D.Point → Type _)).comp_contMDiffOn |
| 51 | (fun s hs => (hβ s hs).fst) |
| 52 | have hsp : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n).tangent ∞ |
| 53 | (fun s => Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) |
| 54 | (E := (TangentSpace (𝓡 n) : U → Type _)) (β s).2 (f s)) J := |
| 55 | fun s hs => U.tangentField_contMDiffWithinAt ((hβ s hs).snd) |
| 56 | (hf s hs).contMDiffWithinAt |
| 57 | have hv := (contMDiff_equivTangentBundleProd_symm |
| 58 | (I := 𝓡∂ 1) (M := D.Point) (I' := 𝓡 n) (M' := U) (n := ∞)).comp_contMDiffOn |
| 59 | (hzero.prodMk hsp) |
| 60 | have he := ((G.gaugeCover.cylinder b).smooth.contMDiff_tangentMap (m := ∞) |
| 61 | (by simp)).comp_contMDiffOn hv |
| 62 | have hp : ContMDiff (spacetimeModel n).tangent |
| 63 | ((spacetimeModel n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ |
| 64 | (fun v : TangentBundle (spacetimeModel n) G.Point => |
| 65 | Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) |
| 66 | (E := G.Horizontal) v.proj (G.spacetime.horizontalProjection v.proj v.2)) := |
| 67 | G.spacetime.horizontalProjection_smooth |
| 68 | apply (hp.comp_contMDiffOn he).congr |
| 69 | intro s hs |
| 70 | change Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) (E := G.Horizontal) _ _ = |
| 71 | Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) (E := G.Horizontal) |
| 72 | ((G.gaugeCover.cylinder b).toSpacetime (β s)) |
| 73 | (G.spacetime.horizontalProjection _ |
| 74 | (mfderiv (spacetimeModel n) (spacetimeModel n) |
| 75 | (G.gaugeCover.cylinder b).toSpacetime (β s) (0, f s))) |
| 76 | rw [gauge_projectedDifferential b] |
| 77 | |
| 78 | /-- Transport coordinate vectors through the actual gauge |
| 79 | reconstruction, with zero values outside the specified parameter set, |
| 80 | Lemmas 6.10 and 6.12, pp. 109-110. -/ |
| 81 | noncomputable def horizontalFieldOfGauge {γ : ℝ → G.Point} |
| 82 | (hrec : ∀ s ∈ J, (G.gaugeCover.cylinder b).toSpacetime (β s) = γ s) |
| 83 | (f : ℝ → EuclideanSpace ℝ (Fin n)) (s : ℝ) : G.Horizontal (γ s) := by |
| 84 | classical |
| 85 | exact if hs : s ∈ J then |
| 86 | hrec s hs ▸ ((G.gaugeCover.metric b).spatialTangentEquiv (β s).1 (β s).2 (f s)) |
| 87 | else 0 |
| 88 | |
| 89 | private theorem horizontal_cast_heq {q r : G.Point} (h : q = r) (v : G.Horizontal q) : |
| 90 | HEq (h ▸ v : G.Horizontal r) v := by |
| 91 | cases h |
| 92 | rfl |
| 93 | |
| 94 | /-- The transported actual field agrees with the coordinate vector |
| 95 | under the supplied spatial tangent equivalence, Lemmas 6.10 and |
| 96 | 6.12, pp. 109-110. -/ |
| 97 | theorem horizontalFieldOfGauge_heq {γ : ℝ → G.Point} |
| 98 | (hrec : ∀ s ∈ J, (G.gaugeCover.cylinder b).toSpacetime (β s) = γ s) |
| 99 | (f : ℝ → EuclideanSpace ℝ (Fin n)) {s : ℝ} (hs : s ∈ J) : |
| 100 | HEq (horizontalFieldOfGauge b hrec f s) |
| 101 | ((G.gaugeCover.metric b).spatialTangentEquiv (β s).1 (β s).2 (f s)) := by |
| 102 | simp only [horizontalFieldOfGauge, dif_pos hs] |
| 103 | exact horizontal_cast_heq (hrec s hs) _ |
| 104 | |
| 105 | /-- The actual transported field is smooth within its parameter |
| 106 | set; arbitrary outside values have no effect, Lemmas 6.10 and 6.12, |
| 107 | pp. 109-110. -/ |
| 108 | theorem horizontalFieldOfGauge_contMDiffOn {γ : ℝ → G.Point} |
| 109 | (hβ : ContMDiffOn (𝓘(ℝ, ℝ)) (spacetimeModel n) ∞ β J) |
| 110 | (hrec : ∀ s ∈ J, (G.gaugeCover.cylinder b).toSpacetime (β s) = γ s) |
| 111 | {f : ℝ → EuclideanSpace ℝ (Fin n)} (hf : ContDiffOn ℝ ∞ f J) : |
| 112 | ContMDiffOn (𝓘(ℝ, ℝ)) |
| 113 | ((spacetimeModel n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ |
| 114 | (fun s => Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) |
| 115 | (γ s) (horizontalFieldOfGauge b hrec f s)) J := by |
| 116 | apply (gaugeHorizontalField_contMDiffOn b hβ hf).congr |
| 117 | intro s hs |
| 118 | exact Bundle.TotalSpace.ext (hrec s hs).symm (horizontalFieldOfGauge_heq b hrec f hs) |
| 119 | |
| 120 | /-- Every actual field along a reconstructed gauge curve has its |
| 121 | within Christoffel formula, for every extension record and every |
| 122 | unique within point, Lemmas 6.10 and 6.12, pp. 109-110. -/ |
| 123 | theorem horizontalCovariantDerivative_lifted_gauge |
| 124 | (hCoordinates : SpacetimeGaugeTheory.{u, 0} G.leafwise G.timeIntervals) |
| 125 | (W : OrdinaryGaugeWitness G.leafwise (G.gaugeCover.cylinder b) (G.gaugeCover.metric b)) |
| 126 | (T : ℝ) (x₀ : G.gaugeCover.spatial b) {γ : ℝ → G.Point} |
| 127 | (hβ : ContMDiffOn (𝓘(ℝ, ℝ)) (spacetimeModel n) ∞ β J) |
| 128 | (hrec : ∀ s ∈ J, (G.gaugeCover.cylinder b).toSpacetime (β s) = γ s) |
| 129 | (hclock : ∀ s ∈ J, (β s).1.val = T - s ^ 2) |
| 130 | {Y : ∀ s, G.Horizontal (γ s)} (E : M14PullbackExtension G γ J Y) |
| 131 | (f : ℝ → EuclideanSpace ℝ (Fin n)) |
| 132 | (hY : ∀ s ∈ J, |
| 133 | HEq (Y s) ((G.gaugeCover.metric b).spatialTangentEquiv (β s).1 (β s).2 (f s))) |
| 134 | {s : ℝ} (hs : s ∈ J) (hJ : UniqueDiffWithinAt ℝ J s) : |
| 135 | HEq (M14HorizontalCovariantDerivative G γ J Y E s) |
| 136 | ((G.gaugeCover.metric b).spatialTangentEquiv (β s).1 (β s).2 |
| 137 | (derivWithin f J s + M08.closedChartConnection W.flow T x₀ J (s, (β s).2.val) |
| 138 | (derivWithin (fun r => (β r).2.val) J s) (f s))) := by |
| 139 | let γ' := fun r => (G.gaugeCover.cylinder b).toSpacetime (β r) |
| 140 | let Y' : ∀ r, G.Horizontal (γ' r) := fun r => |
| 141 | (G.gaugeCover.metric b).spatialTangentEquiv (β r).1 (β r).2 (f r) |
| 142 | have hγ : EqOn γ γ' J := fun r hr => (hrec r hr).symm |
| 143 | let E' := pullbackExtensionCongrOn E hγ hY |
| 144 | have hc := horizontalCovariantDerivative_gauge_chart b hCoordinates W T x₀ hclock E' |
| 145 | hs hJ ((hβ s hs).mdifferentiableWithinAt (by simp)) |
| 146 | have hform : M14HorizontalCovariantDerivative G γ' J Y' E' s = |
| 147 | (G.gaugeCover.metric b).spatialTangentEquiv (β s).1 (β s).2 |
| 148 | (derivWithin f J s + M08.closedChartConnection W.flow T x₀ J (s, (β s).2.val) |
| 149 | (derivWithin (fun r => (β r).2.val) J s) (f s)) := by |
| 150 | apply ((G.gaugeCover.metric b).spatialTangentEquiv (β s).1 (β s).2).symm.injective |
| 151 | simpa only [Y', ContinuousLinearEquiv.symm_apply_apply] using hc |
| 152 | exact (horizontalCovariantDerivative_congrOn E hγ hY hs).trans (heq_of_eq hform) |
| 153 | |
| 154 | variable {T τ₁ τ₂ : ℝ} {x y : G.Point} {p : M14BackwardPath G T τ₁ τ₂ x y} |
| 155 | (R : M14SquareRootPath G p) |
| 156 | |
| 157 | /-- The supplied square-root velocity is the within coordinate |
| 158 | velocity on every uniquely differentiable closed subinterval, |
| 159 | Lemmas 6.10 and 6.12, pp. 109-110. -/ |
| 160 | theorem squareRootVelocity_gauge_subset |
| 161 | (hJC : J ⊆ M14SqrtParameterInterval τ₁ τ₂) |
| 162 | (hβ : ContMDiffOn (𝓘(ℝ, ℝ)) (spacetimeModel n) ∞ β J) |
| 163 | (hrec : ∀ s ∈ J, (G.gaugeCover.cylinder b).toSpacetime (β s) = R.curve s) |
| 164 | {s : ℝ} (hs : s ∈ J) (hJ : UniqueDiffWithinAt ℝ J s) : |
| 165 | HEq (R.horizontal_velocity s) |
| 166 | ((G.gaugeCover.metric b).spatialTangentEquiv (β s).1 (β s).2 |
| 167 | (derivWithin (fun r => (β r).2.val) J s)) := by |
| 168 | have hR := R.smooth.mono R.interval_subset |
| 169 | have hp := gaugeCurve_projectedVelocityWithin b |
| 170 | ((hβ s hs).mdifferentiableWithinAt (by simp)) hJ |
| 171 | have hc := projectedCurveVelocityWithin_congrOn (G := G) |
| 172 | (fun r hr => (hrec r hr).symm) hs |
| 173 | have hleft : projectedCurveVelocityWithin G R.curve J s = R.horizontal_velocity s := by |
| 174 | unfold projectedCurveVelocityWithin |
| 175 | rw [mfderivWithin_subset hJC hJ.uniqueMDiffWithinAt |
| 176 | ((hR s (hJC hs)).mdifferentiableWithinAt (by simp))] |
| 177 | exact (squareRoot_horizontalVelocity_eq_projection R (hJC hs)).symm |
| 178 | rw [hleft] at hc |
| 179 | exact hc.trans (heq_of_eq hp) |
| 180 | |
| 181 | end PoincareMT.M14 |