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.Interval |
| 2 | import PoincareLib.Geometry.Spacetime.Interval.UniqueDifferential |
| 3 | import PoincareLib.Analysis.Calculus.InverseWithin |
| 4 | import Mathlib.Geometry.Manifold.MFDeriv.Atlas |
| 5 | |
| 6 | /-! |
| 7 | # Real-time parametrization of a smooth spacetime interval |
| 8 | |
| 9 | The selected interval atlas gives the usual smooth structure within its real |
| 10 | domain, including either included endpoint. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | set_option backward.isDefEq.respectTransparency false |
| 15 | |
| 16 | open scoped Manifold ContDiff Bundle Topology |
| 17 | open Set Filter |
| 18 | |
| 19 | namespace PoincareMT.SmoothSpacetimeInterval |
| 20 | |
| 21 | noncomputable section |
| 22 | |
| 23 | variable {I : SpacetimeInterval} |
| 24 | |
| 25 | def realParam (T : SmoothSpacetimeInterval I) (t : ℝ) : T.Point := by |
| 26 | classical |
| 27 | exact if ht : t ∈ I.domain then ⟨t, ht⟩ else |
| 28 | ⟨I.nontrivial.nonempty.choose, I.nontrivial.nonempty.choose_spec⟩ |
| 29 | |
| 30 | @[simp] theorem realParam_coe (T : SmoothSpacetimeInterval I) (t : T.Point) : |
| 31 | T.realParam t = t := by |
| 32 | simp [realParam, t.property] |
| 33 | |
| 34 | theorem realParam_val (T : SmoothSpacetimeInterval I) {t : ℝ} (ht : t ∈ I.domain) : |
| 35 | (T.realParam t).val = t := by simp [realParam, ht] |
| 36 | |
| 37 | theorem realParam_continuousOn (T : SmoothSpacetimeInterval I) : |
| 38 | ContinuousOn T.realParam I.domain := by |
| 39 | intro t ht |
| 40 | apply (Topology.IsInducing.continuousWithinAt_iff |
| 41 | Topology.IsInducing.subtypeVal).mpr |
| 42 | exact continuousWithinAt_id.congr (fun s hs => T.realParam_val hs) |
| 43 | (T.realParam_val ht) |
| 44 | |
| 45 | private theorem chart_real_invertible (T : SmoothSpacetimeInterval I) (p : T.Point) |
| 46 | {y : EuclideanSpace ℝ (Fin 1)} (hy : y ∈ (extChartAt (𝓡∂ 1) p).target) : |
| 47 | (fderivWithin ℝ (fun z => ((extChartAt (𝓡∂ 1) p).symm z : ℝ)) |
| 48 | (extChartAt (𝓡∂ 1) p).target y).IsInvertible := by |
| 49 | let c := extChartAt (𝓡∂ 1) p |
| 50 | have hinc : ContMDiff (𝓡∂ 1) 𝓘(ℝ) ∞ (Subtype.val : T.Point → ℝ) := |
| 51 | T.inclusion_smooth |
| 52 | have hc := mdifferentiableWithinAt_extChartAt_symm (I := 𝓡∂ 1) hy |
| 53 | have hu := (uniqueDiffOn_extChartAt_target (I := 𝓡∂ 1) p y hy).uniqueMDiffWithinAt |
| 54 | have hm : mfderivWithin 𝓘(ℝ, EuclideanSpace ℝ (Fin 1)) (𝓡∂ 1) |
| 55 | c.symm c.target y = |
| 56 | mfderivWithin 𝓘(ℝ, EuclideanSpace ℝ (Fin 1)) (𝓡∂ 1) |
| 57 | c.symm (range (𝓡∂ 1)) y := |
| 58 | hc.mfderivWithin_mono hu (extChartAt_target_subset_range p) |
| 59 | rw [← mfderivWithin_eq_fderivWithin] |
| 60 | change (mfderivWithin 𝓘(ℝ, EuclideanSpace ℝ (Fin 1)) 𝓘(ℝ) |
| 61 | ((Subtype.val : T.Point → ℝ) ∘ c.symm) c.target y).IsInvertible |
| 62 | rw [mfderiv_comp_mfderivWithin y |
| 63 | (hinc.mdifferentiable (by simp) (c.symm y)) |
| 64 | (hc.mono (extChartAt_target_subset_range p)) hu, hm, |
| 65 | ← T.inclusionDerivative_eq] |
| 66 | exact ContinuousLinearMap.isInvertible_equiv.comp |
| 67 | (isInvertible_mfderivWithin_extChartAt_symm hy) |
| 68 | |
| 69 | theorem realParam_smoothOn (T : SmoothSpacetimeInterval I) : |
| 70 | ContMDiffOn 𝓘(ℝ) (𝓡∂ 1) ∞ T.realParam I.domain := by |
| 71 | intro t ht |
| 72 | let p := T.realParam t |
| 73 | let c := extChartAt (𝓡∂ 1) p |
| 74 | let A := I.domain ∩ T.realParam ⁻¹' c.source |
| 75 | have hp : T.realParam t ∈ c.source := mem_extChartAt_source p |
| 76 | have htA : t ∈ A := ⟨ht, hp⟩ |
| 77 | have hinc : ContMDiff (𝓡∂ 1) 𝓘(ℝ) ∞ (Subtype.val : T.Point → ℝ) := |
| 78 | T.inclusion_smooth |
| 79 | have hc : ContDiffOn ℝ ∞ (fun z => (c.symm z : ℝ)) c.target := by |
| 80 | exact (hinc.comp_contMDiffOn |
| 81 | (contMDiffOn_extChartAt_symm p)).contDiffOn |
| 82 | have hg : ContinuousOn (c ∘ T.realParam) A := |
| 83 | (continuousOn_extChartAt (I := 𝓡∂ 1) p).comp |
| 84 | (T.realParam_continuousOn.mono inter_subset_left) |
| 85 | (fun _ h => h.2) |
| 86 | have hgs : MapsTo (c ∘ T.realParam) A c.target := |
| 87 | fun _ h => c.map_source h.2 |
| 88 | have hfg : ∀ y ∈ A, (c.symm (c (T.realParam y)) : ℝ) = y := by |
| 89 | intro y hy |
| 90 | rw [c.left_inv hy.2, T.realParam_val hy.1] |
| 91 | have hi := contDiffOn_inverse_of_invertible_fderivWithin hc |
| 92 | (uniqueDiffOn_extChartAt_target p) (fun y hy => chart_real_invertible T p hy) |
| 93 | hg hgs hfg |
| 94 | rw [contMDiffWithinAt_iff_target_of_mem_source (y := p) |
| 95 | (by simpa only [c, extChartAt_source] using hp)] |
| 96 | refine ⟨T.realParam_continuousOn t ht, ?_⟩ |
| 97 | apply (hi t htA).contMDiffWithinAt.mono_of_mem_nhdsWithin |
| 98 | exact inter_mem self_mem_nhdsWithin |
| 99 | ((T.realParam_continuousOn t ht) ((isOpen_extChartAt_source p).mem_nhds hp)) |
| 100 | |
| 101 | theorem realParam_mfderivWithin (T : SmoothSpacetimeInterval I) |
| 102 | {t : ℝ} (ht : t ∈ I.domain) : |
| 103 | mfderivWithin 𝓘(ℝ) (𝓡∂ 1) T.realParam I.domain t = |
| 104 | (T.inclusionDerivative (T.realParam t)).symm.toContinuousLinearMap := by |
| 105 | have hu := uniqueDiffWithinAt_of_spacetimeInterval I ⟨t, ht⟩ |
| 106 | have hinc : ContMDiff (𝓡∂ 1) 𝓘(ℝ) ∞ (Subtype.val : T.Point → ℝ) := |
| 107 | T.inclusion_smooth |
| 108 | have hcomp := mfderiv_comp_mfderivWithin t |
| 109 | (hinc.mdifferentiable (by simp) (T.realParam t)) |
| 110 | (T.realParam_smoothOn.mdifferentiableOn (by simp) t ht) hu.uniqueMDiffWithinAt |
| 111 | have hid : mfderivWithin 𝓘(ℝ) 𝓘(ℝ) |
| 112 | ((Subtype.val : T.Point → ℝ) ∘ T.realParam) I.domain t = |
| 113 | ContinuousLinearMap.id ℝ ℝ := by |
| 114 | rw [mfderivWithin_eq_fderivWithin] |
| 115 | exact ((hasFDerivWithinAt_id t I.domain).congr |
| 116 | (fun s hs => T.realParam_val hs) (T.realParam_val ht)).fderivWithin hu |
| 117 | rw [hid, ← T.inclusionDerivative_eq] at hcomp |
| 118 | apply ContinuousLinearMap.ext |
| 119 | intro a |
| 120 | apply (T.inclusionDerivative (T.realParam t)).injective |
| 121 | change (T.inclusionDerivative (T.realParam t)) |
| 122 | (mfderivWithin 𝓘(ℝ) (𝓡∂ 1) T.realParam I.domain t a) = |
| 123 | (T.inclusionDerivative (T.realParam t)) ((T.inclusionDerivative (T.realParam t)).symm a) |
| 124 | rw [ContinuousLinearEquiv.apply_symm_apply] |
| 125 | exact (congrArg (fun L : ℝ →L[ℝ] ℝ => L a) hcomp).symm |
| 126 | |
| 127 | theorem realParam_mfderivWithin_one (T : SmoothSpacetimeInterval I) (t : T.Point) : |
| 128 | mfderivWithin 𝓘(ℝ) (𝓡∂ 1) T.realParam I.domain t 1 = T.positiveTangent t := by |
| 129 | rw [T.realParam_mfderivWithin t.property] |
| 130 | change (T.inclusionDerivative (T.realParam t)).symm 1 = (T.inclusionDerivative t).symm 1 |
| 131 | rw [T.realParam_coe] |
| 132 | |
| 133 | end |
| 134 | |
| 135 | end PoincareMT.SmoothSpacetimeInterval |