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.Variation.Extension.LocalTestVariation |
| 2 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Variation.Fields.VariationClock |
| 3 | import Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension |
| 4 | |
| 5 | /-! |
| 6 | # The actual field of a supported gauge variation |
| 7 | |
| 8 | Morgan-Tian Lemma 6.4 and Definition 6.7, pp. 107-108. The parameter |
| 9 | derivative is the compatible cylinder's actual spatial tangent map |
| 10 | applied to the test vector. Transport to the base curve identifies |
| 11 | the frozen variation field without assuming a derivative formula. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | -- All spacetime tangent fibers use the same underlying model vector space. |
| 16 | set_option backward.isDefEq.respectTransparency false |
| 17 | |
| 18 | open Set Filter |
| 19 | open scoped Manifold ContDiff Bundle Topology |
| 20 | |
| 21 | universe u |
| 22 | |
| 23 | namespace PoincareMT.M14 |
| 24 | |
| 25 | variable {n : ℕ} {X : Type u} [TopologicalSpace X] {time : X → ℝ} |
| 26 | {I : SpacetimeInterval} {G : GeneralizedLGeometryTransport n X time I} |
| 27 | {T τ₁ τ₂ : ℝ} {x y : G.Point} {p : M14BackwardPath G T τ₁ τ₂ x y} |
| 28 | (R : M14SquareRootPath G p) (b : G.gaugeCover.index) |
| 29 | (lift : G.Point → (G.timeIntervals.interval (G.gaugeCover.interval b)).Point × |
| 30 | G.gaugeCover.spatial b) (η : ℝ → EuclideanSpace ℝ (Fin n)) |
| 31 | |
| 32 | /-- The actual parameter derivative of the gauge formula is its |
| 33 | spatial tangent equivalence applied to the test vector, |
| 34 | Lemma 6.4, pp. 107-108. -/ |
| 35 | theorem gaugeShiftFamily_parameter_mfderiv (s : ℝ) : |
| 36 | mfderiv (𝓘(ℝ, ℝ)) (spacetimeModel n) |
| 37 | (fun v => gaugeShiftFamily R b lift η (s, v)) 0 (1 : ℝ) = |
| 38 | ((G.gaugeCover.metric b).spatialTangentEquiv |
| 39 | (lift (R.curve s)).1 (lift (R.curve s)).2 (η s)).val := by |
| 40 | let c := (lift (R.curve s)).2 |
| 41 | let t := (lift (R.curve s)).1 |
| 42 | let f := fun q : G.gaugeCover.spatial b => (G.gaugeCover.cylinder b).toSpacetime (t, q) |
| 43 | have hf : ContMDiff (𝓘(ℝ, EuclideanSpace ℝ (Fin n))) (spacetimeModel n) ∞ f := |
| 44 | (G.gaugeCover.cylinder b).smooth.comp (contMDiff_const.prodMk contMDiff_id) |
| 45 | have hshift := (G.gaugeCover.spatial b).affineShift_parameter_contMDiffAt c (η s) |
| 46 | have hd := mfderiv_comp_apply_of_eq (x := (0 : ℝ)) |
| 47 | (hf.mdifferentiable (by simp) c) (hshift.mdifferentiableAt (by simp)) |
| 48 | (show (G.gaugeCover.spatial b).affineShift c ((0 : ℝ) • η s) = c by |
| 49 | rw [zero_smul, TopologicalSpace.Opens.affineShift_zero]) (1 : ℝ) |
| 50 | rw [TopologicalSpace.Opens.affineShift_parameter_mfderiv] at hd |
| 51 | simpa only [f, c, t, Function.comp_def, gaugeShiftFamily, zero_smul, |
| 52 | TopologicalSpace.Opens.affineShift_zero, |
| 53 | (G.gaugeCover.metric b).spatialTangentEquiv_eq] using hd |
| 54 | |
| 55 | /-- The patched family has the same actual parameter derivative on |
| 56 | the whole real line; outside support both sides vanish, |
| 57 | Lemma 6.4, pp. 107-108. -/ |
| 58 | theorem supportedGaugeFamily_parameter_mfderiv |
| 59 | (hright : ∀ s ∈ tsupport η, |
| 60 | (G.gaugeCover.cylinder b).toSpacetime (lift (R.curve s)) = R.curve s) (s : ℝ) : |
| 61 | mfderiv (𝓘(ℝ, ℝ)) (spacetimeModel n) |
| 62 | (fun v => supportedGaugeFamily R b lift η (s, v)) 0 (1 : ℝ) = |
| 63 | ((G.gaugeCover.metric b).spatialTangentEquiv |
| 64 | (lift (R.curve s)).1 (lift (R.curve s)).2 (η s)).val := by |
| 65 | by_cases hs : s ∈ tsupport η |
| 66 | · have heq : (fun v => supportedGaugeFamily R b lift η (s, v)) = |
| 67 | (fun v => gaugeShiftFamily R b lift η (s, v)) := |
| 68 | funext (fun _ => supportedGaugeFamily_eq_gauge R b lift η (hright s hs)) |
| 69 | rw [heq] |
| 70 | exact gaugeShiftFamily_parameter_mfderiv R b lift η s |
| 71 | · have heq : (fun v => supportedGaugeFamily R b lift η (s, v)) = |
| 72 | (fun _ : ℝ => R.curve s) := |
| 73 | funext (fun _ => supportedGaugeFamily_eq_of_not_tsupport R b lift η hs) |
| 74 | rw [heq, image_eq_zero_of_notMem_tsupport hs, map_zero] |
| 75 | simp only [mfderiv_const, zero_apply, Submodule.coe_zero] |
| 76 | |
| 77 | private theorem horizontal_transport_val {q r : G.Point} (h : q = r) |
| 78 | (v : G.Horizontal q) : (h.symm ▸ v : G.Horizontal r).val = v.val := by |
| 79 | cases h |
| 80 | rfl |
| 81 | |
| 82 | /-- The frozen variation field is exactly the chosen gauge test field |
| 83 | at every closed square-root point, Lemma 6.4, pp. 107-108. -/ |
| 84 | theorem variationField_supportedGauge_val (V : M14LVariationData G p R) |
| 85 | (hV : ∀ s v, V.squareFamily s v = supportedGaugeFamily R b lift η (s, v)) |
| 86 | (hright : ∀ s ∈ tsupport η, |
| 87 | (G.gaugeCover.cylinder b).toSpacetime (lift (R.curve s)) = R.curve s) |
| 88 | {s : ℝ} (hs : s ∈ M14SqrtParameterInterval τ₁ τ₂) : |
| 89 | (M14VariationField V s).val = |
| 90 | ((G.gaugeCover.metric b).spatialTangentEquiv |
| 91 | (lift (R.curve s)).1 (lift (R.curve s)).2 (η s)).val := by |
| 92 | have hzero : (0 : ℝ) ∈ V.parameterDomain := by |
| 93 | rw [V.parameterDomain_eq] |
| 94 | exact ⟨neg_lt_zero.mpr V.radius_pos, V.radius_pos⟩ |
| 95 | have htransport : (M14VariationField V s).val = (M14EndpointVariationField V s 0).val := |
| 96 | horizontal_transport_val (V.square_base s) _ |
| 97 | rw [htransport, endpointVariationField_val_eq_tangent V hs hzero] |
| 98 | have heq : (fun v => V.squareFamily s v) = |
| 99 | (fun v => supportedGaugeFamily R b lift η (s, v)) := funext (hV s) |
| 100 | rw [heq] |
| 101 | exact supportedGaugeFamily_parameter_mfderiv R b lift η hright s |
| 102 | |
| 103 | omit b lift η in |
| 104 | /-- Any horizontal vector at an interior square-root point is the |
| 105 | value of a supported smooth gauge test field, Definition 6.7 and |
| 106 | the argument after Lemma 6.4, pp. 107-108. -/ |
| 107 | theorem exists_supportedGaugeTest_at {s : ℝ} |
| 108 | (hs : s ∈ Ioo (Real.sqrt τ₁) (Real.sqrt τ₂)) (W : G.Horizontal (R.curve s)) : |
| 109 | ∃ b : G.gaugeCover.index, ∃ U : Set G.Point, |
| 110 | ∃ lift : G.Point → (G.timeIntervals.interval (G.gaugeCover.interval b)).Point × |
| 111 | G.gaugeCover.spatial b, |
| 112 | IsOpen U ∧ ContMDiffOn (spacetimeModel n) (spacetimeModel n) ∞ lift U ∧ |
| 113 | (∀ q ∈ U, (G.gaugeCover.cylinder b).toSpacetime (lift q) = q) ∧ |
| 114 | ∃ η : ℝ → EuclideanSpace ℝ (Fin n), ContDiff ℝ ∞ η ∧ |
| 115 | tsupport η ⊆ Ioo (Real.sqrt τ₁) (Real.sqrt τ₂) ∧ |
| 116 | (∀ r ∈ tsupport η, R.curve r ∈ U) ∧ |
| 117 | ((G.gaugeCover.metric b).spatialTangentEquiv |
| 118 | (lift (R.curve s)).1 (lift (R.curve s)).2 (η s)).val = W.val := by |
| 119 | obtain ⟨b, U, lift, hU, hsU, hlift, hright, _⟩ := exists_smooth_gauge_lift G (R.curve s) |
| 120 | let J := Ioo (Real.sqrt τ₁) (Real.sqrt τ₂) ∩ R.curve ⁻¹' U |
| 121 | have hR : ContinuousOn R.curve (Ioo (Real.sqrt τ₁) (Real.sqrt τ₂)) := |
| 122 | R.smooth.continuousOn.mono (Ioo_subset_Icc_self.trans R.interval_subset) |
| 123 | have hJ : IsOpen J := hR.isOpen_inter_preimage isOpen_Ioo hU |
| 124 | obtain ⟨ζ, hζs, _, hζ, _, hζone⟩ := |
| 125 | exists_contDiff_tsupport_subset (n := (⊤ : ℕ∞)) (hJ.mem_nhds ⟨hs, hsU⟩) |
| 126 | have hW : ∃ v : G.Horizontal ((G.gaugeCover.cylinder b).toSpacetime (lift (R.curve s))), |
| 127 | v.val = W.val := by |
| 128 | rw [hright _ hsU] |
| 129 | exact ⟨W, rfl⟩ |
| 130 | obtain ⟨v, hv⟩ := hW |
| 131 | obtain ⟨w, hw⟩ := ((G.gaugeCover.metric b).spatialTangentEquiv |
| 132 | (lift (R.curve s)).1 (lift (R.curve s)).2).surjective v |
| 133 | refine ⟨b, U, lift, hU, hlift, hright, fun r => ζ r • w, |
| 134 | hζ.smul contDiff_const, ?_, ?_, ?_⟩ |
| 135 | · intro r hr |
| 136 | exact (hζs (tsupport_smul_subset_left ζ (fun _ => w) hr)).1 |
| 137 | · intro r hr |
| 138 | exact (hζs (tsupport_smul_subset_left ζ (fun _ => w) hr)).2 |
| 139 | · have hvalue : (G.gaugeCover.metric b).spatialTangentEquiv |
| 140 | (lift (R.curve s)).1 (lift (R.curve s)).2 (ζ s • w) = v := by |
| 141 | rw [hζone, one_smul, hw] |
| 142 | exact (congrArg Subtype.val hvalue).trans hv |
| 143 | |
| 144 | end PoincareMT.M14 |