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.Exponential.Differential.ExponentialJacobiField |
| 2 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Exponential.Construction.ExponentialGaugeDifferential |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Exponential.Families.GaugeFamilyNeighborhood |
| 4 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Variation.Jacobi.JacobiGaugeSecond |
| 5 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Calculus.ODE.Families.ClosedParameterDerivative |
| 6 | |
| 7 | /-! |
| 8 | # Stationary coordinate phase gives zero actual Jacobi phase |
| 9 | |
| 10 | Morgan-Tian Lemma 6.19 and Proposition 6.30, pp. 114, 118-119. |
| 11 | Actual mixed derivatives identify the coordinate velocity variation |
| 12 | with the time derivative of the Jacobi coordinates. A zero coordinate |
| 13 | field removes the connection term from its actual covariant derivative. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | -- The gauge coordinate model and the actual horizontal fibers are compared by HEq. |
| 18 | set_option backward.isDefEq.respectTransparency false |
| 19 | |
| 20 | open Set Filter |
| 21 | open scoped Manifold ContDiff Topology |
| 22 | |
| 23 | universe u |
| 24 | |
| 25 | namespace PoincareMT.M14 |
| 26 | |
| 27 | variable {n : ℕ} {X : Type u} [TopologicalSpace X] {time : X → ℝ} |
| 28 | {I : SpacetimeInterval} {G : GeneralizedLGeometryTransport n X time I} |
| 29 | {T : ℝ} {x : G.Point} |
| 30 | |
| 31 | private theorem horizontal_zero_of_heq {q r : G.Point} (h : q = r) |
| 32 | {v : G.Horizontal q} (hv : HEq v (0 : G.Horizontal r)) : v = 0 := by |
| 33 | cases h |
| 34 | exact eq_of_heq hv |
| 35 | |
| 36 | /-- Vanishing of the actual endpoint and velocity coordinate |
| 37 | variations forces both actual Jacobi phase values to vanish at |
| 38 | the interior meeting time, Proposition 6.30, pp. 118-119. -/ |
| 39 | theorem exponentialJacobiField_zero_of_coordinate_phase |
| 40 | (hM04 : RicciFlowCurvatureTheory.{0}) (hM12 : GeneralizedRicciGaugeTheory.{u} n) |
| 41 | (E : M14ExponentialFamily G T x) (Z W : G.Horizontal x) |
| 42 | {b c : ℝ} (hb : (Z, b) ∈ E.domain) (hc : c ∈ Ioo 0 b) |
| 43 | {U : Set ℝ} (hU : IsOpen U) (hzero : 0 ∈ U) |
| 44 | (hsurv : ∀ r ∈ U, (Z + r • W, b) ∈ E.domain) |
| 45 | (j : G.gaugeCover.index) |
| 46 | (lift : G.Point → (G.timeIntervals.interval (G.gaugeCover.interval j)).Point × |
| 47 | G.gaugeCover.spatial j) {V : Set G.Point} (hV : IsOpen V) |
| 48 | (hlift : ContMDiffOn (spacetimeModel n) (spacetimeModel n) ∞ lift V) |
| 49 | (hright : ∀ q ∈ V, (G.gaugeCover.cylinder j).toSpacetime (lift q) = q) |
| 50 | (hcenter : E.gamma Z c ∈ V) |
| 51 | (hcoordinate : deriv (fun r : ℝ => (lift (E.gamma (Z + r • W) c)).2.val) 0 = 0) |
| 52 | (hvelocity : deriv (fun r : ℝ => |
| 53 | deriv (fun s => (lift (E.gamma (Z + r • W) s)).2.val) c) 0 = 0) : |
| 54 | let Q := initialValuePath_differentialData hM04 hM12 |
| 55 | (exponentialInitialValuePath E Z b hb (hc.1.trans hc.2)) W |
| 56 | Q.field c = 0 ∧ M14JacobiFirstDerivative Q c = 0 := by |
| 57 | let P := exponentialInitialValuePath E Z b hb (hc.1.trans hc.2) |
| 58 | let Q := initialValuePath_differentialData hM04 hM12 P W |
| 59 | let γ := fun z : ℝ × ℝ => E.gamma (Z + z.1 • W) z.2 |
| 60 | have hγ : ContMDiffOn ((𝓘(ℝ, ℝ)).prod (𝓘(ℝ, ℝ))) (spacetimeModel n) ∞ γ |
| 61 | (U ×ˢ Icc 0 b) := |
| 62 | (exponentialLine_contMDiffOn E Z W hsurv).comp |
| 63 | (contMDiff_snd.prodMk contMDiff_fst).contMDiffOn (fun _ hz => ⟨hz.2, hz.1⟩) |
| 64 | have hnear : γ ⁻¹' V ∈ 𝓝[U ×ˢ Icc 0 b] (0, c) := |
| 65 | (hγ.continuousOn (0, c) ⟨hzero, hc.1.le, hc.2.le⟩).preimage_mem_nhdsWithin |
| 66 | (hV.mem_nhds (by simpa only [γ, zero_smul, add_zero] using hcenter)) |
| 67 | obtain ⟨N, hN, hzeroN, hNU, l, r, h0l, hlc, hcr, hrb, hmap, htime⟩ := |
| 68 | exists_open_closed_family_neighborhood hU hzero hc.1 hc.2.le hnear |
| 69 | have hcr' : c < r := right_lt_of_Icc_mem_nhdsWithin hc.1.le hc.2 htime |
| 70 | have hlr : l < r := hlc.trans hcr' |
| 71 | have hcC : c ∈ Icc l r := ⟨hlc.le, hcr⟩ |
| 72 | have hcNear : Icc l r ∈ 𝓝 c := Icc_mem_nhds hlc hcr' |
| 73 | have hC : M14SqrtParameterInterval 0 (b ^ 2) = Icc 0 b := by |
| 74 | rw [M14SqrtParameterInterval, Real.sqrt_zero, Real.sqrt_sq (hc.1.trans hc.2).le] |
| 75 | have hsub : Icc l r ⊆ M14SqrtParameterInterval 0 (b ^ 2) := by |
| 76 | rw [hC] |
| 77 | exact Icc_subset_Icc h0l.le hrb |
| 78 | let β := lift ∘ γ |
| 79 | have hβ : ContMDiffOn ((𝓘(ℝ, ℝ)).prod (𝓘(ℝ, ℝ))) (spacetimeModel n) ∞ β |
| 80 | (N ×ˢ Icc l r) := |
| 81 | hlift.comp (hγ.mono (prod_mono hNU (Icc_subset_Icc h0l.le hrb))) hmap |
| 82 | let q := fun z : ℝ × ℝ => (β (z.2, z.1)).2.val |
| 83 | have hq : ContDiffOn ℝ ∞ q (Icc l r ×ˢ N) := by |
| 84 | have hval : ContMDiff (𝓡 n) (𝓡 n) ∞ |
| 85 | (Subtype.val : G.gaugeCover.spatial j → EuclideanSpace ℝ (Fin n)) := |
| 86 | contMDiff_subtype_val |
| 87 | have h := hval.comp_contMDiffOn (fun z hz => (hβ z hz).snd) |
| 88 | rw [← modelWithCornersSelf_prod, chartedSpaceSelf_prod] at h |
| 89 | have hswap : ContDiffOn ℝ ∞ (fun z : ℝ × ℝ => (z.2, z.1)) (Icc l r ×ˢ N) := |
| 90 | (contDiff_snd.prodMk contDiff_fst).contDiffOn |
| 91 | have hmem : MapsTo (fun z : ℝ × ℝ => (z.2, z.1)) (Icc l r ×ˢ N) (N ×ˢ Icc l r) := |
| 92 | fun _ hz => ⟨hz.2, hz.1⟩ |
| 93 | have hcomp := h.contDiffOn.comp hswap hmem |
| 94 | exact hcomp |
| 95 | let Y := fun s => fderiv ℝ (fun v => q (s, v)) 0 (1 : ℝ) |
| 96 | have hY0 : Y c = 0 := fderiv_apply_one_eq_deriv.trans hcoordinate |
| 97 | have hYd : derivWithin Y (Icc l r) c = 0 := by |
| 98 | have h := (hasDerivWithinAt_parameterDerivative_Icc hlr hN q hq hcC hzeroN (1 : ℝ)).derivWithin |
| 99 | (uniqueDiffOn_Icc hlr c hcC) |
| 100 | have hv : (fun v => derivWithin (fun s => q (s, v)) (Icc l r) c) = |
| 101 | (fun v => deriv (fun s => q (s, v)) c) := |
| 102 | funext (fun _ => derivWithin_of_mem_nhds hcNear) |
| 103 | rw [hv, fderiv_apply_one_eq_deriv] at h |
| 104 | exact h.trans hvelocity |
| 105 | have hβ0 : ContMDiffOn (𝓘(ℝ, ℝ)) (spacetimeModel n) ∞ (fun s => β (0, s)) (Icc l r) := |
| 106 | hβ.comp (contMDiff_const.prodMk contMDiff_id).contMDiffOn (fun _ hs => ⟨hzeroN, hs⟩) |
| 107 | have hrecP (s : ℝ) (hs : s ∈ Icc l r) : |
| 108 | (G.gaugeCover.cylinder j).toSpacetime (β (0, s)) = P.square_path.curve s := by |
| 109 | have h := hright _ (hmap (show (0, s) ∈ N ×ˢ Icc l r from ⟨hzeroN, hs⟩)) |
| 110 | have hbase := exponential_square_curve_eq E Z hb (hc.1.trans hc.2) (hsub hs) |
| 111 | have hbase' : γ (0, s) = P.square_path.curve s := by |
| 112 | change E.gamma (Z + (0 : ℝ) • W) s = (E.square_path Z b hb (hc.1.trans hc.2)).curve s |
| 113 | rw [zero_smul, add_zero] |
| 114 | exact hbase.symm |
| 115 | exact h.trans hbase' |
| 116 | have hclock (s : ℝ) (hs : s ∈ Icc l r) : (β (0, s)).1.val = T - s ^ 2 := |
| 117 | ((G.gaugeCover.cylinder j).time_eq (β (0, s))).symm.trans |
| 118 | ((congrArg G.spacetime.timeFunction (hrecP s hs)).trans |
| 119 | (P.square_path.curve_time s (hsub hs))) |
| 120 | have hfield (s : ℝ) (hs : s ∈ Icc l r) : HEq (Q.field s) |
| 121 | ((G.gaugeCover.metric j).spatialTangentEquiv (β (0, s)).1 (β (0, s)).2 (Y s)) := by |
| 122 | have hsurvS : (Z, s) ∈ E.domain := |
| 123 | (E.maximal_lifetime Z).out (E.domain_zero Z) hb ⟨h0l.le.trans hs.1, hs.2.trans hrb⟩ |
| 124 | have hp : ContMDiffOn (𝓘(ℝ, ℝ)) (spacetimeModel n) ∞ (fun v => β (v, s)) N := |
| 125 | hβ.comp (contMDiff_id.prodMk contMDiff_const).contMDiffOn (fun _ hv => ⟨hv, hs⟩) |
| 126 | have hrec : (fun v : ℝ => E.gamma (Z + v • W) s) =ᶠ[𝓝 0] |
| 127 | (fun v => (G.gaugeCover.cylinder j).toSpacetime (β (v, s))) := by |
| 128 | filter_upwards [hN.mem_nhds hzeroN] with v hv |
| 129 | exact (hright _ (hmap (show (v, s) ∈ N ×ˢ Icc l r from ⟨hv, hs⟩))).symm |
| 130 | exact (exponentialJacobiField_heq_differential hM04 hM12 E Z W hb (hc.1.trans hc.2) |
| 131 | (hsub hs) hsurvS).trans (exponentialLine_differential_gauge E Z W hsurvS j |
| 132 | (fun v => β (v, s)) |
| 133 | ((hp.contMDiffAt (hN.mem_nhds hzeroN)).mdifferentiableAt (by simp)) hrec) |
| 134 | have hCoordinates := hM12.coordinate_gauges X time I G.spacetime G.slices |
| 135 | G.timeIntervals G.gaugeCover G.leafwise |
| 136 | let F := Classical.choice (ordinaryGaugeWitness_nonempty j hCoordinates) |
| 137 | have hR := P.square_path.smooth.mono P.square_path.interval_subset |
| 138 | have hrestrict := horizontalCovariantDerivative_restrict_subset Q.extension hsub |
| 139 | (uniqueDiffOn_Icc hlr c hcC) ((hR c (hsub hcC)).mdifferentiableWithinAt (by simp)) |
| 140 | have hfirst := (heq_of_eq hrestrict).trans |
| 141 | (horizontalCovariantDerivative_lifted_gauge j hCoordinates F T (β (0, c)).2 hβ0 hrecP hclock |
| 142 | (pullbackExtensionRestrict Q.extension hsub) Y hfield hcC (uniqueDiffOn_Icc hlr c hcC)) |
| 143 | have hvalue := hfield c hcC |
| 144 | rw [hY0, map_zero] at hvalue |
| 145 | rw [hY0, hYd, map_zero, zero_add, map_zero] at hfirst |
| 146 | exact ⟨horizontal_zero_of_heq (hrecP c hcC).symm hvalue, |
| 147 | horizontal_zero_of_heq (hrecP c hcC).symm hfirst⟩ |
| 148 | |
| 149 | end PoincareMT.M14 |