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.Generalized.ReducedGeometry.SourceNames.Realization |
| 2 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Calculus.Manifold.OpenSubsetChart |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Calculus.Manifold.TrivializationConnection |
| 4 | import Mathlib.Geometry.Manifold.ContMDiffMFDeriv |
| 5 | |
| 6 | /-! |
| 7 | # Connection coordinates on open Euclidean subsets |
| 8 | |
| 9 | The gauge-coordinate calculation for Morgan-Tian Definition 3.36 and |
| 10 | Lemma 6.4, pp. 60-61, 107-108, uses the actual open-subset tangent |
| 11 | coordinates. Coordinate differentiation leaves a tensorial connection |
| 12 | term, evaluated on the constant field with the given pointwise value. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | -- Open-subset tangent fibers carry the ambient vector-space coordinates. |
| 17 | set_option backward.isDefEq.respectTransparency false |
| 18 | |
| 19 | open Set Bundle |
| 20 | open scoped Manifold ContDiff |
| 21 | |
| 22 | namespace TopologicalSpace.Opens |
| 23 | |
| 24 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] (U : Opens E) |
| 25 | |
| 26 | /-- The spatial tangent coordinate of an open Euclidean subset is |
| 27 | smooth; the actual coordinate used in Definition 3.36, pp. 60-61. -/ |
| 28 | theorem tangentBundle_snd_contMDiff : |
| 29 | ContMDiff (𝓘(ℝ, E)).tangent (𝓘(ℝ, E)) ∞ |
| 30 | (fun v : TangentBundle (𝓘(ℝ, E)) U => (show E from v.2)) := by |
| 31 | have hi : ContMDiff (𝓘(ℝ, E)) (𝓘(ℝ, E)) ∞ (Subtype.val : U → E) := |
| 32 | contMDiff_subtype_val |
| 33 | have h := (contMDiff_snd_tangentBundle_modelSpace E (𝓘(ℝ, E)) (n := ∞)).comp |
| 34 | (hi.contMDiff_tangentMap (m := ∞) (by simp)) |
| 35 | convert h using 1 |
| 36 | funext v |
| 37 | dsimp only [Function.comp_def, tangentMap] |
| 38 | rw [PoincareMT.Proofs.M11.mfderiv_openSubtype_val] |
| 39 | rfl |
| 40 | |
| 41 | /-- Every tangent-bundle trivialization of an open Euclidean subset |
| 42 | acts by the ambient identity, as used in Lemma 6.4, pp. 107-108. -/ |
| 43 | theorem tangent_trivialization_apply (x y : U) (v : TangentSpace (𝓘(ℝ, E)) y) : |
| 44 | (trivializationAt E (TangentSpace (𝓘(ℝ, E)) : U → Type _) x).continuousLinearMapAt |
| 45 | ℝ y v = (show E from v) := by |
| 46 | have hy : y ∈ (chartAt E x).source := by |
| 47 | rw [U.chartAt_source_eq_univ] |
| 48 | exact mem_univ y |
| 49 | rw [TangentBundle.continuousLinearMapAt_trivializationAt hy] |
| 50 | change mfderiv (𝓘(ℝ, E)) (𝓘(ℝ, E)) (Subtype.val : U → E) y v = v |
| 51 | rw [PoincareMT.Proofs.M11.mfderiv_openSubtype_val] |
| 52 | rfl |
| 53 | |
| 54 | /-- The inverse tangent trivialization also preserves ambient vectors |
| 55 | on the open spatial subset, Lemma 6.4, pp. 107-108. -/ |
| 56 | theorem tangent_trivialization_symmL_apply (x y : U) (v : E) : |
| 57 | (trivializationAt E (TangentSpace (𝓘(ℝ, E)) : U → Type _) x).symmL ℝ y v = v := by |
| 58 | let e := trivializationAt E (TangentSpace (𝓘(ℝ, E)) : U → Type _) x |
| 59 | have hy : y ∈ e.baseSet := by |
| 60 | change y ∈ (chartAt E x).source |
| 61 | rw [U.chartAt_source_eq_univ] |
| 62 | exact mem_univ y |
| 63 | have h := e.symmL_continuousLinearMapAt (R := ℝ) hy |
| 64 | (show TangentSpace (𝓘(ℝ, E)) y from v) |
| 65 | rw [U.tangent_trivialization_apply] at h |
| 66 | exact h |
| 67 | |
| 68 | /-- Constant ambient vectors give smooth tangent fields on the actual |
| 69 | open spatial subset; the coordinate frames of Lemma 6.4, pp. 107-108. -/ |
| 70 | theorem contMDiff_constant_tangentField (v : E) : |
| 71 | ContMDiff (𝓘(ℝ, E)) (𝓘(ℝ, E)).tangent ∞ |
| 72 | (fun y : U => TotalSpace.mk' E |
| 73 | (E := (TangentSpace (𝓘(ℝ, E)) : U → Type _)) y v) := by |
| 74 | intro x |
| 75 | apply Bundle.contMDiffAt_totalSpace.mpr |
| 76 | refine ⟨contMDiffAt_id, ?_⟩ |
| 77 | convert (contMDiffAt_const (c := v) : |
| 78 | ContMDiffAt (𝓘(ℝ, E)) (𝓘(ℝ, E)) ∞ (fun _ : U => v) x) using 1 |
| 79 | funext y |
| 80 | have hy : y ∈ (trivializationAt E (TangentSpace (𝓘(ℝ, E)) : U → Type _) x).baseSet := by |
| 81 | change y ∈ (chartAt E x).source |
| 82 | rw [U.chartAt_source_eq_univ] |
| 83 | exact mem_univ y |
| 84 | let e := trivializationAt E (TangentSpace (𝓘(ℝ, E)) : U → Type _) x |
| 85 | exact (e.continuousLinearMapAt_apply_of_mem ℝ hy v).symm.trans |
| 86 | (U.tangent_trivialization_apply x y v) |
| 87 | |
| 88 | variable {EP HP P : Type*} [NormedAddCommGroup EP] [NormedSpace ℝ EP] |
| 89 | [TopologicalSpace HP] {L : ModelWithCorners ℝ EP HP} |
| 90 | [TopologicalSpace P] [ChartedSpace HP P] |
| 91 | |
| 92 | /-- Smooth ambient vectors along a map into an open Euclidean subset |
| 93 | give a smooth actual tangent field, including within source points, |
| 94 | as used in the Jacobi construction of Lemmas 6.10 and 6.12, pp. 109-110. -/ |
| 95 | theorem tangentField_contMDiffWithinAt {k : ℕ∞ω} |
| 96 | {b : P → U} {v : P → E} {S : Set P} {z : P} |
| 97 | (hb : ContMDiffWithinAt L (𝓘(ℝ, E)) k b S z) |
| 98 | (hv : ContMDiffWithinAt L (𝓘(ℝ, E)) k v S z) : |
| 99 | ContMDiffWithinAt L (𝓘(ℝ, E)).tangent k |
| 100 | (fun a => TotalSpace.mk' E (E := (TangentSpace (𝓘(ℝ, E)) : U → Type _)) |
| 101 | (b a) (v a)) S z := by |
| 102 | apply Bundle.contMDiffWithinAt_totalSpace.mpr |
| 103 | refine ⟨hb, ?_⟩ |
| 104 | convert hv using 1 |
| 105 | funext a |
| 106 | let e := trivializationAt E (TangentSpace (𝓘(ℝ, E)) : U → Type _) (b z) |
| 107 | have ha : b a ∈ e.baseSet := by |
| 108 | change b a ∈ (chartAt E (b z)).source |
| 109 | rw [U.chartAt_source_eq_univ] |
| 110 | exact mem_univ _ |
| 111 | exact (e.continuousLinearMapAt_apply_of_mem ℝ ha (v a)).symm.trans |
| 112 | (U.tangent_trivialization_apply (b z) (b a) (v a)) |
| 113 | |
| 114 | variable [FiniteDimensional ℝ E] |
| 115 | |
| 116 | /-- A connection on an open Euclidean subset is ordinary coordinate |
| 117 | differentiation plus its value on the constant field through the given |
| 118 | vector; Lemma 6.4, pp. 107-108. -/ |
| 119 | theorem covariantDerivative_eq_derivative_add_constant |
| 120 | {D : (∀ x : U, TangentSpace (𝓘(ℝ, E)) x) → |
| 121 | ∀ x : U, TangentSpace (𝓘(ℝ, E)) x →L[ℝ] TangentSpace (𝓘(ℝ, E)) x} |
| 122 | (hD : IsCovariantDerivativeOn E D univ) |
| 123 | {V : ∀ x : U, TangentSpace (𝓘(ℝ, E)) x} {x : U} |
| 124 | (hV : MDifferentiableAt (𝓘(ℝ, E)) (𝓘(ℝ, E)).tangent (T% V) x) |
| 125 | (v : TangentSpace (𝓘(ℝ, E)) x) : |
| 126 | (show E from D V x v) = |
| 127 | mvfderiv (𝓘(ℝ, E)) (fun y : U => (show E from V y)) x v + |
| 128 | (show E from D (fun _ : U => (show E from V x)) x v) := by |
| 129 | let e := trivializationAt E (TangentSpace (𝓘(ℝ, E)) : U → Type _) x |
| 130 | have hx : x ∈ e.baseSet := mem_baseSet_trivializationAt _ _ x |
| 131 | have hinv (w : E) : e.symmL ℝ x w = w := by |
| 132 | have h := e.symmL_continuousLinearMapAt (R := ℝ) hx |
| 133 | (show TangentSpace (𝓘(ℝ, E)) x from w) |
| 134 | rw [U.tangent_trivialization_apply] at h |
| 135 | exact h |
| 136 | dsimp only [e] at hinv |
| 137 | have hconst := (U.contMDiff_constant_tangentField (V x) x).mdifferentiableAt (by simp) |
| 138 | have h₁ := e.covariantDerivative_eq_flat_add_difference |
| 139 | (hD.mono (subset_univ e.baseSet)) hx hV v |
| 140 | have h₂ := e.covariantDerivative_eq_flat_add_difference |
| 141 | (hD.mono (subset_univ e.baseSet)) hx hconst v |
| 142 | simp only [e, tangent_trivialization_apply] at h₁ h₂ |
| 143 | simp only [mvfderiv_const, zero_apply, hinv, zero_add] at h₁ h₂ |
| 144 | rw [h₁, h₂] |
| 145 | |
| 146 | end TopologicalSpace.Opens |