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.Surface.MarkedGaugeVariation |
| 2 | |
| 3 | /-! |
| 4 | # Matching actual variations at an interior meeting point |
| 5 | |
| 6 | Morgan-Tian Proposition 6.30, pp. 118-119. Independent cutoffs in one |
| 7 | gauge give the same moving endpoint and the same horizontal test vector. |
| 8 | The competing prefix's initial endpoint and both full endpoints stay fixed. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | -- Underlying tangent values are compared across equal spacetime basepoints. |
| 13 | set_option backward.isDefEq.respectTransparency false |
| 14 | |
| 15 | open Set |
| 16 | open scoped Manifold ContDiff Bundle |
| 17 | |
| 18 | universe u |
| 19 | |
| 20 | namespace PoincareMT.M14 |
| 21 | |
| 22 | variable {n : ℕ} {X : Type u} [TopologicalSpace X] {time : X → ℝ} |
| 23 | {I : SpacetimeInterval} {G : GeneralizedLGeometryTransport n X time I} |
| 24 | {T a b c : ℝ} {x y : G.Point} |
| 25 | |
| 26 | private theorem family_fixed_of_square {p : M14BackwardPath G T a b x y} |
| 27 | {R : M14SquareRootPath G p} (V : M14LVariationData G p R) {t : ℝ} |
| 28 | (ht : t ∈ Icc a b) (hfix : ∀ u, V.squareFamily (Real.sqrt t) u = R.curve (Real.sqrt t)) : |
| 29 | ∀ u ∈ V.parameterDomain, V.family t u = p.curve t := by |
| 30 | have hs : Real.sqrt t ∈ M14SqrtParameterInterval a b := |
| 31 | ⟨Real.sqrt_le_sqrt ht.1, Real.sqrt_le_sqrt ht.2⟩ |
| 32 | intro u hu |
| 33 | have hsq := V.square_agrees _ hs u hu |
| 34 | rw [Real.sq_sqrt (p.tau_nonneg.trans ht.1)] at hsq |
| 35 | rw [← hsq, hfix u, R.agrees _ hs, Real.sq_sqrt (p.tau_nonneg.trans ht.1)] |
| 36 | |
| 37 | /-- The competing prefix and the continued path admit actual variations |
| 38 | with equal meeting endpoints and any prescribed common spatial test |
| 39 | vector, Proposition 6.30, pp. 118-119. -/ |
| 40 | theorem exists_meetingGauge_variations (hM12 : GeneralizedRicciGaugeTheory.{u} n) |
| 41 | (q : M14BackwardPath G T a b x y) (p : M14BackwardPath G T a c x (q.curve c)) |
| 42 | (hc : c < b) (Rp : M14SquareRootPath G p) (Rq : M14SquareRootPath G q) |
| 43 | (j : G.gaugeCover.index) |
| 44 | (lift : G.Point → (G.timeIntervals.interval (G.gaugeCover.interval j)).Point × |
| 45 | G.gaugeCover.spatial j) {U : Set G.Point} (hU : IsOpen U) |
| 46 | (hlift : ContMDiffOn (spacetimeModel n) (spacetimeModel n) ∞ lift U) |
| 47 | (hright : ∀ z ∈ U, (G.gaugeCover.cylinder j).toSpacetime (lift z) = z) |
| 48 | (hqU : Rq.curve (Real.sqrt c) ∈ U) (w : EuclideanSpace ℝ (Fin n)) : |
| 49 | ∃ Vp : M14LVariationData G p Rp, ∃ Vq : M14LVariationData G q Rq, |
| 50 | Vp.left_endpoint_fixed ∧ M14BothEndpointsFixed Vq ∧ |
| 51 | (∀ u ∈ Vp.parameterDomain ∩ Vq.parameterDomain, Vp.family c u = Vq.family c u) ∧ |
| 52 | (M14VariationField Vp (Real.sqrt c)).val = ((G.gaugeCover.metric j).spatialTangentEquiv |
| 53 | (lift (Rq.curve (Real.sqrt c))).1 (lift (Rq.curve (Real.sqrt c))).2 w).val ∧ |
| 54 | (M14VariationField Vq (Real.sqrt c)).val = ((G.gaugeCover.metric j).spatialTangentEquiv |
| 55 | (lift (Rq.curve (Real.sqrt c))).1 (lift (Rq.curve (Real.sqrt c))).2 w).val := by |
| 56 | have hc0 : 0 ≤ c := p.tau_nonneg.trans p.tau_lt.le |
| 57 | have hsac : Real.sqrt a < Real.sqrt c := Real.sqrt_lt_sqrt p.tau_nonneg p.tau_lt |
| 58 | have hscb : Real.sqrt c < Real.sqrt b := Real.sqrt_lt_sqrt hc0 hc |
| 59 | have hsp : Real.sqrt c ∈ M14SqrtParameterInterval a c := ⟨hsac.le, le_rfl⟩ |
| 60 | have hsq : Real.sqrt c ∈ M14SqrtParameterInterval a b := ⟨hsac.le, hscb.le⟩ |
| 61 | have hpoint : Rp.curve (Real.sqrt c) = Rq.curve (Real.sqrt c) := by |
| 62 | rw [Rp.agrees _ hsp, Rq.agrees _ hsq, Real.sq_sqrt hc0, p.curve_end] |
| 63 | obtain ⟨Vp, hpfixed, hpmark, hpfield⟩ := exists_markedGauge_variation hM12 Rp j lift |
| 64 | hU hlift hright hsp (hpoint.symm ▸ hqU) isOpen_Ioo ⟨hsac, hscb⟩ w |
| 65 | obtain ⟨Vq, hqfixed, hqmark, hqfield⟩ := exists_markedGauge_variation hM12 Rq j lift |
| 66 | hU hlift hright hsq hqU isOpen_Ioo ⟨hsac, hscb⟩ w |
| 67 | have hpa : Real.sqrt a ∈ M14SqrtParameterInterval a c := ⟨le_rfl, hsac.le⟩ |
| 68 | have hqa : Real.sqrt a ∈ M14SqrtParameterInterval a b := |
| 69 | ⟨le_rfl, (hsac.trans hscb).le⟩ |
| 70 | have hqb : Real.sqrt b ∈ M14SqrtParameterInterval a b := |
| 71 | ⟨(hsac.trans hscb).le, le_rfl⟩ |
| 72 | refine ⟨Vp, Vq, ?_, ?_, ?_, ?_, hqfield⟩ |
| 73 | · apply Vp.left_endpoint_fixed_spec.mpr |
| 74 | exact family_fixed_of_square Vp ⟨le_rfl, p.tau_lt.le⟩ |
| 75 | (hpfixed _ hpa (fun ht => (lt_irrefl _ ht.1))) |
| 76 | · constructor |
| 77 | · apply Vq.left_endpoint_fixed_spec.mpr |
| 78 | exact family_fixed_of_square Vq ⟨le_rfl, q.tau_lt.le⟩ |
| 79 | (hqfixed _ hqa (fun ht => (lt_irrefl _ ht.1))) |
| 80 | · apply Vq.right_endpoint_fixed_spec.mpr |
| 81 | exact family_fixed_of_square Vq ⟨q.tau_lt.le, le_rfl⟩ |
| 82 | (hqfixed _ hqb (fun ht => (lt_irrefl _ ht.2))) |
| 83 | · intro u hu |
| 84 | have hp := Vp.square_agrees _ hsp u hu.1 |
| 85 | have hq := Vq.square_agrees _ hsq u hu.2 |
| 86 | rw [Real.sq_sqrt hc0] at hp hq |
| 87 | rw [← hp, ← hq, hpmark, hqmark, hpoint] |
| 88 | · exact hpfield.trans (congrArg (fun z : G.Point => |
| 89 | ((G.gaugeCover.metric j).spatialTangentEquiv (lift z).1 (lift z).2 w).val) hpoint) |
| 90 | |
| 91 | end PoincareMT.M14 |