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.GeometryTheory |
| 2 | import PoincareLib.Geometry.Spacetime.Realization.Conclusion |
| 3 | import PoincareLib.Geometry.Spacetime.Realization.Interval.Neighborhood |
| 4 | |
| 5 | /-! |
| 6 | # Locality in the retained realization's interval system |
| 7 | |
| 8 | Only relatively open interval inclusions are inverted. All maps use the |
| 9 | already selected charts, including at endpoints retained by both intervals. |
| 10 | The local inverse is M11's checked construction output. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | set_option backward.isDefEq.respectTransparency false |
| 15 | |
| 16 | open Set Function Filter |
| 17 | open scoped Manifold ContDiff Topology |
| 18 | |
| 19 | open PoincareMT |
| 20 | |
| 21 | namespace Poincare.Spacetime.Realization |
| 22 | |
| 23 | variable {n : ℕ} {X : Type*} [TopologicalSpace X] {A : AdaptedMetricAtlas n X} |
| 24 | (R : GeneralizedFlowCarrierConclusionWithInterval A) |
| 25 | {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 26 | {H : Type*} [TopologicalSpace H] {IM : ModelWithCorners ℝ E H} |
| 27 | {M : Type*} [TopologicalSpace M] [ChartedSpace H M] |
| 28 | {V : Type*} [NormedAddCommGroup V] [NormedSpace ℝ V] |
| 29 | {H' : Type*} [TopologicalSpace H'] {IN : ModelWithCorners ℝ V H'} |
| 30 | {N : Type*} [TopologicalSpace N] [ChartedSpace H' N] |
| 31 | |
| 32 | theorem selectedInterval_smoothAt_of_local (K L : SpacetimeInterval) |
| 33 | (h : L.domain ⊆ K.domain) (ho : IsOpen {t : K.domain | t.val ∈ L.domain}) |
| 34 | (t : (R.timeIntervals.interval L).Point) (f : (R.timeIntervals.interval K).Point → N) |
| 35 | (hf : ContMDiffAt (𝓡∂ 1) IN ∞ |
| 36 | (f ∘ spacetimeIntervalInclusion (R.timeIntervals.interval L) |
| 37 | (R.timeIntervals.interval K) h) t) : |
| 38 | ContMDiffAt (𝓡∂ 1) IN ∞ f |
| 39 | (spacetimeIntervalInclusion (R.timeIntervals.interval L) |
| 40 | (R.timeIntervals.interval K) h t) := by |
| 41 | let j := spacetimeIntervalInclusion (R.timeIntervals.interval L) (R.timeIntervals.interval K) h |
| 42 | have hj := R.interval_localDiffeomorph K L h ho t |
| 43 | have hi : hj.localInverse (j t) = t := hj.localInverse_left_inv hj.localInverse_mem_target |
| 44 | have hf' : ContMDiffAt (𝓡∂ 1) IN ∞ (f ∘ j) (hj.localInverse (j t)) := by |
| 45 | rw [hi] |
| 46 | exact hf |
| 47 | apply (hf'.comp (j t) hj.localInverse_contMDiffAt).congr_of_eventuallyEq |
| 48 | filter_upwards [hj.localInverse_eventuallyEq_right] with s hs |
| 49 | exact congrArg f hs.symm |
| 50 | |
| 51 | theorem selectedInterval_product_smoothAt_of_local (K L : SpacetimeInterval) |
| 52 | (h : L.domain ⊆ K.domain) (ho : IsOpen {t : K.domain | t.val ∈ L.domain}) |
| 53 | (p : (R.timeIntervals.interval L).Point × M) |
| 54 | (f : (R.timeIntervals.interval K).Point × M → N) |
| 55 | (hf : ContMDiffAt ((𝓡∂ 1).prod IM) IN ∞ |
| 56 | (f ∘ Prod.map (spacetimeIntervalInclusion (R.timeIntervals.interval L) |
| 57 | (R.timeIntervals.interval K) h) id) p) : |
| 58 | ContMDiffAt ((𝓡∂ 1).prod IM) IN ∞ f |
| 59 | (spacetimeIntervalInclusion (R.timeIntervals.interval L) |
| 60 | (R.timeIntervals.interval K) h p.1, p.2) := by |
| 61 | let j := spacetimeIntervalInclusion (R.timeIntervals.interval L) (R.timeIntervals.interval K) h |
| 62 | have hj := R.interval_localDiffeomorph K L h ho p.1 |
| 63 | have hi : hj.localInverse (j p.1) = p.1 := |
| 64 | hj.localInverse_left_inv hj.localInverse_mem_target |
| 65 | have hf' : ContMDiffAt ((𝓡∂ 1).prod IM) IN ∞ (f ∘ Prod.map j id) |
| 66 | (hj.localInverse (j p.1), p.2) := by |
| 67 | rw [hi] |
| 68 | exact hf |
| 69 | have hinv : ContMDiffAt ((𝓡∂ 1).prod IM) ((𝓡∂ 1).prod IM) ∞ |
| 70 | (fun q : (R.timeIntervals.interval K).Point × M => (hj.localInverse q.1, q.2)) |
| 71 | (j p.1, p.2) := |
| 72 | (hj.localInverse_contMDiffAt.comp (j p.1, p.2) contMDiffAt_fst).prodMk contMDiffAt_snd |
| 73 | apply (hf'.comp (j p.1, p.2) hinv).congr_of_eventuallyEq |
| 74 | filter_upwards [continuous_fst.continuousAt hj.localInverse_eventuallyEq_right] with q hq |
| 75 | exact congrArg (fun s => f (s, q.2)) hq.symm |
| 76 | |
| 77 | /-- A nontrivial interval has arbitrarily small relatively open interval |
| 78 | neighborhoods, also at an included endpoint. -/ |
| 79 | theorem interval_exists_open_small_neighborhood (I : SpacetimeInterval) (t : I.domain) |
| 80 | {U : Set I.domain} (hU : U ∈ 𝓝 t) : |
| 81 | ∃ J : SpacetimeInterval, ∃ h : J.domain ⊆ I.domain, |
| 82 | t.val ∈ J.domain ∧ IsOpen {s : I.domain | s.val ∈ J.domain} ∧ |
| 83 | ∀ s : J.domain, (⟨s.val, h s.property⟩ : I.domain) ∈ U := by |
| 84 | obtain ⟨r, hr, hrU⟩ := Metric.mem_nhds_iff.mp hU |
| 85 | let S : Set ℝ := I.domain ∩ Metric.ball t.val r |
| 86 | have htS : t.val ∈ S := ⟨t.property, Metric.mem_ball_self hr⟩ |
| 87 | have hacc : AccPt t.val (𝓟 S) := |
| 88 | ((interval_uniqueDiffOn I t.val t.property).inter (Metric.ball_mem_nhds _ hr)).accPt |
| 89 | obtain ⟨s, hs, hst⟩ := accPt_iff_nhds.mp hacc univ univ_mem |
| 90 | let J : SpacetimeInterval := { |
| 91 | domain := S |
| 92 | ordConnected := ((interval_convex I).inter (convex_ball _ _)).ordConnected |
| 93 | nontrivial := ⟨s, hs.2, t.val, htS, hst⟩ |
| 94 | } |
| 95 | refine ⟨J, inter_subset_left, htS, ?_, fun s => hrU s.property.2⟩ |
| 96 | have he : {s : I.domain | s.val ∈ J.domain} = Metric.ball t r := by |
| 97 | ext s |
| 98 | change (s.val ∈ I.domain ∧ dist s.val t.val < r) ↔ dist s t < r |
| 99 | simp only [s.property, true_and, Subtype.dist_eq] |
| 100 | rw [he] |
| 101 | exact Metric.isOpen_ball |
| 102 | |
| 103 | end Poincare.Spacetime.Realization |