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.Realization.Box.Topology |
| 2 | |
| 3 | /-! |
| 4 | # Fixed-time box maps on the actual level sets |
| 5 | -/ |
| 6 | |
| 7 | set_option autoImplicit false |
| 8 | set_option backward.isDefEq.respectTransparency false |
| 9 | |
| 10 | open Set Topology |
| 11 | open scoped Manifold ContDiff Topology |
| 12 | |
| 13 | open PoincareMT |
| 14 | |
| 15 | namespace Poincare.Spacetime.Realization |
| 16 | |
| 17 | variable {n : ℕ} {X : Type*} [TopologicalSpace X] |
| 18 | {time : X → ℝ} {I : SpacetimeInterval} |
| 19 | |
| 20 | def sliceBoxMap (b : AdaptedMetricBox n X time I) (t : ℝ) |
| 21 | (ht : t ∈ b.interval.domain) (x : b.spatial) : spacetimeSlice time t := |
| 22 | ⟨b.toSpacetime (⟨t, ht⟩, x), b.time_toSpacetime _⟩ |
| 23 | |
| 24 | theorem sliceBoxMap_range (b : AdaptedMetricBox n X time I) (t : ℝ) |
| 25 | (ht : t ∈ b.interval.domain) : |
| 26 | range (sliceBoxMap b t ht) = |
| 27 | (Subtype.val : spacetimeSlice time t → X) ⁻¹' (boxHomeomorph b).target := by |
| 28 | ext p |
| 29 | constructor |
| 30 | · rintro ⟨x, rfl⟩ |
| 31 | exact (boxHomeomorph b).map_source (mem_univ _) |
| 32 | · intro hp |
| 33 | let q := (boxHomeomorph b).symm p.val |
| 34 | have htime : q.1 = ⟨t, ht⟩ := |
| 35 | Subtype.ext ((boxHomeomorph_inverse_time b hp).trans p.property) |
| 36 | refine ⟨q.2, Subtype.ext ?_⟩ |
| 37 | change b.toSpacetime (⟨t, ht⟩, q.2) = p.val |
| 38 | rw [← htime] |
| 39 | exact boxHomeomorph_right_inv b hp |
| 40 | |
| 41 | theorem sliceBoxMap_openEmbedding (b : AdaptedMetricBox n X time I) (t : ℝ) |
| 42 | (ht : t ∈ b.interval.domain) : IsOpenEmbedding (sliceBoxMap b t ht) := by |
| 43 | constructor |
| 44 | · apply IsEmbedding.subtypeVal.of_comp_iff.mp |
| 45 | exact b.openEmbedding.isEmbedding.comp (isEmbedding_prodMkRight (⟨t, ht⟩ : b.interval.domain)) |
| 46 | · rw [sliceBoxMap_range] |
| 47 | exact (boxHomeomorph b).open_target.preimage continuous_subtype_val |
| 48 | |
| 49 | noncomputable def sliceHomeomorph (b : AdaptedMetricBox n X time I) (t : ℝ) |
| 50 | (ht : t ∈ b.interval.domain) : OpenPartialHomeomorph b.spatial (spacetimeSlice time t) := by |
| 51 | letI : Nonempty b.spatial := b.spatial_nonempty.to_subtype |
| 52 | exact (sliceBoxMap_openEmbedding b t ht).toOpenPartialHomeomorph (sliceBoxMap b t ht) |
| 53 | |
| 54 | theorem sliceHomeomorph_apply (b : AdaptedMetricBox n X time I) (t : ℝ) |
| 55 | (ht : t ∈ b.interval.domain) (x : b.spatial) : |
| 56 | sliceHomeomorph b t ht x = sliceBoxMap b t ht x := rfl |
| 57 | |
| 58 | theorem sliceHomeomorph_source (b : AdaptedMetricBox n X time I) (t : ℝ) |
| 59 | (ht : t ∈ b.interval.domain) : (sliceHomeomorph b t ht).source = univ := rfl |
| 60 | |
| 61 | theorem sliceHomeomorph_target (b : AdaptedMetricBox n X time I) (t : ℝ) |
| 62 | (ht : t ∈ b.interval.domain) : |
| 63 | (sliceHomeomorph b t ht).target = |
| 64 | (Subtype.val : spacetimeSlice time t → X) ⁻¹' (boxHomeomorph b).target := by |
| 65 | rw [← sliceBoxMap_range b t ht] |
| 66 | simp [sliceHomeomorph] |
| 67 | |
| 68 | theorem sliceHomeomorph_inverse (b : AdaptedMetricBox n X time I) (t : ℝ) |
| 69 | (ht : t ∈ b.interval.domain) (p : spacetimeSlice time t) |
| 70 | (hp : p ∈ (sliceHomeomorph b t ht).target) : |
| 71 | (sliceHomeomorph b t ht).symm p = ((boxHomeomorph b).symm p.val).2 := by |
| 72 | have h := congrArg Subtype.val ((sliceHomeomorph b t ht).right_inv hp) |
| 73 | change b.toSpacetime (⟨t, ht⟩, (sliceHomeomorph b t ht).symm p) = p.val at h |
| 74 | have hq := congrArg (fun q : boxDomain b ↦ q.2) |
| 75 | (congrArg (boxHomeomorph b).symm h) |
| 76 | rw [boxHomeomorph_left_inv] at hq |
| 77 | exact hq |
| 78 | |
| 79 | theorem slice_targets_cover (A : AdaptedMetricAtlas n X) (t : ℝ) |
| 80 | (p : spacetimeSlice A.time t) : |
| 81 | ∃ b : {b : A.box_index // t ∈ (A.box b).interval.domain}, |
| 82 | p ∈ (sliceHomeomorph (A.box b.val) t b.property).target := by |
| 83 | obtain ⟨b, q, hq⟩ := A.box_covers p.val |
| 84 | have ht : q.1.val = t := ((A.box b).time_toSpacetime q).symm.trans |
| 85 | ((congrArg A.time hq).trans p.property) |
| 86 | refine ⟨⟨b, ht ▸ q.1.property⟩, ?_⟩ |
| 87 | rw [sliceHomeomorph_target] |
| 88 | change p.val ∈ (boxHomeomorph (A.box b)).target |
| 89 | rw [← hq] |
| 90 | exact (boxHomeomorph (A.box b)).map_source (mem_univ q) |
| 91 | |
| 92 | end Poincare.Spacetime.Realization |