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 Mathlib.Geometry.Manifold.VectorBundle.CovariantDerivative.Basic |
| 2 | |
| 3 | /-! |
| 4 | # A covariant derivative in a vector bundle chart |
| 5 | |
| 6 | Coordinate differentiation defines a flat connection on a trivialization's |
| 7 | base set. Mathlib's tensorial connection difference then represents any |
| 8 | connection as that derivative plus a pointwise linear term. This is the |
| 9 | coordinate step in the pullback calculus of Morgan-Tian Lemma 6.4, |
| 10 | pp. 107-108; see `2026-09-21-pullback-coordinates.md` in the M14 derivations. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open Bundle Set Filter |
| 16 | open scoped Manifold ContDiff Topology |
| 17 | |
| 18 | variable {𝕜 E H M F : Type*} [NontriviallyNormedField 𝕜] |
| 19 | [NormedAddCommGroup E] [NormedSpace 𝕜 E] |
| 20 | [TopologicalSpace H] {I : ModelWithCorners 𝕜 E H} |
| 21 | [TopologicalSpace M] [ChartedSpace H M] |
| 22 | [NormedAddCommGroup F] [NormedSpace 𝕜 F] |
| 23 | {V : M → Type*} [TopologicalSpace (TotalSpace F V)] |
| 24 | [∀ x, AddCommGroup (V x)] [∀ x, Module 𝕜 (V x)] |
| 25 | [∀ x, TopologicalSpace (V x)] [FiberBundle F V] |
| 26 | [VectorBundle 𝕜 F V] [ContMDiffVectorBundle 1 F V I] |
| 27 | |
| 28 | namespace Bundle.Trivialization |
| 29 | |
| 30 | variable (e : Trivialization F (TotalSpace.proj : TotalSpace F V → M)) |
| 31 | [MemTrivializationAtlas e] |
| 32 | |
| 33 | /-- Coordinates of a differentiable section are differentiable on the |
| 34 | chart's base set, in the calculation for Lemma 6.4, pp. 107-108. -/ |
| 35 | theorem mdifferentiableAt_continuousLinearMapAt_section |
| 36 | {σ : ∀ x, V x} {x : M} (hx : x ∈ e.baseSet) |
| 37 | (hσ : MDifferentiableAt I (I.prod 𝓘(𝕜, F)) (T% σ) x) : |
| 38 | MDifferentiableAt I 𝓘(𝕜, F) |
| 39 | (fun p => e.continuousLinearMapAt 𝕜 p (σ p)) x := by |
| 40 | have h := (e.mdifferentiableAt_section_iff I σ hx).mp hσ |
| 41 | apply h.congr_of_eventuallyEq |
| 42 | filter_upwards [e.open_baseSet.mem_nhds hx] with p hp |
| 43 | exact e.continuousLinearMapAt_apply_of_mem 𝕜 hp (σ p) |
| 44 | |
| 45 | /-- The flat derivative defined by a bundle chart, meaningful as a |
| 46 | connection on its base set; Lemma 6.4, pp. 107-108. -/ |
| 47 | noncomputable def flatCovariantDerivative (σ : ∀ x, V x) (x : M) : |
| 48 | TangentSpace I x →L[𝕜] V x := |
| 49 | (e.symmL 𝕜 x).comp |
| 50 | (mvfderiv I (fun p => e.continuousLinearMapAt 𝕜 p (σ p)) x) |
| 51 | |
| 52 | variable [∀ x, IsTopologicalAddGroup (V x)] [∀ x, ContinuousSMul 𝕜 (V x)] |
| 53 | |
| 54 | /-- Coordinate differentiation satisfies the connection sum and Leibniz |
| 55 | laws on the chart's open base set; Lemma 6.4, pp. 107-108. -/ |
| 56 | theorem isCovariantDerivativeOn_flatCovariantDerivative : |
| 57 | IsCovariantDerivativeOn F (e.flatCovariantDerivative (I := I)) e.baseSet where |
| 58 | add hσ hτ hx := by |
| 59 | have hσc := e.mdifferentiableAt_continuousLinearMapAt_section hx hσ |
| 60 | have hτc := e.mdifferentiableAt_continuousLinearMapAt_section hx hτ |
| 61 | ext v |
| 62 | simp only [flatCovariantDerivative, Pi.add_apply, map_add, |
| 63 | mvfderiv_fun_add hσc hτc, ContinuousLinearMap.comp_apply, add_apply] |
| 64 | leibniz := by |
| 65 | intro σ f x hσ hf hx |
| 66 | have hσc := e.mdifferentiableAt_continuousLinearMapAt_section hx hσ |
| 67 | ext v |
| 68 | simp only [flatCovariantDerivative, Pi.smul_apply', map_smul, |
| 69 | mvfderiv_fun_smul hf hσc, ContinuousLinearMap.comp_apply, add_apply, |
| 70 | smul_apply, ContinuousLinearMap.smulRight_apply, map_add] |
| 71 | rw [e.symmL_continuousLinearMapAt hx] |
| 72 | |
| 73 | variable [CompleteSpace 𝕜] [FiniteDimensional 𝕜 F] |
| 74 | |
| 75 | /-- In bundle coordinates an actual covariant derivative is ordinary |
| 76 | differentiation plus its tensorial difference from the chart connection; |
| 77 | Lemma 6.4, pp. 107-108. -/ |
| 78 | theorem covariantDerivative_eq_flat_add_difference |
| 79 | {cov : (∀ x, V x) → ∀ x, TangentSpace I x →L[𝕜] V x} |
| 80 | (hcov : IsCovariantDerivativeOn F cov e.baseSet) |
| 81 | {σ : ∀ x, V x} {x : M} (hx : x ∈ e.baseSet) |
| 82 | (hσ : MDifferentiableAt I (I.prod 𝓘(𝕜, F)) (T% σ) x) |
| 83 | (v : TangentSpace I x) : |
| 84 | cov σ x v = |
| 85 | e.symmL 𝕜 x (mvfderiv I (fun p => e.continuousLinearMapAt 𝕜 p (σ p)) x v) + |
| 86 | hcov.difference e.isCovariantDerivativeOn_flatCovariantDerivative x (σ x) v := by |
| 87 | rw [IsCovariantDerivativeOn.difference_apply hcov |
| 88 | e.isCovariantDerivativeOn_flatCovariantDerivative hx hσ] |
| 89 | simp only [sub_apply, flatCovariantDerivative, ContinuousLinearMap.comp_apply] |
| 90 | abel |
| 91 | |
| 92 | end Bundle.Trivialization |