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.Pullback |
| 2 | |
| 3 | /-! |
| 4 | # Ambient fields restricted to a parameter curve |
| 5 | |
| 6 | The frozen pullback derivative agrees with the actual ambient connection |
| 7 | on differentiable ambient restrictions. The test-field argument uses the |
| 8 | selected frozen frame and actual metric compatibility, as in Morgan--Tian |
| 9 | Lemma 19.6, pp. 441-442, and the correction's connection calculus, pp. 2-3. |
| 10 | See `references/ricci-flow/mapher/curve-evolution/derivations/2026-09-19-pullback-restriction.md`. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | set_option maxSynthPendingDepth 3 |
| 15 | set_option backward.isDefEq.respectTransparency false |
| 16 | |
| 17 | open scoped Manifold ContDiff Bundle Topology |
| 18 | open Filter |
| 19 | |
| 20 | universe u |
| 21 | |
| 22 | namespace PoincareMT.M62 |
| 23 | |
| 24 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 25 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 26 | |
| 27 | /-- A frozen extension has constant coefficients along a continuous curve |
| 28 | near the chosen parameter; correction connection calculus, pp. 2-3. -/ |
| 29 | theorem pullback_frozen_extension {g : RiemannianMetric n M} |
| 30 | (D : LeviCivitaData g) {γ : ℝ → M} {x : ℝ} |
| 31 | (hγ : ContinuousAt γ x) (v : TangentSpace (𝓡 n) (γ x)) : |
| 32 | rampHorizontalCovariantDerivative D γ |
| 33 | (fun s ↦ FiberBundle.extend (EuclideanSpace ℝ (Fin n)) v (γ s)) x = |
| 34 | D.connection (FiberBundle.extend (EuclideanSpace ℝ (Fin n)) v) |
| 35 | (γ x) (curveVelocity γ x) := by |
| 36 | let e := trivializationAt (EuclideanSpace ℝ (Fin n)) (TangentSpace (𝓡 n)) (γ x) |
| 37 | have hnear : ∀ᶠ s in 𝓝 x, γ s ∈ e.baseSet := |
| 38 | hγ (e.open_baseSet.mem_nhds (FiberBundle.mem_baseSet_trivializationAt' (γ x))) |
| 39 | have heq : (fun s ↦ (e ⟨γ s, FiberBundle.extend (EuclideanSpace ℝ (Fin n)) v (γ s)⟩).2) |
| 40 | =ᶠ[𝓝 x] (fun _ : ℝ ↦ (e ⟨γ x, v⟩).2) := by |
| 41 | filter_upwards [hnear] with s hs |
| 42 | change (e ⟨γ s, e.symm (γ s) (e ⟨γ x, v⟩).2⟩).2 = (e ⟨γ x, v⟩).2 |
| 43 | simpa only using congrArg Prod.snd (e.apply_mk_symm hs (e ⟨γ x, v⟩).2) |
| 44 | simp only [rampHorizontalCovariantDerivative, FiberBundle.extend_apply_self] |
| 45 | change e.symmL ℝ (γ x) |
| 46 | (deriv (fun s ↦ (e ⟨γ s, FiberBundle.extend (EuclideanSpace ℝ (Fin n)) v (γ s)⟩).2) x) + |
| 47 | D.connection (FiberBundle.extend (EuclideanSpace ℝ (Fin n)) v) |
| 48 | (γ x) (curveVelocity γ x) = _ |
| 49 | rw [heq.deriv_eq, deriv_const, map_zero, zero_add] |
| 50 | |
| 51 | /-- Restricting a differentiable ambient field gives its actual connection |
| 52 | derivative; MT2007 Lemma 19.6, pp. 441-442, and correction Lemma 0.1, p. 3. -/ |
| 53 | theorem pullback_ambient_field {g : RiemannianMetric n M} |
| 54 | (D : LeviCivitaData g) {γ : ℝ → M} {x : ℝ} |
| 55 | (hγ : MDifferentiableAt (𝓘(ℝ, ℝ)) (𝓡 n) γ x) |
| 56 | (W : (p : M) → TangentSpace (𝓡 n) p) |
| 57 | (hW : MDifferentiableAt (𝓡 n) ((𝓡 n).prod (𝓡 n)) |
| 58 | (fun p ↦ (⟨p, W p⟩ : TangentBundle (𝓡 n) M)) (γ x)) : |
| 59 | rampHorizontalCovariantDerivative D γ (fun s ↦ W (γ s)) x = |
| 60 | D.connection W (γ x) (curveVelocity γ x) := by |
| 61 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 62 | ⟨g.toRiemannianMetric⟩ |
| 63 | by_contra hne |
| 64 | let A := rampHorizontalCovariantDerivative D γ (fun s ↦ W (γ s)) x |
| 65 | let B := D.connection W (γ x) (curveVelocity γ x) |
| 66 | let v := A - B |
| 67 | let Z := FiberBundle.extend (EuclideanSpace ℝ (Fin n)) v |
| 68 | have hZ : MDifferentiableAt (𝓡 n) ((𝓡 n).prod (𝓡 n)) |
| 69 | (fun p ↦ (⟨p, Z p⟩ : TangentBundle (𝓡 n) M)) (γ x) := |
| 70 | FiberBundle.mdifferentiableAt_extend (𝓡 n) (EuclideanSpace ℝ (Fin n)) v |
| 71 | have hZx : Z (γ x) = v := FiberBundle.extend_apply_self _ _ |
| 72 | have hpair : MDifferentiableAt (𝓡 n) ((𝓡 n).prod (𝓘(ℝ, ℝ))) |
| 73 | (fun p ↦ Bundle.TotalSpace.mk' ℝ (E := Bundle.Trivial M ℝ) p |
| 74 | (g.inner p (W p) (Z p))) (γ x) := |
| 75 | ((g.contMDiff (γ x)).mdifferentiableAt (by simp)).clm_bundle_apply₂ hW hZ |
| 76 | have hf : MDifferentiableAt (𝓡 n) (𝓘(ℝ, ℝ)) |
| 77 | (fun p ↦ g.inner p (W p) (Z p)) (γ x) := by |
| 78 | rw [mdifferentiableAt_totalSpace] at hpair |
| 79 | exact hpair.2 |
| 80 | have hchain : HasDerivAt (fun s ↦ g.inner (γ s) (W (γ s)) (Z (γ s))) |
| 81 | (mvfderiv (𝓡 n) (fun p ↦ g.inner p (W p) (Z p)) (γ x) (curveVelocity γ x)) x := |
| 82 | (hf.hasMFDerivAt.comp x hγ.hasMFDerivAt).hasFDerivAt.hasDerivAt |
| 83 | have hcompat := D.metricCompatible.mvfderiv_inner_eq |
| 84 | (FiberBundle.extend (EuclideanSpace ℝ (Fin n)) (curveVelocity γ x)) hW hZ |
| 85 | have hvalue : mvfderiv (𝓡 n) (fun p ↦ g.inner p (W p) (Z p)) (γ x) |
| 86 | (curveVelocity γ x) = |
| 87 | g.inner (γ x) B (Z (γ x)) + |
| 88 | g.inner (γ x) (W (γ x)) (D.connection Z (γ x) (curveVelocity γ x)) := by |
| 89 | simpa only [FiberBundle.extend_apply_self] using! hcompat |
| 90 | have hpull := hasDerivAt_metric_pairing D hγ (hW.comp x hγ) (hZ.comp x hγ) |
| 91 | have heq := hpull.unique hchain |
| 92 | rw [pullback_frozen_extension D hγ.continuousAt v, hvalue, hZx] at heq |
| 93 | have hz : g.inner (γ x) v v = 0 := by |
| 94 | change g.inner (γ x) (A - B) v = 0 |
| 95 | simp only [map_sub, sub_apply] |
| 96 | exact sub_eq_zero.mpr (add_right_cancel heq) |
| 97 | exact ((g.pos (γ x) v (sub_ne_zero.mpr hne)).ne') hz |
| 98 | |
| 99 | end PoincareMT.M62 |