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.Restriction |
| 2 | import PoincareLib.Geometry.CurveShortening.Evolution.CovariantGeometry |
| 3 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Coordinates.ParametricCurveDerivative |
| 4 | |
| 5 | /-! |
| 6 | # Parametric ambient fields restricted to a curve |
| 7 | |
| 8 | The selected-frame chain rule separates explicit parameter change from |
| 9 | the actual ambient connection. This is the parameter calculus in MT2007 |
| 10 | Lemma 19.6, pp. 441-442, and the correction's connection formulas, pp. 2-3. |
| 11 | See `references/ricci-flow/mapher/curve-evolution/derivations/2026-09-19-parametric-restriction.md`. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | set_option maxSynthPendingDepth 3 |
| 16 | set_option backward.isDefEq.respectTransparency false |
| 17 | |
| 18 | open scoped Manifold ContDiff Bundle Topology |
| 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 | /-- The frozen fixed-point time derivative has a genuine derivative witness. |
| 28 | Correction connection formulas (0.1)-(0.2), pp. 2-3. -/ |
| 29 | theorem hasDerivAt_fixedPointTimeDerivative |
| 30 | (W : ℝ → (p : M) → TangentSpace (𝓡 n) p) (p : M) (x : ℝ) |
| 31 | (hW : MDifferentiableAt ((𝓘(ℝ, ℝ)).prod (𝓡 n)) ((𝓡 n).prod (𝓡 n)) |
| 32 | (fun z : ℝ × M ↦ (⟨z.2, W z.1 z.2⟩ : TangentBundle (𝓡 n) M)) (x, p)) : |
| 33 | HasDerivAt (fun r ↦ W r p) (fixedPointTimeDerivative W p x) x := by |
| 34 | let e := trivializationAt (EuclideanSpace ℝ (Fin n)) (TangentSpace (𝓡 n)) p |
| 35 | have hp : p ∈ e.baseSet := FiberBundle.mem_baseSet_trivializationAt' p |
| 36 | let C : ℝ × M → EuclideanSpace ℝ (Fin n) := fun z ↦ (e ⟨z.2, W z.1 z.2⟩).2 |
| 37 | have hC : MDifferentiableAt ((𝓘(ℝ, ℝ)).prod (𝓡 n)) (𝓡 n) C (x, p) := |
| 38 | ((e.mdifferentiableAt_totalSpace_iff (𝓡 n) _ (e.mem_source.mpr hp)).mp hW).2 |
| 39 | have hc : DifferentiableAt ℝ (fun r ↦ C (r, p)) x := |
| 40 | (hC.comp x (mdifferentiableAt_id.prodMk mdifferentiableAt_const)).differentiableAt |
| 41 | have hlin : HasDerivAt (fun r ↦ e.symmL ℝ p (C (r, p))) |
| 42 | (e.symmL ℝ p (deriv (fun r ↦ C (r, p)) x)) x := by |
| 43 | rw [hasDerivAt_iff_hasFDerivAt, hasFDerivAt_iff_isLittleOTVS] |
| 44 | simpa only [Function.comp_def, map_sub, map_smul, |
| 45 | ContinuousLinearMap.toSpanSingleton_apply] using |
| 46 | (e.symmL ℝ p).isBigOTVS_comp.trans_isLittleOTVS hc.hasDerivAt.hasFDerivAt.isLittleOTVS |
| 47 | have hrep : (fun r ↦ e.symmL ℝ p (C (r, p))) = (fun r ↦ W r p) := by |
| 48 | funext r |
| 49 | change e.symmL ℝ p (e ⟨p, W r p⟩).2 = W r p |
| 50 | rw [← e.continuousLinearMapAt_apply_of_mem ℝ hp] |
| 51 | exact e.symmL_continuousLinearMapAt hp _ |
| 52 | rw [hrep] at hlin |
| 53 | exact hlin |
| 54 | |
| 55 | /-- Along-curve differentiation splits into explicit parameter variation |
| 56 | and the actual ambient connection; correction Lemma 0.1, p. 3. -/ |
| 57 | theorem pullback_parametric_field {g : RiemannianMetric n M} |
| 58 | (D : LeviCivitaData g) {γ : ℝ → M} {x : ℝ} |
| 59 | (hγ : MDifferentiableAt (𝓘(ℝ, ℝ)) (𝓡 n) γ x) |
| 60 | (W : ℝ → (p : M) → TangentSpace (𝓡 n) p) |
| 61 | (hW : MDifferentiableAt ((𝓘(ℝ, ℝ)).prod (𝓡 n)) ((𝓡 n).prod (𝓡 n)) |
| 62 | (fun z : ℝ × M ↦ (⟨z.2, W z.1 z.2⟩ : TangentBundle (𝓡 n) M)) (x, γ x)) : |
| 63 | rampHorizontalCovariantDerivative D γ (fun r ↦ W r (γ r)) x = |
| 64 | fixedPointTimeDerivative W (γ x) x + |
| 65 | D.connection (W x) (γ x) (curveVelocity γ x) := by |
| 66 | let e := trivializationAt (EuclideanSpace ℝ (Fin n)) (TangentSpace (𝓡 n)) (γ x) |
| 67 | have hp : γ x ∈ e.baseSet := FiberBundle.mem_baseSet_trivializationAt' (γ x) |
| 68 | let C : ℝ × M → EuclideanSpace ℝ (Fin n) := fun z ↦ (e ⟨z.2, W z.1 z.2⟩).2 |
| 69 | have hC : MDifferentiableAt ((𝓘(ℝ, ℝ)).prod (𝓡 n)) (𝓡 n) C (x, γ x) := |
| 70 | ((e.mdifferentiableAt_totalSpace_iff (𝓡 n) _ (e.mem_source.mpr hp)).mp hW).2 |
| 71 | have hsplit := PoincareMT.ReducedLength.hasDerivAt_parametric_curve C γ x hC hγ |
| 72 | have hCs : MDifferentiableAt (𝓡 n) (𝓡 n) (fun p ↦ C (x, p)) (γ x) := |
| 73 | hC.comp (γ x) (mdifferentiableAt_const.prodMk mdifferentiableAt_id) |
| 74 | have hspatial : HasDerivAt (fun r ↦ C (x, γ r)) |
| 75 | (mvfderiv (𝓡 n) (fun p ↦ C (x, p)) (γ x) (curveVelocity γ x)) x := |
| 76 | (hCs.hasMFDerivAt.comp x hγ.hasMFDerivAt).hasFDerivAt.hasDerivAt |
| 77 | have hWs : MDifferentiableAt (𝓡 n) ((𝓡 n).prod (𝓡 n)) |
| 78 | (fun p ↦ (⟨p, W x p⟩ : TangentBundle (𝓡 n) M)) (γ x) := |
| 79 | hW.comp (γ x) (mdifferentiableAt_const.prodMk mdifferentiableAt_id) |
| 80 | rw [← pullback_ambient_field D hγ (W x) hWs] |
| 81 | change e.symmL ℝ (γ x) (deriv (fun r ↦ C (r, γ r)) x) + |
| 82 | D.connection (FiberBundle.extend (EuclideanSpace ℝ (Fin n)) (W x (γ x))) |
| 83 | (γ x) (curveVelocity γ x) = |
| 84 | e.symmL ℝ (γ x) (deriv (fun r ↦ C (r, γ x)) x) + |
| 85 | (e.symmL ℝ (γ x) (deriv (fun r ↦ C (x, γ r)) x) + |
| 86 | D.connection (FiberBundle.extend (EuclideanSpace ℝ (Fin n)) (W x (γ x))) |
| 87 | (γ x) (curveVelocity γ x)) |
| 88 | rw [hsplit.deriv, hspatial.deriv, map_add, add_assoc] |
| 89 | |
| 90 | end PoincareMT.M62 |