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