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.Variational.Regularity.Metric |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Minimum.Variational.Regularity.Action |
| 3 | |
| 4 | /-! |
| 5 | # Derivatives and action identities for chart coefficients |
| 6 | |
| 7 | Adapted from Mapher `Proofs/M08/ChartCoefficients.lean`, commit |
| 8 | `49331b7d7ecad38f53e4300c3b35d6a84b2cc648`. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | set_option backward.isDefEq.respectTransparency false |
| 13 | |
| 14 | open MeasureTheory Set Filter Topology |
| 15 | open scoped Manifold ContDiff Bundle intervalIntegral |
| 16 | |
| 17 | namespace PoincareMT.ReducedLengthMinimum.Variational |
| 18 | |
| 19 | section Derivative |
| 20 | |
| 21 | variable {E H : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 22 | [NormedAddCommGroup H] [NormedSpace ℝ H] |
| 23 | |
| 24 | noncomputable def spatialFDeriv (f : ℝ × E → H) (z : ℝ × E) : E →L[ℝ] H := |
| 25 | (fderiv ℝ f z).comp (ContinuousLinearMap.inr ℝ ℝ E) |
| 26 | |
| 27 | theorem spatialFDeriv_continuousOn {Ω : Set (ℝ × E)} (hΩ : IsOpen Ω) |
| 28 | (f : ℝ × E → H) (hf : ContDiffOn ℝ ∞ f Ω) : |
| 29 | ContinuousOn (spatialFDeriv f) Ω := |
| 30 | (hf.continuousOn_fderiv_of_isOpen hΩ (by simp)).clm_comp continuousOn_const |
| 31 | |
| 32 | theorem hasFDerivAt_spatial {Ω : Set (ℝ × E)} (hΩ : IsOpen Ω) |
| 33 | (f : ℝ × E → H) (hf : ContDiffOn ℝ ∞ f Ω) {s : ℝ} {u : E} |
| 34 | (hu : (s, u) ∈ Ω) : |
| 35 | HasFDerivAt (fun v : E ↦ f (s, v)) (spatialFDeriv f (s, u)) u := by |
| 36 | have hpair : HasFDerivAt (fun v : E ↦ (s, v)) (ContinuousLinearMap.inr ℝ ℝ E) u := by |
| 37 | convert (hasFDerivAt_const s u).prodMk (hasFDerivAt_id u) using 1 <;> ext v <;> simp |
| 38 | exact (((hf (s, u) hu).contDiffAt (hΩ.mem_nhds hu)).differentiableAt (by simp)).hasFDerivAt.comp |
| 39 | u hpair |
| 40 | |
| 41 | end Derivative |
| 42 | |
| 43 | theorem backwardSquareTime_mem_interior {J : Set ℝ} {T τmax τ₁ τ₂ s : ℝ} |
| 44 | (hwindow : Icc (T - τmax) T ⊆ J) (hτ₁ : 0 ≤ τ₁) |
| 45 | (hordered : τ₁ < τ₂) (hτ₂ : τ₂ ≤ τmax) |
| 46 | (hs : s ∈ Ioo (Real.sqrt τ₁) (Real.sqrt τ₂)) : T - s ^ 2 ∈ interior J := by |
| 47 | apply interior_mono hwindow |
| 48 | rw [interior_Icc] |
| 49 | have hpos : 0 < s := (Real.sqrt_nonneg τ₁).trans_lt hs.1 |
| 50 | have hsupper : s ^ 2 < τ₂ := by |
| 51 | simpa only [Real.sq_sqrt (hτ₁.trans hordered.le)] using |
| 52 | (sq_lt_sq₀ hpos.le (Real.sqrt_nonneg τ₂)).mpr hs.2 |
| 53 | constructor <;> nlinarith [sq_pos_of_pos hpos] |
| 54 | |
| 55 | universe uM |
| 56 | |
| 57 | variable {n : ℕ} {M : Type uM} [TopologicalSpace M] |
| 58 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 59 | |
| 60 | noncomputable local instance : NormedAddCommGroup (EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ) := |
| 61 | ContinuousLinearMap.toNormedAddCommGroup |
| 62 | |
| 63 | noncomputable local instance : NormedSpace ℝ (EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ) := |
| 64 | ContinuousLinearMap.toNormedSpace |
| 65 | |
| 66 | noncomputable local instance : |
| 67 | NormedAddCommGroup (EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ) := |
| 68 | ContinuousLinearMap.toNormedAddCommGroup |
| 69 | |
| 70 | noncomputable local instance : |
| 71 | NormedSpace ℝ (EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ) := |
| 72 | ContinuousLinearMap.toNormedSpace |
| 73 | |
| 74 | theorem chart_spatial_coefficient_bounds {J : Set ℝ} (F : RicciFlow n M J) |
| 75 | (T : ℝ) |
| 76 | (hpotential : ContMDiff (𝓘(ℝ, ℝ).prod (𝓡 n)) 𝓘(ℝ, ℝ) ∞ |
| 77 | (fun z : ℝ × M => 2 * z.1 ^ 2 * |
| 78 | (F.connection (T - z.1 ^ 2)).scalarCurvature z.2)) (x : M) {a b : ℝ} |
| 79 | (K : Set (EuclideanSpace ℝ (Fin n))) (hK : IsCompact K) |
| 80 | (hKt : K ⊆ (extChartAt (𝓡 n) x).target) |
| 81 | (htime : ∀ s ∈ Icc a b, s ∈ interior ((fun r : ℝ => T - r ^ 2) ⁻¹' J)) : |
| 82 | ∃ C : ℝ, 0 ≤ C ∧ ∀ s ∈ Icc a b, ∀ v ∈ K, |
| 83 | ‖chartActionMetric F T x (s, v)‖ ≤ C ∧ |
| 84 | ‖spatialFDeriv (chartActionMetric F T x) (s, v)‖ ≤ C ∧ |
| 85 | ‖spatialFDeriv (chartActionPotential F T x) (s, v)‖ ≤ C := by |
| 86 | have hsub : Icc a b ×ˢ K ⊆ chartActionDomain F T x := |
| 87 | fun z hz ↦ ⟨htime z.1 hz.1, hKt hz.2⟩ |
| 88 | have hG := chartActionMetric_contDiffOn F T x |
| 89 | have hV := chartActionPotential_contDiffOn F T hpotential x |
| 90 | have hDG := spatialFDeriv_continuousOn (chartActionDomain_open F T x) _ hG |
| 91 | have hDV := spatialFDeriv_continuousOn (chartActionDomain_open F T x) _ hV |
| 92 | obtain ⟨C₀, hC₀⟩ := (isCompact_Icc.prod hK).exists_bound_of_continuousOn |
| 93 | (f := chartActionMetric F T x) |
| 94 | (hG.continuousOn.mono hsub) |
| 95 | obtain ⟨C₁, hC₁⟩ := (isCompact_Icc.prod hK).exists_bound_of_continuousOn (hDG.mono hsub) |
| 96 | obtain ⟨C₂, hC₂⟩ := (isCompact_Icc.prod hK).exists_bound_of_continuousOn (hDV.mono hsub) |
| 97 | refine ⟨|C₀| + |C₁| + |C₂|, by positivity, ?_⟩ |
| 98 | intro s hs v hv |
| 99 | have h₀ := hC₀ (s, v) ⟨hs, hv⟩ |
| 100 | have h₁ := hC₁ (s, v) ⟨hs, hv⟩ |
| 101 | have h₂ := hC₂ (s, v) ⟨hs, hv⟩ |
| 102 | refine ⟨?_, ?_, ?_⟩ <;> |
| 103 | linarith [le_abs_self C₀, le_abs_self C₁, le_abs_self C₂, |
| 104 | abs_nonneg C₀, abs_nonneg C₁, abs_nonneg C₂] |
| 105 | |
| 106 | theorem chart_contMDiffAt_of_contDiffOn {a b s : ℝ} (hs : s ∈ Ioo a b) |
| 107 | (x : M) (γ : ℝ → M) |
| 108 | (hsrc : MapsTo γ (Icc a b) (chartAt (EuclideanSpace ℝ (Fin n)) x).source) |
| 109 | (hreg : ContDiffOn ℝ 1 ((extChartAt (𝓡 n) x) ∘ γ) (Icc a b)) : |
| 110 | ContMDiffAt (𝓘(ℝ, ℝ)) (𝓡 n) 1 γ s := by |
| 111 | let e := extChartAt (𝓡 n) x |
| 112 | have hsrc' : MapsTo γ (Icc a b) e.source := by |
| 113 | simpa only [e, extChartAt_source] using hsrc |
| 114 | have htarget : MapsTo (e ∘ γ) (Icc a b) e.target := |
| 115 | fun r hr ↦ e.map_source (hsrc' hr) |
| 116 | have hinv := (contMDiffOn_extChartAt_symm (I := 𝓡 n) x).of_le |
| 117 | (by simp : (1 : ℕ∞ω) ≤ ∞) |
| 118 | have hcomp := hinv.comp hreg.contMDiffOn htarget |
| 119 | have hγreg : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) 1 γ (Icc a b) := by |
| 120 | apply hcomp.congr |
| 121 | intro r hr |
| 122 | exact (e.left_inv (hsrc' hr)).symm |
| 123 | exact (hγreg s (Ioo_subset_Icc_self hs)).contMDiffAt (Icc_mem_nhds hs.1 hs.2) |
| 124 | |
| 125 | section Action |
| 126 | |
| 127 | variable {X : Type uM} [MetricSpace X] |
| 128 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) X] [IsManifold (𝓡 n) ∞ X] |
| 129 | |
| 130 | set_option maxHeartbeats 800000 in |
| 131 | -- The identity transports two nested metric operators through the chart inverse. |
| 132 | theorem chartH1Action_eq_coordinate_integral {J : Set ℝ} (F : RicciFlow n X J) |
| 133 | (T : ℝ) |
| 134 | (hpotential : ContMDiff (𝓘(ℝ, ℝ).prod (𝓡 n)) 𝓘(ℝ, ℝ) ∞ |
| 135 | (fun z : ℝ × X => 2 * z.1 ^ 2 * |
| 136 | (F.connection (T - z.1 ^ 2)).scalarCurvature z.2)) {a b : ℝ} (hab : a ≤ b) |
| 137 | (x : X) (ξ : ℝ → X) (hξ : ContinuousOn ξ (Icc a b)) |
| 138 | (hsrc : MapsTo ξ (Icc a b) (chartAt (EuclideanSpace ℝ (Fin n)) x).source) |
| 139 | (htime : ∀ s ∈ Icc a b, T - s ^ 2 ∈ J) |
| 140 | (u : ℝ → EuclideanSpace ℝ (Fin n)) |
| 141 | (hcurve : ∀ s ∈ Icc a b, ξ s = (extChartAt (𝓡 n) x).symm (u s)) |
| 142 | (v : IntervalL2 (EuclideanSpace ℝ (Fin n)) a b) |
| 143 | (d : ℝ → EuclideanSpace ℝ (Fin n)) |
| 144 | (hd : (v : ℝ → EuclideanSpace ℝ (Fin n)) =ᵐ[volume.restrict (Icc a b)] d) : |
| 145 | chartH1Action F T x a b ξ v = |
| 146 | ∫ s in a..b, chartActionMetric F T x (s, u s) (d s) (d s) / 2 + |
| 147 | chartActionPotential F T x (s, u s) := by |
| 148 | let B := fun s ↦ regularizedChartMetric F T x (s, ξ s) |
| 149 | have hB : ContinuousOn B (Icc a b) := |
| 150 | (regularizedChartMetric_continuousOn F T x |
| 151 | (K := (chartAt (EuclideanSpace ℝ (Fin n)) x).source) htime Subset.rfl).comp |
| 152 | (continuousOn_id.prodMk hξ) (fun s hs ↦ ⟨hs, hsrc hs⟩) |
| 153 | have hkin : IntervalIntegrable (fun s ↦ B s (v s) (v s)) volume a b := |
| 154 | (intervalIntegrable_iff_integrableOn_Icc_of_le hab).mpr |
| 155 | (chart_density_integrable B (continuousOn_memLp_top_Icc hB) v) |
| 156 | have hV : ContinuousOn (fun s ↦ |
| 157 | 2 * s ^ 2 * (F.connection (T - s ^ 2)).scalarCurvature (ξ s)) (Icc a b) := |
| 158 | hpotential.continuous.comp_continuousOn (continuousOn_id.prodMk hξ) |
| 159 | rw [chartH1Action, ← intervalIntegral.integral_add hkin (hV.intervalIntegrable_of_Icc hab)] |
| 160 | rw [intervalIntegral.integral_of_le hab, intervalIntegral.integral_of_le hab, |
| 161 | ← integral_Icc_eq_integral_Ioc, ← integral_Icc_eq_integral_Ioc] |
| 162 | apply integral_congr_ae |
| 163 | filter_upwards [hd, ae_restrict_mem measurableSet_Icc] with s hsd hs |
| 164 | rw [hsd] |
| 165 | simp only [B, regularizedChartMetric, ContinuousLinearMap.smul_apply, smul_eq_mul, |
| 166 | hcurve s hs, chartActionMetric, chartActionPotential] |
| 167 | ring |
| 168 | |
| 169 | end Action |
| 170 | |
| 171 | end PoincareMT.ReducedLengthMinimum.Variational |