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.ReducedGeometry.ReducedLength.Minimum.Variation.Second.Acceleration |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Minimum.Variation.Frame.CoefficientRegularity |
| 3 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Minimum.Variation.Geometry.Action |
| 4 | |
| 5 | /-! |
| 6 | # Smooth acceleration boundary terms |
| 7 | |
| 8 | The coordinate formula proves smoothness of the actual acceleration field, |
| 9 | independently of the selected endpoint extensions. The square-clock condition |
| 10 | holds at every real parameter for an ancient flow. |
| 11 | Adapted from Mapher `Proofs/M08/VariationAccelerationPair.lean`, |
| 12 | commit `49331b7d7ecad38f53e4300c3b35d6a84b2cc648`. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | set_option backward.isDefEq.respectTransparency false |
| 17 | |
| 18 | noncomputable section |
| 19 | |
| 20 | open Set Filter Topology |
| 21 | open scoped Manifold ContDiff Bundle |
| 22 | |
| 23 | universe u |
| 24 | |
| 25 | namespace PoincareMT.ReducedLengthMinimum.Variation.Geometry |
| 26 | |
| 27 | open ReducedLengthMinimum.Variational |
| 28 | |
| 29 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 30 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 31 | |
| 32 | def variationAccelerationField {J : Set ℝ} {F : RicciFlow n M J} |
| 33 | {T τ₁ τ₂ : ℝ} {p : BackwardTimePath F T τ₁ τ₂} |
| 34 | (V : LVariation F T τ₁ τ₂ p) (D : LVariationDerivativeData V) (s : ℝ) : |
| 35 | TangentSpace (𝓡 n) (V.baseSquareCurve s) := by |
| 36 | classical |
| 37 | exact if hs : s ∈ sqrtParameterInterval τ₁ τ₂ then |
| 38 | variationEndpointAcceleration V D s hs else 0 |
| 39 | |
| 40 | theorem variationAccelerationField_eq {J : Set ℝ} {F : RicciFlow n M J} |
| 41 | {T τ₁ τ₂ : ℝ} {p : BackwardTimePath F T τ₁ τ₂} |
| 42 | (V : LVariation F T τ₁ τ₂ p) (D : LVariationDerivativeData V) |
| 43 | {s : ℝ} (hs : s ∈ sqrtParameterInterval τ₁ τ₂) : |
| 44 | variationAccelerationField V D s = variationEndpointAcceleration V D s hs := by |
| 45 | simp only [variationAccelerationField, dif_pos hs] |
| 46 | |
| 47 | set_option maxHeartbeats 2000000 in |
| 48 | theorem variationAccelerationField_contMDiffOn {J : Set ℝ} {F : RicciFlow n M J} |
| 49 | {T τ₁ τ₂ : ℝ} {p : BackwardTimePath F T τ₁ τ₂} |
| 50 | (V : LVariation F T τ₁ τ₂ p) (D : LVariationDerivativeData V) |
| 51 | (hclock : ∀ s ∈ sqrtParameterInterval τ₁ τ₂, |
| 52 | s ∈ interior ((fun r : ℝ => T - r ^ 2) ⁻¹' J)) : |
| 53 | ContMDiffOn (𝓘(ℝ, ℝ)) ((𝓡 n).prod (𝓡 n)) ∞ |
| 54 | (fun s ↦ Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) |
| 55 | (V.baseSquareCurve s) (variationAccelerationField V D s)) |
| 56 | (sqrtParameterInterval τ₁ τ₂) := by |
| 57 | let C := sqrtParameterInterval τ₁ τ₂ |
| 58 | have hC : UniqueDiffOn ℝ C := uniqueDiffOn_Icc (Real.sqrt_lt_sqrt p.nonnegative p.ordered) |
| 59 | have hzero : (0 : ℝ) ∈ V.parameterDomain := ⟨neg_neg_of_pos V.radius_pos, V.radius_pos⟩ |
| 60 | have htime (r : ℝ) (hr : r ∈ C) : T - r ^ 2 ∈ J := by |
| 61 | apply p.time_mem |
| 62 | have hr0 : 0 ≤ r := (Real.sqrt_nonneg τ₁).trans hr.1 |
| 63 | constructor |
| 64 | · nlinarith [Real.sq_sqrt p.nonnegative, Real.sqrt_nonneg τ₁, hr.1] |
| 65 | · nlinarith [Real.sq_sqrt (p.nonnegative.trans p.ordered.le), Real.sqrt_nonneg τ₂, hr.2] |
| 66 | intro s hs |
| 67 | let x := V.baseSquareCurve s |
| 68 | let Ω := variationChartDomain V x |
| 69 | let N := (fun r : ℝ ↦ (r, (0 : ℝ))) ⁻¹' Ω |
| 70 | let q := variationChart V x |
| 71 | let y := fun r : ℝ ↦ coordinatePartialU q (r, 0) |
| 72 | let z := fun r : ℝ ↦ coordinatePartialU (coordinatePartialU q) (r, 0) + |
| 73 | Frame.chartConnection (chartActionMetric F T x) (r, q (r, 0)) (y r) (y r) |
| 74 | have hΩ : IsOpen Ω := variationChartDomain_open V x |
| 75 | have hN : IsOpen N := hΩ.preimage (continuous_id.prodMk continuous_const) |
| 76 | have hsN : s ∈ N := ⟨V.square_contains ⟨hs, hzero⟩, mem_chart_source _ _⟩ |
| 77 | have hq : ContDiffOn ℝ ∞ q Ω := variationChart_contDiffOn V x |
| 78 | have hqU := coordinatePartialU_contDiffOn hΩ q hq |
| 79 | have hqUU := coordinatePartialU_contDiffOn hΩ _ hqU |
| 80 | have hslice : MapsTo (fun r : ℝ ↦ (r, (0 : ℝ))) N Ω := fun r hr ↦ hr |
| 81 | have hqN : ContDiffOn ℝ ∞ (fun r : ℝ ↦ q (r, 0)) N := |
| 82 | hq.comp (contDiffOn_id.prodMk contDiffOn_const) hslice |
| 83 | have hy : ContDiffOn ℝ ∞ y N := |
| 84 | hqU.comp (contDiffOn_id.prodMk contDiffOn_const) hslice |
| 85 | have hz₀ : ContDiffOn ℝ ∞ (fun r : ℝ ↦ coordinatePartialU (coordinatePartialU q) (r, 0)) N := |
| 86 | hqUU.comp (contDiffOn_id.prodMk contDiffOn_const) hslice |
| 87 | have hsrc : MapsTo V.baseSquareCurve (C ∩ N) |
| 88 | (chartAt (EuclideanSpace ℝ (Fin n)) x).source := fun r hr ↦ hr.2.2 |
| 89 | have hmap : MapsTo (fun r : ℝ ↦ ((r, q (r, 0)), (y r, y r))) (C ∩ N) |
| 90 | {q : (ℝ × EuclideanSpace ℝ (Fin n)) × |
| 91 | EuclideanSpace ℝ (Fin n) × EuclideanSpace ℝ (Fin n) | |
| 92 | q.1 ∈ chartActionDomain F T x} := by |
| 93 | intro r hr |
| 94 | refine ⟨hclock r hr.1, ?_⟩ |
| 95 | exact (extChartAt (𝓡 n) x).map_source (by |
| 96 | simpa only [extChartAt_source, LVariation.baseSquareCurve] using hsrc hr) |
| 97 | have hk : ContDiffOn ℝ ∞ |
| 98 | (fun r : ℝ ↦ ((r, q (r, 0)), (y r, y r))) (C ∩ N) := |
| 99 | (contDiffOn_id.prodMk (hqN.mono inter_subset_right)).prodMk |
| 100 | ((hy.mono inter_subset_right).prodMk (hy.mono inter_subset_right)) |
| 101 | have hΓ := (Frame.chartConnection_smooth (chartActionMetric F T x) |
| 102 | (chartActionDomain F T x) (chartActionDomain_open F T x) |
| 103 | (chartActionMetric_contDiffOn F T x) (fun z hz => chartActionMetric_pos F T x hz)).comp hk hmap |
| 104 | have hz : ContDiffOn ℝ ∞ z (C ∩ N) := (hz₀.mono inter_subset_right).add hΓ |
| 105 | have hα : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ V.baseSquareCurve (C ∩ N) := |
| 106 | V.square_smooth.comp (contMDiff_id.prodMk contMDiff_const).contMDiffOn |
| 107 | (fun r hr ↦ hr.2.1) |
| 108 | have hfield := chartFrame_curve_contMDiffOn x V.baseSquareCurve z (C ∩ N) hα hz (fun r hr => hsrc hr) |
| 109 | have hactual : ContMDiffOn (𝓘(ℝ, ℝ)) ((𝓡 n).prod (𝓡 n)) ∞ |
| 110 | (fun r ↦ Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) |
| 111 | (V.baseSquareCurve r) (variationAccelerationField V D r)) (C ∩ N) := by |
| 112 | apply hfield.congr |
| 113 | intro r hr |
| 114 | congr 1 |
| 115 | rw [variationAccelerationField_eq V D hr.1] |
| 116 | exact variationEndpointAcceleration_chart V D hr.1 (hsrc hr) (hclock r hr.1) |
| 117 | exact (contMDiffWithinAt_inter (hN.mem_nhds hsN)).mp (hactual s ⟨hs, hsN⟩) |
| 118 | |
| 119 | def variationAccelerationBoundaryPair {J : Set ℝ} {F : RicciFlow n M J} |
| 120 | {T τ₁ τ₂ : ℝ} {p : BackwardTimePath F T τ₁ τ₂} |
| 121 | (V : LVariation F T τ₁ τ₂ p) (D : LVariationDerivativeData V) (s : ℝ) : ℝ := |
| 122 | (F.metric (T - s ^ 2)).inner (V.baseSquareCurve s) |
| 123 | (curveVelocityWithin (n := n) V.baseSquareCurve (sqrtParameterInterval τ₁ τ₂) s) |
| 124 | (variationAccelerationField V D s) |
| 125 | |
| 126 | set_option maxHeartbeats 1000000 in |
| 127 | theorem variationAccelerationBoundaryPair_contDiffOn {J : Set ℝ} {F : RicciFlow n M J} |
| 128 | {T τ₁ τ₂ : ℝ} {p : BackwardTimePath F T τ₁ τ₂} |
| 129 | (V : LVariation F T τ₁ τ₂ p) (D : LVariationDerivativeData V) |
| 130 | (hclock : ∀ s ∈ sqrtParameterInterval τ₁ τ₂, |
| 131 | s ∈ interior ((fun r : ℝ => T - r ^ 2) ⁻¹' J)) : |
| 132 | ContDiffOn ℝ ∞ (variationAccelerationBoundaryPair V D) (sqrtParameterInterval τ₁ τ₂) := by |
| 133 | let C := sqrtParameterInterval τ₁ τ₂ |
| 134 | let U := (fun s : ℝ ↦ (s, (0 : ℝ))) ⁻¹' V.squareDomain |
| 135 | have hU : IsOpen U := V.square_open.preimage (continuous_id.prodMk continuous_const) |
| 136 | have hCU : C ⊆ U := fun s hs ↦ |
| 137 | V.square_contains ⟨hs, neg_neg_of_pos V.radius_pos, V.radius_pos⟩ |
| 138 | have hC : UniqueDiffOn ℝ C := uniqueDiffOn_Icc (Real.sqrt_lt_sqrt p.nonnegative p.ordered) |
| 139 | have hα : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ V.baseSquareCurve U := |
| 140 | V.square_smooth.comp (contMDiff_id.prodMk contMDiff_const).contMDiffOn (fun s hs ↦ hs) |
| 141 | have hA : ContMDiffOn (𝓘(ℝ, ℝ)) ((𝓡 n).prod (𝓡 n)) ∞ |
| 142 | (fun s ↦ Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) (V.baseSquareCurve s) |
| 143 | (curveVelocityWithin (n := n) V.baseSquareCurve C s)) C := by |
| 144 | apply ((contMDiffOn_mfderiv_const_apply hU V.baseSquareCurve hα (1 : ℝ)).mono hCU).congr |
| 145 | intro s hs |
| 146 | apply congrArg (fun w : TangentSpace (𝓡 n) (V.baseSquareCurve s) ↦ |
| 147 | Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) (V.baseSquareCurve s) w) |
| 148 | unfold curveVelocityWithin |
| 149 | rw [mfderivWithin_eq_mfderiv (hC.uniqueMDiffOn s hs) |
| 150 | (((hα s (hCU hs)).contMDiffAt (hU.mem_nhds (hCU hs))).mdifferentiableAt (by simp))] |
| 151 | have ht : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓘(ℝ, ℝ)) ∞ (fun s : ℝ ↦ T - s ^ 2) C := |
| 152 | (contDiff_const.sub (contDiff_id.pow 2)).contMDiff.contMDiffOn |
| 153 | have hmem : MapsTo (fun s : ℝ ↦ T - s ^ 2) C J := by |
| 154 | intro s hs |
| 155 | apply p.time_mem |
| 156 | have hs0 : 0 ≤ s := (Real.sqrt_nonneg τ₁).trans hs.1 |
| 157 | constructor |
| 158 | · nlinarith [Real.sq_sqrt p.nonnegative, Real.sqrt_nonneg τ₁, hs.1] |
| 159 | · nlinarith [Real.sq_sqrt (p.nonnegative.trans p.ordered.le), Real.sqrt_nonneg τ₂, hs.2] |
| 160 | exact (movingMetric_pair_contMDiffOn F (fun s : ℝ ↦ T - s ^ 2) V.baseSquareCurve |
| 161 | (curveVelocityWithin (n := n) V.baseSquareCurve C) (variationAccelerationField V D) |
| 162 | ht (hα.mono hCU) hA (variationAccelerationField_contMDiffOn V D hclock) hmem).contDiffOn |
| 163 | |
| 164 | theorem secondVariationBoundaryTerm_eq_accelerationPair {J : Set ℝ} {F : RicciFlow n M J} |
| 165 | {T τ₁ τ₂ : ℝ} {p : BackwardTimePath F T τ₁ τ₂} |
| 166 | (V : LVariation F T τ₁ τ₂ p) (D : LVariationDerivativeData V) : |
| 167 | secondVariationBoundaryTerm V D = |
| 168 | variationAccelerationBoundaryPair V D (Real.sqrt τ₂) - |
| 169 | variationAccelerationBoundaryPair V D (Real.sqrt τ₁) := by |
| 170 | have hleft : Real.sqrt τ₁ ∈ sqrtParameterInterval τ₁ τ₂ := |
| 171 | ⟨le_rfl, Real.sqrt_le_sqrt p.ordered.le⟩ |
| 172 | have hright : Real.sqrt τ₂ ∈ sqrtParameterInterval τ₁ τ₂ := |
| 173 | ⟨Real.sqrt_le_sqrt p.ordered.le, le_rfl⟩ |
| 174 | simp only [secondVariationBoundaryTerm, variationAccelerationBoundaryPair, |
| 175 | variationAccelerationField_eq V D hleft, variationAccelerationField_eq V D hright] |
| 176 | |
| 177 | end PoincareMT.ReducedLengthMinimum.Variation.Geometry |