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.Surface.VariationGaugeAcceleration |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Calculus.Differential.RectanglePartialDerivative |
| 4 | |
| 5 | /-! |
| 6 | # The closed acceleration boundary pairing |
| 7 | |
| 8 | Morgan-Tian Proposition 6.33, pp. 120-121. The actual endpoint |
| 9 | acceleration is paired with the actual square-time velocity. Relative |
| 10 | gauge rectangles and M08's closed metric and connection coefficients |
| 11 | prove smoothness without an open time extension or a smooth choice of |
| 12 | endpoint extension records. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | -- Equality of base points transports the actual horizontal tangent fibers. |
| 17 | set_option backward.isDefEq.respectTransparency false |
| 18 | |
| 19 | open Set Filter |
| 20 | open scoped Manifold ContDiff Topology |
| 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 | {T τ₁ τ₂ : ℝ} {x y : G.Point} {p : M14BackwardPath G T τ₁ τ₂ x y} |
| 29 | {R : M14SquareRootPath G p} |
| 30 | |
| 31 | /-- The actual endpoint acceleration on its closed time interval, |
| 32 | extended by zero elsewhere, in Proposition 6.33, pp. 120-121. -/ |
| 33 | noncomputable def variationAccelerationField |
| 34 | (V : M14LVariationData G p R) (D : M14VariationDerivativeData V) (s : ℝ) : |
| 35 | G.Horizontal (R.curve s) := by |
| 36 | classical |
| 37 | exact if hs : s ∈ M14SqrtParameterInterval τ₁ τ₂ then |
| 38 | M14VariationEndpointAcceleration V D s hs else 0 |
| 39 | |
| 40 | /-- The acceleration field has exactly the frozen endpoint value on |
| 41 | the closed interval, Proposition 6.33, pp. 120-121. -/ |
| 42 | theorem variationAccelerationField_eq |
| 43 | (V : M14LVariationData G p R) (D : M14VariationDerivativeData V) |
| 44 | {s : ℝ} (hs : s ∈ M14SqrtParameterInterval τ₁ τ₂) : |
| 45 | variationAccelerationField V D s = M14VariationEndpointAcceleration V D s hs := by |
| 46 | simp only [variationAccelerationField, dif_pos hs] |
| 47 | |
| 48 | /-- The actual boundary pairing retained for a general endpoint |
| 49 | variation in Proposition 6.33, pp. 120-121. -/ |
| 50 | noncomputable def variationAccelerationBoundaryPair |
| 51 | (V : M14LVariationData G p R) (D : M14VariationDerivativeData V) (s : ℝ) : ℝ := |
| 52 | G.spacetime.horizontalMetric.inner (R.curve s) |
| 53 | (R.horizontal_velocity s) (variationAccelerationField V D s) |
| 54 | |
| 55 | private theorem pair_transport_heq {q r : G.Point} (h : q = r) |
| 56 | (v : G.Horizontal q) : HEq (h.symm ▸ v : G.Horizontal r) v := by |
| 57 | cases h |
| 58 | rfl |
| 59 | |
| 60 | private theorem horizontal_inner_eq_of_heq {q r : G.Point} (h : q = r) |
| 61 | {a z : G.Horizontal q} {a' z' : G.Horizontal r} (ha : HEq a a') (hz : HEq z z') : |
| 62 | G.spacetime.horizontalMetric.inner q a z = G.spacetime.horizontalMetric.inner r a' z' := by |
| 63 | cases h |
| 64 | cases ha |
| 65 | cases hz |
| 66 | rfl |
| 67 | |
| 68 | /-- A compatible gauge gives the exact scalar acceleration boundary |
| 69 | pair at every closed time point, Proposition 6.33, pp. 120-121. -/ |
| 70 | theorem variationAccelerationBoundaryPair_gauge |
| 71 | (V : M14LVariationData G p R) (D : M14VariationDerivativeData V) |
| 72 | (b : G.gaugeCover.index) |
| 73 | (hCoordinates : SpacetimeGaugeTheory.{u, 0} G.leafwise G.timeIntervals) |
| 74 | (W : OrdinaryGaugeWitness G.leafwise (G.gaugeCover.cylinder b) (G.gaugeCover.metric b)) |
| 75 | (x₀ : G.gaugeCover.spatial b) {N P : Set ℝ} |
| 76 | (hN : IsOpen N) (hP : IsOpen P) (hzero : (0 : ℝ) ∈ P) (hPsub : P ⊆ V.parameterDomain) |
| 77 | {β : ℝ × ℝ → (G.timeIntervals.interval (G.gaugeCover.interval b)).Point × |
| 78 | G.gaugeCover.spatial b} |
| 79 | (hβ : ContMDiffOn ((𝓘(ℝ, ℝ)).prod (𝓘(ℝ, ℝ))) (spacetimeModel n) ∞ β |
| 80 | ((M14SqrtParameterInterval τ₁ τ₂ ∩ N) ×ˢ P)) |
| 81 | (hrec : ∀ r ∈ M14SqrtParameterInterval τ₁ τ₂ ∩ N, ∀ u ∈ P, |
| 82 | (G.gaugeCover.cylinder b).toSpacetime (β (r, u)) = V.squareFamily r u) |
| 83 | (hclock : ∀ r ∈ M14SqrtParameterInterval τ₁ τ₂ ∩ N, ∀ u ∈ P, |
| 84 | (β (r, u)).1.val = T - r ^ 2) |
| 85 | {s : ℝ} (hs : s ∈ M14SqrtParameterInterval τ₁ τ₂ ∩ N) : |
| 86 | variationAccelerationBoundaryPair V D s = |
| 87 | M08.chartActionMetric W.flow T x₀ (s, (β (s, 0)).2.val) |
| 88 | (derivWithin (fun r => (β (r, 0)).2.val) (M14SqrtParameterInterval τ₁ τ₂ ∩ N) s) |
| 89 | (deriv (deriv (fun v => (β (s, v)).2.val)) 0 + |
| 90 | M08.closedChartConnection W.flow T x₀ (M14SqrtParameterInterval τ₁ τ₂ ∩ N) |
| 91 | (s, (β (s, 0)).2.val) (deriv (fun v => (β (s, v)).2.val) 0) |
| 92 | (deriv (fun v => (β (s, v)).2.val) 0)) := by |
| 93 | have hA₀ : HEq (R.horizontal_velocity s) (variationSquareVelocity V s 0) := by |
| 94 | rw [variationSquareVelocity_zero V hs.1] |
| 95 | exact (pair_transport_heq (V.square_base s).symm _).symm |
| 96 | have hA := hA₀.trans (variationSquareVelocity_gauge V b hN hβ hrec hs hzero) |
| 97 | have hZ := variationEndpointAcceleration_gauge V D b hCoordinates W x₀ |
| 98 | inter_subset_left hP hzero hPsub hβ hrec hclock hs |
| 99 | unfold variationAccelerationBoundaryPair |
| 100 | rw [variationAccelerationField_eq V D hs.1] |
| 101 | exact (horizontal_inner_eq_of_heq |
| 102 | ((hrec s hs 0 hzero).trans (V.square_base s)).symm hA hZ).trans |
| 103 | (gauge_chartActionMetric b W T x₀ (β (s, 0)).2 s (β (s, 0)).1 |
| 104 | (hclock s hs 0 hzero).symm _ _).symm |
| 105 | |
| 106 | /-- The actual acceleration boundary pair is smooth on the entire |
| 107 | closed square-time interval, including time zero, Proposition 6.33, |
| 108 | pp. 120-121. The endpoint extensions may be chosen independently. -/ |
| 109 | theorem variationAccelerationBoundaryPair_contDiffOn |
| 110 | (V : M14LVariationData G p R) (D : M14VariationDerivativeData V) |
| 111 | (hCoordinates : SpacetimeGaugeTheory.{u, 0} G.leafwise G.timeIntervals) : |
| 112 | ContDiffOn ℝ ∞ (variationAccelerationBoundaryPair V D) (M14SqrtParameterInterval τ₁ τ₂) := by |
| 113 | intro s hs |
| 114 | obtain ⟨b, N, P, β, hN, hsN, hP, hzero, hPsub, hβ, hrec, hclock⟩ := |
| 115 | exists_variation_gauge_rectangle V hs |
| 116 | obtain ⟨W⟩ := ordinaryGaugeWitness_nonempty b hCoordinates |
| 117 | let S := M14SqrtParameterInterval τ₁ τ₂ ∩ N |
| 118 | let x₀ := (β (s, 0)).2 |
| 119 | let q := fun z : ℝ × ℝ => (β z).2.val |
| 120 | let a := fun r => derivWithin (fun v => q (v, 0)) S r |
| 121 | let y := fun r => deriv (fun v => q (r, v)) 0 |
| 122 | let z := fun r => deriv (deriv (fun v => q (r, v))) 0 + |
| 123 | M08.closedChartConnection W.flow T x₀ S (r, q (r, 0)) (y r) (y r) |
| 124 | have hS : UniqueDiffOn ℝ S := |
| 125 | (uniqueDiffOn_Icc (Real.sqrt_lt_sqrt p.tau_nonneg p.tau_lt)).inter hN |
| 126 | have hq : ContDiffOn ℝ ∞ q (S ×ˢ P) := variationGauge_spatial_contDiffOn b hβ |
| 127 | have hmap : MapsTo (fun r : ℝ => (r, (0 : ℝ))) S (S ×ˢ P) := fun _ hr => ⟨hr, hzero⟩ |
| 128 | have hq₀ := hq.comp (contDiffOn_id.prodMk contDiffOn_const) hmap |
| 129 | have hy₀ := hq.contDiffOn_deriv_snd_prod hS hP (k := ∞) (by simp) |
| 130 | have hy : ContDiffOn ℝ ∞ y S := hy₀.comp (contDiffOn_id.prodMk contDiffOn_const) hmap |
| 131 | have hyy : ContDiffOn ℝ ∞ (fun r => deriv (deriv (fun v => q (r, v))) 0) S := |
| 132 | (hy₀.contDiffOn_deriv_snd_prod hS hP (k := ∞) (by simp)).comp |
| 133 | (contDiffOn_id.prodMk contDiffOn_const) hmap |
| 134 | have ha : ContDiffOn ℝ ∞ a S := |
| 135 | (hq.contDiffOn_derivWithin_fst_prod hS hP.uniqueDiffOn (k := ∞) (by simp)).comp |
| 136 | (contDiffOn_id.prodMk contDiffOn_const) hmap |
| 137 | have htime (r : ℝ) (hr : r ∈ S) : T - r ^ 2 ∈ (G.gaugeCover.interval b).domain := by |
| 138 | rw [← hclock r hr 0 hzero] |
| 139 | exact (β (r, 0)).1.property |
| 140 | have hpoint : ContDiffOn ℝ ∞ (fun r => (r, q (r, 0))) S := contDiffOn_id.prodMk hq₀ |
| 141 | have htarget : MapsTo (fun r => (r, q (r, 0))) S |
| 142 | (S ×ˢ (extChartAt (𝓡 n) x₀).target) := by |
| 143 | intro r hr |
| 144 | refine ⟨hr, ?_⟩ |
| 145 | have hsrc : (β (r, 0)).2 ∈ (extChartAt (𝓡 n) x₀).source := by |
| 146 | rw [extChartAt_source, (G.gaugeCover.spatial b).chartAt_source_eq_univ] |
| 147 | exact mem_univ _ |
| 148 | have heq : extChartAt (𝓡 n) x₀ (β (r, 0)).2 = q (r, 0) := by |
| 149 | rw [extChartAt_coe] |
| 150 | rfl |
| 151 | change q (r, 0) ∈ (extChartAt (𝓡 n) x₀).target |
| 152 | rw [← heq] |
| 153 | exact (extChartAt (𝓡 n) x₀).map_source hsrc |
| 154 | have hΓ := (M08.closedChartConnection_contDiffOn W.flow T x₀ hS htime).comp hpoint htarget |
| 155 | have hz : ContDiffOn ℝ ∞ z S := hyy.add ((hΓ.clm_apply hy).clm_apply hy) |
| 156 | have hmetric := (M08.chartActionMetric_closed_contDiffOn W.flow T x₀ htime).comp hpoint htarget |
| 157 | have hpair := (hmetric.clm_apply ha).clm_apply hz |
| 158 | have hactual : ContDiffOn ℝ ∞ (variationAccelerationBoundaryPair V D) S := by |
| 159 | apply hpair.congr |
| 160 | intro r hr |
| 161 | exact variationAccelerationBoundaryPair_gauge V D b hCoordinates W x₀ |
| 162 | hN hP hzero hPsub hβ hrec hclock hr |
| 163 | exact (contDiffWithinAt_inter (hN.mem_nhds hsN)).mp (hactual s ⟨hs, hsN⟩) |
| 164 | |
| 165 | /-- The frozen second-variation boundary term is the endpoint |
| 166 | difference of the actual smooth acceleration pair, Proposition 6.33, |
| 167 | pp. 120-121. -/ |
| 168 | theorem secondVariationBoundaryTerm_eq_accelerationPair |
| 169 | (V : M14LVariationData G p R) (D : M14VariationDerivativeData V) : |
| 170 | M14SecondVariationBoundaryTerm V D = |
| 171 | variationAccelerationBoundaryPair V D (Real.sqrt τ₂) - |
| 172 | variationAccelerationBoundaryPair V D (Real.sqrt τ₁) := by |
| 173 | have hleft : Real.sqrt τ₁ ∈ M14SqrtParameterInterval τ₁ τ₂ := |
| 174 | ⟨le_rfl, Real.sqrt_le_sqrt p.tau_lt.le⟩ |
| 175 | have hright : Real.sqrt τ₂ ∈ M14SqrtParameterInterval τ₁ τ₂ := |
| 176 | ⟨Real.sqrt_le_sqrt p.tau_lt.le, le_rfl⟩ |
| 177 | simp only [M14SecondVariationBoundaryTerm, variationAccelerationBoundaryPair, |
| 178 | variationAccelerationField_eq V D hleft, variationAccelerationField_eq V D hright, |
| 179 | M14SquareRootVelocity] |
| 180 | |
| 181 | end PoincareMT.M14 |