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.RealTime |
| 2 | import PoincareLib.Geometry.RicciFlow.Generalized.Gauge.SectionTransport.TimeBracket |
| 3 | |
| 4 | /-! |
| 5 | # Time derivatives in a moving gauge |
| 6 | |
| 7 | Convert the derivative along the normalized interval tangent into a real |
| 8 | derivative within the complete interval, including its included endpoints. |
| 9 | This supplies the time parametrization for the moving metric product rule |
| 10 | supporting Morgan--Tian, Definitions 3.36--3.38, pp. 60--61. |
| 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 Bundle |
| 18 | |
| 19 | universe u v w |
| 20 | |
| 21 | namespace PoincareMT |
| 22 | |
| 23 | theorem SmoothSpacetimeInterval.hasDerivWithinAt_realParam |
| 24 | {K : SpacetimeInterval} (T : SmoothSpacetimeInterval K) |
| 25 | {E : Type w} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 26 | {f : T.Point → E} (t : T.Point) |
| 27 | (hf : MDifferentiableAt (𝓡∂ 1) 𝓘(ℝ, E) f t) : |
| 28 | HasDerivWithinAt (fun s => f (T.realParam s)) |
| 29 | (mfderiv (𝓡∂ 1) 𝓘(ℝ, E) f t (T.positiveTangent t)) K.domain t.val := by |
| 30 | let : ChartedSpace (EuclideanHalfSpace 1) T.Point := T.chartedSpace |
| 31 | let : IsManifold (𝓡∂ 1) ∞ T.Point := T.isManifold |
| 32 | have hp := T.realParam_smoothOn.mdifferentiableOn (by simp) t.val t.property |
| 33 | have hf' : MDifferentiableAt (𝓡∂ 1) 𝓘(ℝ, E) f (T.realParam t.val) := by |
| 34 | simpa only [T.realParam_coe] using hf |
| 35 | have hd := hf'.comp_mdifferentiableWithinAt t.val hp |
| 36 | have hc := mfderiv_comp_mfderivWithin t.val hf' hp |
| 37 | (uniqueDiffWithinAt_of_spacetimeInterval K t).uniqueMDiffWithinAt |
| 38 | have hc1 := congrArg (fun L : ℝ →L[ℝ] E => L 1) hc |
| 39 | change mfderivWithin 𝓘(ℝ) 𝓘(ℝ, E) (f ∘ T.realParam) K.domain t.val 1 = |
| 40 | mfderiv (𝓡∂ 1) 𝓘(ℝ, E) f (T.realParam t.val) |
| 41 | (mfderivWithin 𝓘(ℝ) (𝓡∂ 1) T.realParam K.domain t.val 1) at hc1 |
| 42 | rw [T.realParam_mfderivWithin_one, |
| 43 | T.realParam_coe, mfderivWithin_eq_fderivWithin] at hc1 |
| 44 | exact hd.differentiableWithinAt.hasFDerivWithinAt.hasDerivWithinAt.congr_deriv hc1 |
| 45 | |
| 46 | variable {n : ℕ} {X : Type u} [TopologicalSpace X] {time : X → ℝ} |
| 47 | {I K : SpacetimeInterval} {F : GeneralizedFlowSpacetime n X time I} |
| 48 | {T : SmoothSpacetimeInterval K} {C : Type v} [TopologicalSpace C] |
| 49 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) C] [IsManifold (𝓡 n) ∞ C] |
| 50 | |
| 51 | theorem movingGauge_hasDerivWithinAt_comp |
| 52 | (e : MovingSpacetimeGauge F T C) {f : F.Point → ℝ} |
| 53 | (t : T.Point) (x : C) |
| 54 | (hf : MDifferentiableAt (spacetimeModel n) 𝓘(ℝ) f (e.toSpacetime (t, x))) : |
| 55 | HasDerivWithinAt (fun s => f (e.toSpacetime (T.realParam s, x))) |
| 56 | (mvfderiv (spacetimeModel n) f (e.toSpacetime (t, x)) |
| 57 | (movingGaugeTimeVelocity e t x)) K.domain t.val := by |
| 58 | let : ChartedSpace (EuclideanHalfSpace 1) T.Point := T.chartedSpace |
| 59 | let : IsManifold (𝓡∂ 1) ∞ T.Point := T.isManifold |
| 60 | let : ChartedSpace (ModelProd (EuclideanHalfSpace 1) |
| 61 | (EuclideanSpace ℝ (Fin n))) F.Point := F.chartedSpace |
| 62 | let : IsManifold (spacetimeModel n) ∞ F.Point := F.isManifold |
| 63 | have hi : MDifferentiableAt (𝓡∂ 1) (spacetimeModel n) |
| 64 | (fun s : T.Point => (s, x)) t := |
| 65 | mdifferentiableAt_id.prodMk mdifferentiableAt_const |
| 66 | have he := e.smooth.mdifferentiableAt (x := (t, x)) (by simp) |
| 67 | have hd := T.hasDerivWithinAt_realParam t (hf.comp t (he.comp t hi)) |
| 68 | apply hd.congr_deriv |
| 69 | rw [mfderiv_comp_apply t hf (he.comp t hi), mfderiv_comp_apply t he hi] |
| 70 | change mvfderiv (spacetimeModel n) f (e.toSpacetime (t, x)) |
| 71 | (mfderiv (spacetimeModel n) (spacetimeModel n) e.toSpacetime (t, x) |
| 72 | (mfderiv (𝓡∂ 1) (spacetimeModel n) (fun s : T.Point => (s, x)) t |
| 73 | (T.positiveTangent t))) = _ |
| 74 | congr 2 |
| 75 | change mfderiv (𝓡∂ 1) ((𝓡∂ 1).prod (𝓡 n)) |
| 76 | (fun s : T.Point => (id s, (fun _ : T.Point => x) s)) t |
| 77 | (T.positiveTangent t) = (T.positiveTangent t, 0) |
| 78 | rw [mfderiv_prodMk mdifferentiableAt_id mdifferentiableAt_const] |
| 79 | rw [mfderiv_id, mfderiv_const] |
| 80 | rfl |
| 81 | |
| 82 | theorem movingGauge_hasDerivWithinAt_pullbackSection |
| 83 | (e : MovingSpacetimeGauge F T C) (G : MovingSpacetimeGaugeGeometry e) |
| 84 | (V : HorizontalSection F) (O : Set F.Point) (hO : IsOpen O) |
| 85 | (hV : IsSmoothHorizontalSectionOn F V O) (t : T.Point) (x : C) |
| 86 | (hp : e.toSpacetime (t, x) ∈ O) : |
| 87 | HasDerivWithinAt |
| 88 | (fun s => (show EuclideanSpace ℝ (Fin n) from |
| 89 | pullbackHorizontalSection G V (T.realParam s) x)) |
| 90 | (show EuclideanSpace ℝ (Fin n) from movingGaugeSectionTimeDerivative G V t x) |
| 91 | K.domain t.val := by |
| 92 | let : ChartedSpace (EuclideanHalfSpace 1) T.Point := T.chartedSpace |
| 93 | let : IsManifold (𝓡∂ 1) ∞ T.Point := T.isManifold |
| 94 | have hs := (movingGauge_pullbackHorizontalSection_smoothAt e G V O hO hV (t, x) hp).comp t |
| 95 | (contMDiffAt_id.prodMk contMDiffAt_const) |
| 96 | have hc := (Bundle.contMDiffAt_totalSpace.mp hs).2 |
| 97 | have hraw : ContMDiffAt (𝓡∂ 1) (𝓡 n) ∞ |
| 98 | (fun s : T.Point => (show EuclideanSpace ℝ (Fin n) from |
| 99 | pullbackHorizontalSection G V s x)) t := by |
| 100 | change ContMDiffAt (𝓡∂ 1) (𝓡 n) ∞ |
| 101 | (fun s => (trivializationAt (EuclideanSpace ℝ (Fin n)) |
| 102 | (TangentSpace (𝓡 n)) x ⟨x, pullbackHorizontalSection G V s x⟩).2) t at hc |
| 103 | have heq (w : TangentSpace (𝓡 n) x) : |
| 104 | (trivializationAt (EuclideanSpace ℝ (Fin n)) |
| 105 | (TangentSpace (𝓡 n)) x ⟨x, w⟩).2 = w := by |
| 106 | rw [← Trivialization.continuousLinearMapAt_apply_of_mem ℝ _ |
| 107 | (mem_baseSet_trivializationAt _ _ x) w] |
| 108 | rw [TangentBundle.continuousLinearMapAt_trivializationAt (mem_chart_source _ x), |
| 109 | mfderiv_extChartAt_self] |
| 110 | rfl |
| 111 | simpa only [heq] using hc |
| 112 | rw [movingGaugeSectionTimeDerivative_eq_model e G V O hO hV t x hp] |
| 113 | exact T.hasDerivWithinAt_realParam t (hraw.mdifferentiableAt (by simp)) |
| 114 | |
| 115 | end PoincareMT |