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.CurveShortening.Connection.Variation |
| 2 | import PoincareLib.Geometry.RicciFlow.CurveShortening.Connection.TangentPhaseZero |
| 3 | |
| 4 | /-! |
| 5 | # Regularity of the moving spatial pullback |
| 6 | |
| 7 | The actual pullback is additive on differentiable fields, and its spatial |
| 8 | derivative along a smooth parameter family is a smooth actual bundled |
| 9 | field. These justify iterated differentiation in MT2015Correction |
| 10 | Lemma 0.2, pp. 4-6. See `references/ricci-flow/mapher/curve-evolution/derivations/2026-09-20-moving-pullback.md`. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | set_option backward.isDefEq.respectTransparency false |
| 15 | |
| 16 | open Bundle Manifold Set Topology Filter |
| 17 | open scoped Manifold ContDiff Bundle |
| 18 | |
| 19 | noncomputable section |
| 20 | |
| 21 | namespace PoincareMT.M62 |
| 22 | |
| 23 | variable {n : ℕ} {M : Type*} [TopologicalSpace M] |
| 24 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 25 | {J : Set ℝ} |
| 26 | |
| 27 | /-- Additivity retains both genuine differentiability premises for the |
| 28 | frozen pullback; MT2015Correction Lemma 0.2, pp. 4-6. -/ |
| 29 | theorem pullback_add {g : RiemannianMetric n M} |
| 30 | (D : LeviCivitaData g) {gamma : ℝ → M} |
| 31 | {Y Z : (r : ℝ) → TangentSpace (𝓡 n) (gamma r)} {x : ℝ} |
| 32 | (hY : MDifferentiableAt 𝓘(ℝ, ℝ) (𝓡 n).tangent |
| 33 | (fun r => (⟨gamma r, Y r⟩ : TangentBundle (𝓡 n) M)) x) |
| 34 | (hZ : MDifferentiableAt 𝓘(ℝ, ℝ) (𝓡 n).tangent |
| 35 | (fun r => (⟨gamma r, Z r⟩ : TangentBundle (𝓡 n) M)) x) : |
| 36 | rampHorizontalCovariantDerivative D gamma (fun r => Y r + Z r) x = |
| 37 | rampHorizontalCovariantDerivative D gamma Y x + |
| 38 | rampHorizontalCovariantDerivative D gamma Z x := by |
| 39 | let e := trivializationAt (EuclideanSpace ℝ (Fin n)) (TangentSpace (𝓡 n)) (gamma x) |
| 40 | let y : ℝ → EuclideanSpace ℝ (Fin n) := fun r => (e ⟨gamma r, Y r⟩).2 |
| 41 | let z : ℝ → EuclideanSpace ℝ (Fin n) := fun r => (e ⟨gamma r, Z r⟩).2 |
| 42 | rw [mdifferentiableAt_totalSpace] at hY hZ |
| 43 | have hy : DifferentiableAt ℝ y x := hY.2.differentiableAt |
| 44 | have hz : DifferentiableAt ℝ z x := hZ.2.differentiableAt |
| 45 | have hnear : ∀ᶠ r in 𝓝 x, gamma r ∈ e.baseSet := |
| 46 | hY.1.continuousAt (e.open_baseSet.mem_nhds |
| 47 | (FiberBundle.mem_baseSet_trivializationAt' (gamma x))) |
| 48 | have heq : (fun r => (e ⟨gamma r, Y r + Z r⟩).2) =ᶠ[𝓝 x] (fun r => y r + z r) := by |
| 49 | filter_upwards [hnear] with r hr |
| 50 | change (e ⟨gamma r, Y r + Z r⟩).2 = (e ⟨gamma r, Y r⟩).2 + (e ⟨gamma r, Z r⟩).2 |
| 51 | rw [← e.continuousLinearMapAt_apply_of_mem ℝ hr, |
| 52 | ← e.continuousLinearMapAt_apply_of_mem ℝ hr, |
| 53 | ← e.continuousLinearMapAt_apply_of_mem ℝ hr, map_add] |
| 54 | let A := PoincareMT.ReducedLengthMinimum.Variation.Geometry.frozenConnectionEndomorphism D (gamma x) |
| 55 | (curveVelocity gamma x) |
| 56 | change e.symmL ℝ (gamma x) (deriv (fun r => (e ⟨gamma r, Y r + Z r⟩).2) x) + |
| 57 | A (Y x + Z x) = |
| 58 | (e.symmL ℝ (gamma x) (deriv y x) + A (Y x)) + |
| 59 | (e.symmL ℝ (gamma x) (deriv z x) + A (Z x)) |
| 60 | rw [heq.deriv_eq, deriv_fun_add hy hz, map_add, map_add] |
| 61 | abel |
| 62 | |
| 63 | /-- The actual moving spatial pullback is a smooth bundled field on the |
| 64 | open parameter domain; MT2015Correction Lemma 0.2, pp. 4-6. -/ |
| 65 | theorem flow_pullback_space_smooth [T2Space M] |
| 66 | (F : RicciFlow n M J) (c : ℝ → ℝ → M) |
| 67 | (Y : (z : ℝ × ℝ) → TangentSpace (𝓡 n) (c z.1 z.2)) |
| 68 | {Omega : Set (ℝ × ℝ)} (hOmega : IsOpen Omega) |
| 69 | (hTime : ∀ z ∈ Omega, z.2 ∈ interior J) |
| 70 | (hc : ContMDiffOn 𝓘(ℝ, ℝ × ℝ) (𝓡 n) ∞ |
| 71 | (fun z : ℝ × ℝ => c z.1 z.2) Omega) |
| 72 | (hY : ContMDiffOn 𝓘(ℝ, ℝ × ℝ) (𝓡 n).tangent ∞ |
| 73 | (fun z => (⟨c z.1 z.2, Y z⟩ : TangentBundle (𝓡 n) M)) Omega) : |
| 74 | ContMDiffOn 𝓘(ℝ, ℝ × ℝ) (𝓡 n).tangent ∞ |
| 75 | (fun z : ℝ × ℝ => (⟨c z.1 z.2, |
| 76 | rampHorizontalCovariantDerivative (F.connection z.2) (fun s => c s z.2) |
| 77 | (fun s => Y (s, z.2)) z.1⟩ : TangentBundle (𝓡 n) M)) Omega := by |
| 78 | intro z0 hz0 |
| 79 | let E := EuclideanSpace ℝ (Fin n) |
| 80 | let : NormedAddCommGroup (E →L[ℝ] E) := ContinuousLinearMap.toNormedAddCommGroup |
| 81 | let : NormedSpace ℝ (E →L[ℝ] E) := ContinuousLinearMap.toNormedSpace |
| 82 | let : NormedAddCommGroup (E →L[ℝ] E →L[ℝ] E) := ContinuousLinearMap.toNormedAddCommGroup |
| 83 | let : NormedSpace ℝ (E →L[ℝ] E →L[ℝ] E) := ContinuousLinearMap.toNormedSpace |
| 84 | let p := c z0.1 z0.2 |
| 85 | let e := chartAt E p |
| 86 | let U := Omega ∩ (fun z : ℝ × ℝ => c z.1 z.2) ⁻¹' e.source |
| 87 | have hU : IsOpen U := hc.continuousOn.isOpen_inter_preimage hOmega e.open_source |
| 88 | have hbase : p ∈ e.source := mem_chart_source E p |
| 89 | have hzU : z0 ∈ U := ⟨hz0, hbase⟩ |
| 90 | have he : ContMDiffOn (𝓡 n) (𝓡 n) ∞ e e.source := contMDiffOn_chart |
| 91 | have hi : ContMDiffOn (𝓡 n) (𝓡 n) ∞ e.symm e.target := contMDiffOn_chart_symm |
| 92 | let q : ℝ × ℝ → E := fun z => e (c z.1 z.2) |
| 93 | let W : ℝ × ℝ → E := fun z => mfderiv (𝓡 n) (𝓡 n) e (c z.1 z.2) (Y z) |
| 94 | let Gamma : ℝ × E → E →L[ℝ] E →L[ℝ] E := |
| 95 | fun z => RicciFlowAnalysis.shiChartChristoffel (F.connection z.1) e z.2 |
| 96 | let V : ℝ × ℝ → E := fun z => ReducedLengthMinimum.Variation.Geometry.coordinatePartialS W z + |
| 97 | Gamma (z.2, q z) (ReducedLengthMinimum.Variation.Geometry.coordinatePartialS q z) (W z) |
| 98 | let A := fun z : ℝ × ℝ => rampHorizontalCovariantDerivative (F.connection z.2) |
| 99 | (fun s => c s z.2) (fun s => Y (s, z.2)) z.1 |
| 100 | have hq : ContDiffOn ℝ ∞ q U := |
| 101 | (he.comp (hc.mono inter_subset_left) (fun z hz => hz.2)).contDiffOn |
| 102 | have hW : ContDiffOn ℝ ∞ W U := by |
| 103 | have h := (PoincareMT.ReducedLengthMinimum.Variation.Geometry.tangentChartPhase_contMDiffOn p).comp |
| 104 | (hY.mono inter_subset_left) (fun z hz => hz.2) |
| 105 | exact h.contDiffOn.snd |
| 106 | have hGamma : ContDiffOn ℝ ∞ Gamma (J ×ˢ e.target) := flow_chartChristoffel_smooth F p |
| 107 | have hcoeff : ContDiffOn ℝ ∞ (fun z : ℝ × ℝ => Gamma (z.2, q z)) U := |
| 108 | hGamma.comp (contDiffOn_snd.prodMk hq) |
| 109 | (fun z hz => ⟨interior_subset (hTime z hz.1), e.map_source hz.2⟩) |
| 110 | have hV : ContDiffOn ℝ ∞ V U := |
| 111 | (ReducedLengthMinimum.Variation.Geometry.coordinatePartialS_contDiffOn hU W hW).add |
| 112 | ((hcoeff.clm_apply (ReducedLengthMinimum.Variation.Geometry.coordinatePartialS_contDiffOn hU q hq)).clm_apply hW) |
| 113 | have hcoords (z : ℝ × ℝ) (hz : z ∈ U) : |
| 114 | mfderiv (𝓡 n) (𝓡 n) e (c z.1 z.2) (A z) = V z := by |
| 115 | have hslice : MDifferentiableAt 𝓘(ℝ, ℝ) 𝓘(ℝ, ℝ × ℝ) |
| 116 | (fun s : ℝ => (s, z.2)) z.1 := |
| 117 | (differentiableAt_id.prodMk (differentiableAt_const z.2)).mdifferentiableAt |
| 118 | have hcurve : MDifferentiableAt 𝓘(ℝ, ℝ) (𝓡 n) (fun s => c s z.2) z.1 := by |
| 119 | simpa only [Function.comp_def] using |
| 120 | ((hc.contMDiffAt (hOmega.mem_nhds hz.1)).mdifferentiableAt (by simp)).comp z.1 hslice |
| 121 | let B := (fun s : ℝ => (s, z.2)) ⁻¹' U |
| 122 | have hB : IsOpen B := hU.preimage (continuous_id.prodMk continuous_const) |
| 123 | have hcongr := pullback_congr (F.connection z.2) (γ := fun s => c s z.2) |
| 124 | (Y := fun s => Y (s, z.2)) |
| 125 | (Z := fun s => PoincareMT.ReducedLengthMinimum.Variation.Geometry.chartVectorField p (W (s, z.2)) (c s z.2)) |
| 126 | (x := z.1) (by |
| 127 | filter_upwards [hB.mem_nhds hz] with s hs |
| 128 | exact (PoincareMT.ReducedLengthMinimum.Variation.Geometry.chartVectorField_differential p _ _ hs.2).symm) |
| 129 | change mfderiv (𝓡 n) (𝓡 n) e (c z.1 z.2) |
| 130 | (rampHorizontalCovariantDerivative (F.connection z.2) (fun s => c s z.2) |
| 131 | (fun s => Y (s, z.2)) z.1) = _ |
| 132 | rw [hcongr, pullback_chart_field_coordinates (F.connection z.2) p |
| 133 | (gamma := fun s => c s z.2) (x := z.1) hcurve hz.2 hB hz |
| 134 | (fun s => W (s, z.2)) |
| 135 | (hW.comp (contDiffOn_id.prodMk contDiffOn_const) (fun s hs => hs))] |
| 136 | rw [(ReducedLengthMinimum.Variation.Geometry.coordinateSlice_fst_hasDerivAt W |
| 137 | ((hW.contDiffAt (hU.mem_nhds hz)).differentiableAt (by simp))).deriv] |
| 138 | have hvelocity := PoincareMT.ReducedLength.chartVectorField_coordinate_velocity p |
| 139 | (fun s => c s z.2) z.1 (ReducedLengthMinimum.Variation.Geometry.coordinatePartialS q z) hz.2 hcurve |
| 140 | (ReducedLengthMinimum.Variation.Geometry.coordinateSlice_fst_hasDerivAt q |
| 141 | ((hq.contDiffAt (hU.mem_nhds hz)).differentiableAt (by simp))) |
| 142 | rw [← hvelocity] |
| 143 | erw [RicciFlowAnalysis.shiChartField_duality he hi hz.2] |
| 144 | rfl |
| 145 | have hphase := (PoincareMT.ReducedLengthMinimum.Variation.Geometry.inverseTangentChartPhase_contMDiffOn p).comp |
| 146 | (hq.prodMk hV).contMDiffOn (fun z hz => ⟨e.map_source hz.2, mem_univ _⟩) |
| 147 | have hactual : ContMDiffOn 𝓘(ℝ, ℝ × ℝ) (𝓡 n).tangent ∞ |
| 148 | (fun z => (⟨c z.1 z.2, A z⟩ : TangentBundle (𝓡 n) M)) U := by |
| 149 | apply hphase.congr |
| 150 | intro z hz |
| 151 | change (⟨c z.1 z.2, A z⟩ : TangentBundle (𝓡 n) M) = |
| 152 | PoincareMT.ReducedLengthMinimum.Variation.Geometry.inverseTangentChartPhase p (q z, V z) |
| 153 | rw [← hcoords z hz] |
| 154 | exact (PoincareMT.ReducedLengthMinimum.Variation.Geometry.tangentChartPhase_inverse p |
| 155 | (⟨c z.1 z.2, A z⟩ : TangentBundle (𝓡 n) M) hz.2).symm |
| 156 | exact (hactual.contMDiffAt (hU.mem_nhds hzU)).contMDiffWithinAt |
| 157 | |
| 158 | end PoincareMT.M62 |