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.Surgery.StandardCap.Existence.Analysis.Limits.CompactPartialImage |
| 2 | |
| 3 | /-! |
| 4 | # Interiors and relative frontiers of actual partial images |
| 5 | |
| 6 | The actual source and target guards turn Mathlib's local image relation |
| 7 | into the set equalities used by cap transport. Source: Proposition 9.79(3), |
| 8 | p. 234, and Theorem 12.28, pp. 323-324; cap-image-topology.md. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | |
| 13 | open Set |
| 14 | |
| 15 | namespace OpenPartialHomeomorph |
| 16 | |
| 17 | variable {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] |
| 18 | (e : OpenPartialHomeomorph X Y) |
| 19 | |
| 20 | /-- The actual image of an interior is the interior of the image when |
| 21 | the set lies inside the open partial map's source. -/ |
| 22 | theorem image_interior_eq_of_subset_source {S : Set X} (hS : S ⊆ e.source) : |
| 23 | e '' interior S = interior (e '' S) := by |
| 24 | have hi := (e.isImage_image_of_subset_source hS).interior |
| 25 | apply Subset.antisymm |
| 26 | · rintro _ ⟨x, hx, rfl⟩ |
| 27 | exact (hi.apply_mem_iff (hS (interior_subset hx))).mpr hx |
| 28 | · intro y hy |
| 29 | obtain ⟨x, hx, rfl⟩ := interior_subset hy |
| 30 | exact ⟨x, (hi.apply_mem_iff (hS hx)).mp hy, rfl⟩ |
| 31 | |
| 32 | /-- The actual set difference of two captured sets is preserved by an |
| 33 | open partial homeomorphism, using injectivity only on its source. -/ |
| 34 | theorem image_sdiff_eq_of_subset_source {S T : Set X} |
| 35 | (hS : S ⊆ e.source) (hT : T ⊆ e.source) : |
| 36 | e '' (S \ T) = e '' S \ e '' T := by |
| 37 | ext y |
| 38 | constructor |
| 39 | · rintro ⟨x, ⟨hxS, hxT⟩, rfl⟩ |
| 40 | refine ⟨⟨x, hxS, rfl⟩, ?_⟩ |
| 41 | rintro ⟨z, hz, he⟩ |
| 42 | exact hxT ((e.injOn (hT hz) (hS hxS) he) ▸ hz) |
| 43 | · rintro ⟨⟨x, hx, rfl⟩, hnot⟩ |
| 44 | exact ⟨x, ⟨hx, fun ht => hnot ⟨x, ht, rfl⟩⟩, rfl⟩ |
| 45 | |
| 46 | /-- Relative frontiers inside a captured ambient set are transported |
| 47 | exactly, without compactness of the set whose frontier is used. -/ |
| 48 | theorem image_inter_frontier_eq_of_subset_source {S T : Set X} |
| 49 | (hS : S ⊆ e.source) (hT : T ⊆ e.source) : |
| 50 | e '' (S ∩ frontier T) = e '' S ∩ frontier (e '' T) := by |
| 51 | have hf := (e.isImage_image_of_subset_source hT).frontier |
| 52 | ext y |
| 53 | constructor |
| 54 | · rintro ⟨x, ⟨hxS, hxT⟩, rfl⟩ |
| 55 | exact ⟨⟨x, hxS, rfl⟩, (hf.apply_mem_iff (hS hxS)).mpr hxT⟩ |
| 56 | · rintro ⟨⟨x, hxS, rfl⟩, hxT⟩ |
| 57 | exact ⟨x, ⟨hxS, (hf.apply_mem_iff (hS hxS)).mp hxT⟩, rfl⟩ |
| 58 | |
| 59 | end OpenPartialHomeomorph |