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.Spacetime.Horizontal.Basic |
| 2 | |
| 3 | /-! |
| 4 | # The time bracket preserves horizontal fields |
| 5 | |
| 6 | The calculation is performed within the model range, including boundary |
| 7 | points. The time derivatives of the normalized time vector and a horizontal |
| 8 | field are constant, so their scalar commutator vanishes. |
| 9 | |
| 10 | Source: Morgan-Tian, Definitions 3.34-3.36, pp. 59-60. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | set_option backward.isDefEq.respectTransparency false |
| 15 | |
| 16 | open scoped Manifold ContDiff Bundle Topology |
| 17 | open Set Filter |
| 18 | |
| 19 | namespace PoincareMT |
| 20 | |
| 21 | private theorem bracket_annihilates_of_constant_derivatives |
| 22 | {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] |
| 23 | {H : Type*} [TopologicalSpace H] {J : ModelWithCorners ℝ E H} |
| 24 | {M : Type*} [TopologicalSpace M] [ChartedSpace H M] [IsManifold J ∞ M] |
| 25 | {f : M → ℝ} (hf : ContMDiff J 𝓘(ℝ) ∞ f) |
| 26 | (A B : (p : M) → TangentSpace J p) (a b : ℝ) |
| 27 | (hA : ∀ p, mfderiv J 𝓘(ℝ) f p (A p) = a) |
| 28 | (hB : ∀ p, mfderiv J 𝓘(ℝ) f p (B p) = b) |
| 29 | (p : M) |
| 30 | (hAd : MDifferentiableAt J (J.prod 𝓘(ℝ, E)) (T% A) p) |
| 31 | (hBd : MDifferentiableAt J (J.prod 𝓘(ℝ, E)) (T% B) p) : |
| 32 | mfderiv J 𝓘(ℝ) f p (VectorField.mlieBracket J A B p) = 0 := by |
| 33 | have : IsManifold J (minSmoothness ℝ 2) M := by |
| 34 | simp only [minSmoothness_of_isRCLikeNormedField] |
| 35 | infer_instance |
| 36 | let e := extChartAt J p |
| 37 | let g : E → ℝ := f ∘ e.symm |
| 38 | let V := VectorField.mpullbackWithin 𝓘(ℝ, E) J e.symm A (range J) |
| 39 | let W := VectorField.mpullbackWithin 𝓘(ℝ, E) J e.symm B (range J) |
| 40 | have hmem : e p ∈ e.target := mem_extChartAt_target p |
| 41 | have hrange : e p ∈ range J := extChartAt_target_subset_range p hmem |
| 42 | have hpe : e.symm (e p) = p := e.left_inv (mem_extChartAt_source p) |
| 43 | have hg : ContDiffWithinAt ℝ ∞ g (range J) (e p) := |
| 44 | ((hf p).comp_contMDiffWithinAt_of_eq |
| 45 | (contMDiffWithinAt_extChartAt_symm_range p hmem) hpe).contDiffWithinAt |
| 46 | have hdiff (Z : (q : M) → TangentSpace J q) |
| 47 | (hZ : MDifferentiableAt J (J.prod 𝓘(ℝ, E)) (T% Z) p) : |
| 48 | DifferentiableWithinAt ℝ |
| 49 | (VectorField.mpullbackWithin 𝓘(ℝ, E) J e.symm Z (range J)) (range J) (e p) := by |
| 50 | simpa only [preimage_univ, univ_inter] using |
| 51 | (hZ.mdifferentiableWithinAt (s := univ)).differentiableWithinAt_mpullbackWithin_vectorField |
| 52 | have hchain (z : E) (hz : z ∈ e.target) : |
| 53 | fderivWithin ℝ g (range J) z = |
| 54 | (mfderiv J 𝓘(ℝ) f (e.symm z)).comp |
| 55 | (mfderivWithin 𝓘(ℝ, E) J e.symm (range J) z) := by |
| 56 | have hd := mfderiv_comp_mfderivWithin z |
| 57 | ((hf (e.symm z)).mdifferentiableAt (by simp)) |
| 58 | (mdifferentiableWithinAt_extChartAt_symm hz) |
| 59 | ((J.uniqueDiffOn z (extChartAt_target_subset_range p hz)).uniqueMDiffWithinAt) |
| 60 | simpa only [mfderivWithin_eq_fderivWithin] using hd |
| 61 | have hact (Z : (q : M) → TangentSpace J q) (c : ℝ) |
| 62 | (hZ : ∀ q, mfderiv J 𝓘(ℝ) f q (Z q) = c) : |
| 63 | (fun z ↦ fderivWithin ℝ g (range J) z |
| 64 | (VectorField.mpullbackWithin 𝓘(ℝ, E) J e.symm Z (range J) z)) |
| 65 | =ᶠ[𝓝[range J] (e p)] (fun _ ↦ c) := by |
| 66 | filter_upwards [extChartAt_target_mem_nhdsWithin (I := J) p] with z hz |
| 67 | rw [hchain z hz] |
| 68 | change mfderiv J 𝓘(ℝ) f (e.symm z) |
| 69 | (mfderivWithin 𝓘(ℝ, E) J e.symm (range J) z |
| 70 | ((mfderivWithin 𝓘(ℝ, E) J e.symm (range J) z).inverse (Z (e.symm z)))) = c |
| 71 | rw [(isInvertible_mfderivWithin_extChartAt_symm hz).self_apply_inverse, hZ] |
| 72 | have hcomm := VectorField.fderivWithin_apply_lieBracket hg |
| 73 | (by rw [minSmoothness_of_isRCLikeNormedField]; exact WithTop.coe_le_coe.mpr le_top) |
| 74 | J.uniqueDiffOn |
| 75 | (J.range_subset_closure_interior hrange) hrange (hdiff B hBd) (hdiff A hAd) |
| 76 | have hzero : fderivWithin ℝ g (range J) (e p) |
| 77 | (VectorField.lieBracketWithin ℝ V W (range J) (e p)) = 0 := by |
| 78 | rw [hcomm, (hact B b hB).fderivWithin_eq_of_mem hrange, |
| 79 | (hact A a hA).fderivWithin_eq_of_mem hrange] |
| 80 | simp |
| 81 | have hbase : fderivWithin ℝ g (range J) (e p) = mfderiv J 𝓘(ℝ) f p := by |
| 82 | rw [hchain (e p) hmem] |
| 83 | simp only [e, mfderivWithin_range_extChartAt_symm, ContinuousLinearMap.comp_id] |
| 84 | change (mfderiv J 𝓘(ℝ) f (e.symm (e p)) : E →L[ℝ] ℝ) = _ |
| 85 | rw [hpe] |
| 86 | rw [hbase] at hzero |
| 87 | change (mfderiv J 𝓘(ℝ) f p : E →L[ℝ] ℝ) _ = 0 |
| 88 | simpa only [VectorField.mlieBracket, VectorField.mlieBracketWithin_apply, |
| 89 | preimage_univ, univ_inter, mfderiv_extChartAt_self, |
| 90 | ContinuousLinearMap.inverse_id, ContinuousLinearMap.id_apply] using! hzero |
| 91 | |
| 92 | universe u |
| 93 | |
| 94 | variable {n : ℕ} {X : Type u} [TopologicalSpace X] {time : X → ℝ} |
| 95 | {I : SpacetimeInterval} {F : GeneralizedFlowSpacetime n X time I} |
| 96 | |
| 97 | theorem IsSmoothHorizontalSectionOn.contMDiffOn_vectorField |
| 98 | {V : HorizontalSection F} {U : Set F.Point} (hV : IsSmoothHorizontalSectionOn F V U) : |
| 99 | ContMDiffOn (spacetimeModel n) |
| 100 | ((spacetimeModel n).prod 𝓘(ℝ, SpacetimeModelVector n)) ∞ |
| 101 | (T% (horizontalSectionVectorField F V)) U := by |
| 102 | have hinc : ContMDiff |
| 103 | ((spacetimeModel n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) |
| 104 | ((spacetimeModel n).prod 𝓘(ℝ, SpacetimeModelVector n)) ∞ |
| 105 | (fun v : Bundle.TotalSpace (EuclideanSpace ℝ (Fin n)) F.Horizontal ↦ |
| 106 | Bundle.TotalSpace.mk' (SpacetimeModelVector n) |
| 107 | (E := (TangentSpace (spacetimeModel n) : F.Point → Type _)) v.proj v.2.val) := |
| 108 | F.horizontal_inclusion_smooth |
| 109 | exact hinc.comp_contMDiffOn hV |
| 110 | |
| 111 | theorem horizontalTimeBracket_is_horizontal |
| 112 | {U : Set F.Point} (hU : IsOpen U) {V : HorizontalSection F} |
| 113 | (hV : IsSmoothHorizontalSectionOn F V U) {p : F.Point} (hp : p ∈ U) : |
| 114 | mfderiv (spacetimeModel n) 𝓘(ℝ) F.timeFunction p |
| 115 | (VectorField.mlieBracket (spacetimeModel n) |
| 116 | (show (q : F.Point) → TangentSpace (spacetimeModel n) q from F.timeVector) |
| 117 | (horizontalSectionVectorField F V) p) = 0 := by |
| 118 | have hT : ContMDiff (spacetimeModel n) |
| 119 | ((spacetimeModel n).prod 𝓘(ℝ, SpacetimeModelVector n)) ∞ |
| 120 | (T% (show (q : F.Point) → TangentSpace (spacetimeModel n) q from F.timeVector)) := |
| 121 | F.timeVector_smooth |
| 122 | apply bracket_annihilates_of_constant_derivatives (M := F.Point) F.time_smooth |
| 123 | (show (q : F.Point) → TangentSpace (spacetimeModel n) q from F.timeVector) |
| 124 | (horizontalSectionVectorField F V) 1 0 F.timeVector_normalized |
| 125 | (fun q ↦ (V q).property) p |
| 126 | ((hT p).mdifferentiableAt (by simp)) |
| 127 | exact (hV.contMDiffOn_vectorField.contMDiffAt (hU.mem_nhds hp)).mdifferentiableAt (by simp) |
| 128 | |
| 129 | theorem horizontalTimeBracket_val |
| 130 | {U : Set F.Point} (hU : IsOpen U) {V : HorizontalSection F} |
| 131 | (hV : IsSmoothHorizontalSectionOn F V U) {p : F.Point} (hp : p ∈ U) : |
| 132 | (horizontalTimeBracket F V p).val = |
| 133 | VectorField.mlieBracket (spacetimeModel n) |
| 134 | (show (q : F.Point) → TangentSpace (spacetimeModel n) q from F.timeVector) |
| 135 | (horizontalSectionVectorField F V) p := by |
| 136 | exact congrArg Subtype.val (F.horizontalProjection_identity p |
| 137 | ⟨_, horizontalTimeBracket_is_horizontal hU hV hp⟩) |
| 138 | |
| 139 | /-- The bracket of two locally smooth horizontal fields is horizontal. -/ |
| 140 | theorem horizontalSectionBracket_is_horizontal |
| 141 | {U : Set F.Point} (hU : IsOpen U) {V W : HorizontalSection F} |
| 142 | (hV : IsSmoothHorizontalSectionOn F V U) |
| 143 | (hW : IsSmoothHorizontalSectionOn F W U) {p : F.Point} (hp : p ∈ U) : |
| 144 | mfderiv (spacetimeModel n) 𝓘(ℝ) F.timeFunction p |
| 145 | (VectorField.mlieBracket (spacetimeModel n) |
| 146 | (horizontalSectionVectorField F V) (horizontalSectionVectorField F W) p) = 0 := by |
| 147 | exact bracket_annihilates_of_constant_derivatives (M := F.Point) F.time_smooth |
| 148 | (horizontalSectionVectorField F V) (horizontalSectionVectorField F W) 0 0 |
| 149 | (fun q => (V q).property) (fun q => (W q).property) p |
| 150 | ((hV.contMDiffOn_vectorField.contMDiffAt (hU.mem_nhds hp)).mdifferentiableAt (by simp)) |
| 151 | ((hW.contMDiffOn_vectorField.contMDiffAt (hU.mem_nhds hp)).mdifferentiableAt (by simp)) |
| 152 | |
| 153 | end PoincareMT |