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.Calculus.ODE.Extension.ClosedProductInverse |
| 2 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Exponential.Domain.JointNeighborhood |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Variation.Coordinates.GaugeSliceInvertible |
| 4 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Paths.Action.BackwardClock |
| 5 | |
| 6 | /-! |
| 7 | # Actual local inverses of the joint spacetime map |
| 8 | |
| 9 | The time-preserving relative inverse in a supplied gauge composes |
| 10 | with the actual backward square clock. Its domain is an open |
| 11 | spacetime neighborhood and its values remain in the exact joint |
| 12 | stable domain, including physical boundary times. Morgan-Tian |
| 13 | Proposition 6.28, p. 117. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | |
| 18 | open Set Filter |
| 19 | open scoped Manifold ContDiff Topology Bundle |
| 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 : G.Point} |
| 28 | |
| 29 | private theorem horizontal_t2Space : T2Space (G.Horizontal x) := |
| 30 | FiberBundle.t2Space (EuclideanSpace ℝ (Fin n)) G.Horizontal x |
| 31 | |
| 32 | attribute [local instance] horizontal_t2Space |
| 33 | |
| 34 | /-- Each point of the exact joint domain has an actual smooth local |
| 35 | inverse on an open spacetime neighborhood. Its inverse values remain |
| 36 | in the joint domain, also at a physical endpoint, Proposition 6.28, |
| 37 | p. 117; see the derivation 2026-09-21-relative-inverse.md. -/ |
| 38 | theorem exists_jointMap_local_inverse (E : M14ExponentialFamily G T x) |
| 39 | {Z : G.Horizontal x} {s : ℝ} (hz : (Z, s) ∈ M14JointDomain G E) : |
| 40 | let metric := G.spacetime.horizontalMetric.toRiemannianMetric |
| 41 | letI : NormedAddCommGroup (G.Horizontal x) := |
| 42 | (metric.toCore x).toNormedAddCommGroupOfTopology |
| 43 | (metric.continuousAt x) (metric.isVonNBounded x) |
| 44 | letI : InnerProductSpace ℝ (G.Horizontal x) := |
| 45 | .ofCoreOfTopology (metric.toCore x) (metric.continuousAt x) (metric.isVonNBounded x) |
| 46 | ∃ O : Set G.Point, IsOpen O ∧ E.gamma Z s ∈ O ∧ |
| 47 | ∃ inv : G.Point → G.Horizontal x × ℝ, |
| 48 | ContMDiffOn (spacetimeModel n) (𝓘(ℝ, G.Horizontal x × ℝ)) ∞ inv O ∧ |
| 49 | (∀ q ∈ O, inv q ∈ M14JointDomain G E) ∧ |
| 50 | ∀ q ∈ O, E.gamma (inv q).1 (inv q).2 = q := by |
| 51 | let metric := G.spacetime.horizontalMetric.toRiemannianMetric |
| 52 | let : NormedAddCommGroup (G.Horizontal x) := |
| 53 | (metric.toCore x).toNormedAddCommGroupOfTopology |
| 54 | (metric.continuousAt x) (metric.isVonNBounded x) |
| 55 | let : InnerProductSpace ℝ (G.Horizontal x) := |
| 56 | .ofCoreOfTopology (metric.toCore x) (metric.continuousAt x) (metric.isVonNBounded x) |
| 57 | let : Bundle.RiemannianBundle (G.Horizontal : G.Point → Type _) := ⟨metric⟩ |
| 58 | let : FiniteDimensional ℝ (G.Horizontal x) := |
| 59 | VectorBundle.finiteDimensional ℝ (EuclideanSpace ℝ (Fin n)) G.Horizontal x |
| 60 | have hsurv := jointDomain_subset_domain E hz |
| 61 | have hpos := jointDomain_time_pos E hz |
| 62 | have hbij : Function.Bijective (E.differential Z s hsurv) := by |
| 63 | obtain ⟨τ, H, _, hZH, hs⟩ := hz.1 |
| 64 | have hstable := (H.carrier_exact Z).mp hZH |
| 65 | obtain ⟨hτ, hbij, _⟩ := hstable |
| 66 | change s = Real.sqrt τ at hs |
| 67 | subst s |
| 68 | exact hbij |
| 69 | obtain ⟨b, N, lift, hN, hpN, hlift, hrec, htime, U, hU, hUc, hZU, |
| 70 | a, c, ha, has, hsc, htube, hgammaN, hnear⟩ := exists_jointDomain_gauge_tube E hz |
| 71 | let C := Icc a c |
| 72 | let β := fun z : G.Horizontal x × ℝ => lift (E.gamma z.1 z.2) |
| 73 | have hsC : s ∈ C := ⟨has.le, hsc⟩ |
| 74 | have hβ : ContMDiffOn ((𝓘(ℝ, G.Horizontal x)).prod (𝓘(ℝ, ℝ))) |
| 75 | (spacetimeModel n) ∞ β (U ×ˢ C) := |
| 76 | hlift.comp (E.family_smooth.mono (htube.trans (jointDomain_subset_domain E))) hgammaN |
| 77 | have hβrec (z : G.Horizontal x × ℝ) (hz : z ∈ U ×ˢ C) : |
| 78 | (G.gaugeCover.cylinder b).toSpacetime (β z) = E.gamma z.1 z.2 := |
| 79 | hrec _ (hgammaN z hz) |
| 80 | have hqb := exponential_gauge_slice_bijective E b hU β hβrec hZU hsC hsurv hbij hβ |
| 81 | have hv : ContMDiff (𝓡 n) (𝓡 n) ∞ |
| 82 | (Subtype.val : G.gaugeCover.spatial b → EuclideanSpace ℝ (Fin n)) := |
| 83 | contMDiff_subtype_val |
| 84 | have hq : ContDiffOn ℝ ∞ (fun z => (β z).2.val) (U ×ˢ C) := by |
| 85 | have h := hv.comp_contMDiffOn (fun z hz => (hβ z hz).snd) |
| 86 | rw [← modelWithCornersSelf_prod, chartedSpaceSelf_prod] at h |
| 87 | exact h.contDiffOn |
| 88 | obtain ⟨P, hP, hzP, g, hgf, hgt, hgs⟩ := exists_closedProduct_inverse |
| 89 | hU hUc (convex_Icc a c) (uniqueDiffOn_Icc (has.trans_le hsc)) hq hZU hsC hqb |
| 90 | have hCnear : C ∈ 𝓝[{r | 0 ≤ r ∧ T - r ^ 2 ∈ I.domain}] s := by |
| 91 | have hp : Continuous (fun r : ℝ => (Z, r)) := continuous_const.prodMk continuous_id |
| 92 | have hpa := (hp.continuousWithinAt (x := s)).tendsto_nhdsWithin |
| 93 | (show MapsTo (fun r : ℝ => (Z, r)) {r | 0 ≤ r ∧ T - r ^ 2 ∈ I.domain} |
| 94 | (M14AdmissibleParameter G T x) from fun _ hr => hr) |
| 95 | exact mem_of_superset (hpa hnear) (fun _ hr => hr.2) |
| 96 | obtain ⟨Q, hQ, hpQ, hQclock⟩ := exists_backwardSquareClock_neighborhood G T E hsurv hpos hCnear |
| 97 | let χ : G.Point → EuclideanSpace ℝ (Fin n) × ℝ := |
| 98 | fun q => ((lift q).2.val, backwardSquareClock G T q) |
| 99 | have hχ : ContMDiffOn (spacetimeModel n) (𝓘(ℝ, EuclideanSpace ℝ (Fin n) × ℝ)) ∞ χ |
| 100 | (N ∩ Q) := by |
| 101 | have h : ContMDiffOn (spacetimeModel n) ((𝓡 n).prod (𝓘(ℝ, ℝ))) ∞ χ (N ∩ Q) := |
| 102 | ((hv.comp_contMDiffOn (fun q hq => (hlift q hq).snd)).mono inter_subset_left).prodMk |
| 103 | ((backwardSquareClock_contMDiffOn G T).mono (fun q hq => (hQclock q hq.2).1)) |
| 104 | rw [← modelWithCornersSelf_prod, chartedSpaceSelf_prod] at h |
| 105 | exact h |
| 106 | let V := P ∩ (U ×ˢ (univ : Set ℝ)) |
| 107 | have hV : IsOpen V := hP.inter (hU.prod isOpen_univ) |
| 108 | let O := (N ∩ Q) ∩ χ ⁻¹' (g '' V) |
| 109 | have hO : IsOpen O := hχ.continuousOn.isOpen_inter_preimage (hN.inter hQ) (g.isOpenMap V hV) |
| 110 | have hχcenter : χ (E.gamma Z s) = g (Z, s) := by |
| 111 | rw [← hgf ⟨hzP, hZU, hsC⟩] |
| 112 | exact Prod.ext rfl (backwardSquareClock_exponential G T E hsurv) |
| 113 | have hpO : E.gamma Z s ∈ O := by |
| 114 | refine ⟨⟨hpN, hpQ⟩, ?_⟩ |
| 115 | change χ (E.gamma Z s) ∈ g '' V |
| 116 | rw [hχcenter] |
| 117 | exact ⟨(Z, s), ⟨hzP, hZU, mem_univ _⟩, rfl⟩ |
| 118 | let inv := fun q => g.symm (χ q) |
| 119 | have hinv (q : G.Point) (hq : q ∈ O) : inv q ∈ P ∩ (U ×ˢ C) := by |
| 120 | obtain ⟨z, hzV, hzχ⟩ := hq.2 |
| 121 | have hze : inv q = z := by dsimp only [inv]; rw [← hzχ, g.symm_apply_apply] |
| 122 | have ht : z.2 = backwardSquareClock G T q := by |
| 123 | have he := congrArg Prod.snd hzχ |
| 124 | simpa only [hgt z, χ] using he |
| 125 | rw [hze] |
| 126 | exact ⟨hzV.1, hzV.2.1, ht ▸ (hQclock q hq.1.2).2⟩ |
| 127 | have himage (q : G.Point) (hq : q ∈ O) : χ q ∈ g '' (P ∩ (U ×ˢ C)) := |
| 128 | ⟨inv q, hinv q hq, g.apply_symm_apply _⟩ |
| 129 | refine ⟨O, hO, hpO, inv, |
| 130 | hgs.contMDiffOn.comp (hχ.mono inter_subset_left) himage, |
| 131 | fun q hq => htube (hinv q hq).2, ?_⟩ |
| 132 | intro q hq |
| 133 | have heq : ((β (inv q)).2.val, (inv q).2) = χ q := |
| 134 | (hgf (hinv q hq)).trans (g.apply_symm_apply _) |
| 135 | have hs : (inv q).2 = backwardSquareClock G T q := congrArg Prod.snd heq |
| 136 | have hβq : β (inv q) = lift q := by |
| 137 | apply Prod.ext |
| 138 | · apply Subtype.ext |
| 139 | have hβclock := htime _ (hgammaN _ (hinv q hq).2) |
| 140 | have he : G.spacetime.timeFunction (E.gamma (inv q).1 (inv q).2) = |
| 141 | G.spacetime.timeFunction q := |
| 142 | (E.clock (inv q).1 (inv q).2 (jointDomain_subset_domain E (htube (hinv q hq).2))).trans |
| 143 | ((congrArg (fun r : ℝ => T - r ^ 2) hs).trans |
| 144 | (backwardSquareClock_admissible G T (hQclock q hq.1.2).1.le).2.1) |
| 145 | exact hβclock.trans (he.trans (htime q hq.1.1).symm) |
| 146 | · exact Subtype.ext (congrArg Prod.fst heq) |
| 147 | exact (hβrec _ (hinv q hq).2).symm.trans |
| 148 | ((congrArg (G.gaugeCover.cylinder b).toSpacetime hβq).trans (hrec q hq.1.1)) |
| 149 | |
| 150 | end PoincareMT.M14 |