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.Manifold.Circle.CompactArc |
| 2 | import PoincareLib.Topology.Manifold.Schoenflies.Collar.Differential |
| 3 | |
| 4 | /-! # Compact arcs in smoothly embedded circles -/ |
| 5 | |
| 6 | noncomputable section |
| 7 | set_option autoImplicit false |
| 8 | set_option backward.isDefEq.respectTransparency false |
| 9 | |
| 10 | open Set Metric |
| 11 | open scoped Manifold ContDiff |
| 12 | |
| 13 | namespace Poincare.Geometry.Manifold.Circle |
| 14 | |
| 15 | private abbrev S1 := sphere (0 : EuclideanSpace Real (Fin 2)) 1 |
| 16 | |
| 17 | /-- A compact connected proper subset of an embedded smooth circle is the |
| 18 | image of a closed interval under a smooth injective immersion defined on the |
| 19 | whole real line. A nontrivial arc has distinct interval endpoints. -/ |
| 20 | theorem exists_interval_parametrization_in_circle_of_injective_mfderiv |
| 21 | {E H M : Type*} [NormedAddCommGroup E] [NormedSpace Real E] |
| 22 | [TopologicalSpace H] [TopologicalSpace M] [T2Space M] |
| 23 | [ChartedSpace H M] {I : ModelWithCorners Real E H} [IsManifold I ∞ M] |
| 24 | {f : S1 -> M} (hf : ContMDiff (𝓡 1) I ∞ f) |
| 25 | (hinj : Function.Injective f) (hder : ∀ q, Function.Injective (mfderiv (𝓡 1) I f q)) |
| 26 | {K : Set M} (hK : IsCompact K) (hconn : IsConnected K) (hKr : K ⊆ range f) |
| 27 | {p : M} (hpr : p ∈ range f) (hp : p ∉ K) : |
| 28 | ∃ (γ : Real -> M) (a b : Real), |
| 29 | ContMDiff 𝓘(Real, Real) I ∞ γ ∧ Function.Injective γ ∧ |
| 30 | (∀ t, Function.Injective (mfderiv 𝓘(Real, Real) I γ t)) ∧ |
| 31 | a ≤ b ∧ γ '' Icc a b = K ∧ (K.Nontrivial → a < b) ∧ |
| 32 | range γ ⊆ range f ∧ Topology.IsEmbedding γ ∧ range γ = range f \ {p} := by |
| 33 | have hfi := (hf.continuous.isClosedEmbedding hinj).isEmbedding |
| 34 | obtain ⟨q, rfl⟩ := hpr |
| 35 | have himage : f '' (f ⁻¹' K) = K := by |
| 36 | rw [image_preimage_eq_inter_range, inter_eq_left.mpr hKr] |
| 37 | have hcompact : IsCompact (f ⁻¹' K) := |
| 38 | (hK.isClosed.preimage hf.continuous).isCompact |
| 39 | have hconnected : IsConnected (f ⁻¹' K) := by |
| 40 | refine ⟨?_, hfi.isInducing.isPreconnected_image.mp ?_⟩ |
| 41 | · obtain ⟨x, hx⟩ := hconn.nonempty |
| 42 | obtain ⟨y, rfl⟩ := hKr hx |
| 43 | exact ⟨y, hx⟩ |
| 44 | · simpa only [himage] using hconn.isPreconnected |
| 45 | obtain ⟨e, a, b, hes, het, he, hei, heinj, hab, hinterval, hstrict⟩ := |
| 46 | exists_interval_parametrization_of_compact_connected hcompact hconnected q hp |
| 47 | have hed : e.MDifferentiable 𝓘(Real, Real) (𝓡 1) := |
| 48 | ⟨he.mdifferentiable (by simp) |>.mdifferentiableOn, |
| 49 | hei.mdifferentiableOn (by simp)⟩ |
| 50 | refine ⟨f ∘ e, a, b, hf.comp he, hinj.comp heinj, |
| 51 | ?_, hab, ?_, ?_, ?_, ?_, ?_⟩ |
| 52 | · intro t |
| 53 | rw [mfderiv_comp t (hf.mdifferentiable (by simp) (e t)) |
| 54 | (he.mdifferentiable (by simp) t)] |
| 55 | exact (hder (e t)).comp (hed.mfderiv_injective (hes ▸ mem_univ t)) |
| 56 | · rw [image_comp, hinterval, himage] |
| 57 | · intro hn |
| 58 | exact hstrict (nontrivial_of_image f _ (by simpa only [himage] using hn)) |
| 59 | · rintro x ⟨t, rfl⟩ |
| 60 | exact ⟨e t, rfl⟩ |
| 61 | · exact hfi.comp (e.isOpenEmbedding hes).isEmbedding |
| 62 | · ext y |
| 63 | constructor |
| 64 | · rintro ⟨t, rfl⟩ |
| 65 | refine ⟨⟨e t, rfl⟩, ?_⟩ |
| 66 | change f (e t) ≠ f q |
| 67 | intro ht |
| 68 | have hmem := e.map_source (hes ▸ mem_univ t) |
| 69 | rw [het] at hmem |
| 70 | exact hmem (hinj ht) |
| 71 | · rintro ⟨⟨z, rfl⟩, hz⟩ |
| 72 | change f z ≠ f q at hz |
| 73 | have hzt : z ∈ e.target := by |
| 74 | rw [het] |
| 75 | exact fun h => hz (congrArg f h) |
| 76 | exact ⟨e.symm z, congrArg f (e.right_inv hzt)⟩ |
| 77 | |
| 78 | /-- The compact-arc parametrization for a supplied smooth circle embedding. -/ |
| 79 | theorem exists_interval_parametrization_in_embedded_circle |
| 80 | {E H M : Type*} [NormedAddCommGroup E] [NormedSpace Real E] |
| 81 | [TopologicalSpace H] [TopologicalSpace M] [T2Space M] |
| 82 | [ChartedSpace H M] {I : ModelWithCorners Real E H} [IsManifold I ∞ M] |
| 83 | {f : S1 -> M} (hf : _root_.Manifold.IsSmoothEmbedding (𝓡 1) I ∞ f) |
| 84 | {K : Set M} (hK : IsCompact K) (hconn : IsConnected K) (hKr : K ⊆ range f) |
| 85 | {p : M} (hpr : p ∈ range f) (hp : p ∉ K) : |
| 86 | ∃ (γ : Real -> M) (a b : Real), |
| 87 | ContMDiff 𝓘(Real, Real) I ∞ γ ∧ Function.Injective γ ∧ |
| 88 | (∀ t, Function.Injective (mfderiv 𝓘(Real, Real) I γ t)) ∧ |
| 89 | a ≤ b ∧ γ '' Icc a b = K ∧ (K.Nontrivial → a < b) ∧ |
| 90 | range γ ⊆ range f ∧ Topology.IsEmbedding γ ∧ range γ = range f \ {p} := |
| 91 | exists_interval_parametrization_in_circle_of_injective_mfderiv hf.contMDiff |
| 92 | hf.isEmbedding.injective (fun q => |
| 93 | (hf.isImmersion.isImmersionAt q).injective_mfderiv_modelWithCornersSelf (by simp)) |
| 94 | hK hconn hKr hpr hp |
| 95 | |
| 96 | end Poincare.Geometry.Manifold.Circle |