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.Analysis.Calculus.DividedDifferences |
| 2 | import PoincareLib.Analysis.Calculus.Extension.Compact |
| 3 | |
| 4 | /-! |
| 5 | # Radial primitives of smooth closed one-forms |
| 6 | |
| 7 | Integrating a smooth one-form along radial segments gives its primitive on |
| 8 | a convex set where its derivative is symmetric. This is the local analytic |
| 9 | input to the parallel-coordinate construction in Morgan--Tian, |
| 10 | Proposition 9.83, p. 236. |
| 11 | -/ |
| 12 | |
| 13 | noncomputable section |
| 14 | set_option autoImplicit false |
| 15 | set_option backward.isDefEq.respectTransparency false |
| 16 | |
| 17 | open Set MeasureTheory Filter |
| 18 | open scoped ContDiff Topology Interval |
| 19 | |
| 20 | namespace Poincare.Analysis |
| 21 | |
| 22 | variable {E : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] |
| 23 | |
| 24 | /-- The integral of a one-form on the segment from the chosen base point. -/ |
| 25 | def radialPrimitive (α : E → E →L[ℝ] ℝ) (a x : E) : ℝ := |
| 26 | ∫ t in (0 : ℝ)..1, α (a + t • (x - a)) (x - a) |
| 27 | |
| 28 | /-- A globally smooth one-form has a smooth radial integral. -/ |
| 29 | theorem contDiff_radialPrimitive {α : E → E →L[ℝ] ℝ} |
| 30 | (hα : ContDiff ℝ ∞ α) (a : E) : ContDiff ℝ ∞ (radialPrimitive α a) := by |
| 31 | unfold radialPrimitive |
| 32 | apply contDiff_parameter_intervalIntegral_of_contDiff |
| 33 | (F := fun p : E × ℝ => α (a + p.2 • (p.1 - a)) (p.1 - a)) |
| 34 | exact (hα.comp (contDiff_const.add |
| 35 | (contDiff_snd.smul (contDiff_fst.sub contDiff_const)))).clm_apply |
| 36 | (contDiff_fst.sub contDiff_const) |
| 37 | |
| 38 | /-- Closedness along each radial segment identifies the derivative of its |
| 39 | integral with the given one-form. -/ |
| 40 | theorem hasFDerivAt_radialPrimitive {α : E → E →L[ℝ] ℝ} |
| 41 | (hα : ContDiff ℝ ∞ α) (a x : E) |
| 42 | (hclosed : ∀ t ∈ Icc (0 : ℝ) 1, ∀ u v : E, |
| 43 | fderiv ℝ α (a + t • (x - a)) u v = |
| 44 | fderiv ℝ α (a + t • (x - a)) v u) : |
| 45 | HasFDerivAt (radialPrimitive α a) (α x) x := by |
| 46 | let F : E × ℝ → ℝ := fun p => α (a + p.2 • (p.1 - a)) (p.1 - a) |
| 47 | have hF : ContDiff ℝ ∞ F := |
| 48 | (hα.comp (contDiff_const.add |
| 49 | (contDiff_snd.smul (contDiff_fst.sub contDiff_const)))).clm_apply |
| 50 | (contDiff_fst.sub contDiff_const) |
| 51 | let L : ℝ → E →L[ℝ] ℝ := fun t => |
| 52 | α (a + t • (x - a)) + t • (fderiv ℝ α (a + t • (x - a))).flip (x - a) |
| 53 | have hL : Continuous L := by |
| 54 | have hd : Continuous (fderiv ℝ α) := |
| 55 | (hα.fderiv_right (show ∞ + 1 ≤ (∞ : ℕ∞ω) by simp)).continuous |
| 56 | have hflip : Continuous (fun A : E →L[ℝ] E →L[ℝ] ℝ => A.flip) := |
| 57 | (ContinuousLinearMap.flipₗᵢ ℝ E E ℝ).continuous |
| 58 | exact (hα.continuous.comp (continuous_const.add |
| 59 | (continuous_id.smul continuous_const))).add |
| 60 | (continuous_id.smul ((hflip.comp (hd.comp (continuous_const.add |
| 61 | (continuous_id.smul continuous_const)))).clm_apply continuous_const)) |
| 62 | have hpartial (t : ℝ) : |
| 63 | (fderiv ℝ F (x, t)).comp (ContinuousLinearMap.inl ℝ E ℝ) = L t := by |
| 64 | have hinner : HasFDerivAt (fun y : E => a + t • (y - a)) |
| 65 | (t • ContinuousLinearMap.id ℝ E) x := by |
| 66 | simpa using (((hasFDerivAt_id x).sub_const a).const_smul t).const_add a |
| 67 | have hv := (((hα.differentiable (by simp)) _).hasFDerivAt.comp x hinner).clm_apply |
| 68 | ((hasFDerivAt_id x).sub_const a) |
| 69 | have hp : HasFDerivAt (fun y : E => F (y, t)) |
| 70 | ((fderiv ℝ F (x, t)).comp (ContinuousLinearMap.inl ℝ E ℝ)) x := by |
| 71 | have hDF : HasFDerivAt F (fderiv ℝ F (x, t)) (x, t) := |
| 72 | ((hF.differentiable (by simp)) (x, t)).hasFDerivAt |
| 73 | exact hDF.comp x (hasFDerivAt_prodMk_left (𝕜 := ℝ) x t) |
| 74 | have he := hp.unique hv |
| 75 | rw [he] |
| 76 | ext v |
| 77 | simp [L] |
| 78 | have hd := hasFDerivAt_parameter_intervalIntegral_of_contDiff hF 0 1 x |
| 79 | change HasFDerivAt (radialPrimitive α a) |
| 80 | (∫ t in (0 : ℝ)..1, (fderiv ℝ F (x, t)).comp (ContinuousLinearMap.inl ℝ E ℝ)) x at hd |
| 81 | simp_rw [hpartial] at hd |
| 82 | convert hd using 1 |
| 83 | ext v |
| 84 | rw [ContinuousLinearMap.intervalIntegral_apply (hL.intervalIntegrable 0 1)] |
| 85 | have hderiv (t : ℝ) (ht : t ∈ Icc (0 : ℝ) 1) : |
| 86 | HasDerivAt (fun s : ℝ => s * α (a + s • (x - a)) v) (L t v) t := by |
| 87 | have hi : HasDerivAt (fun s : ℝ => a + s • (x - a)) (x - a) t := by |
| 88 | simpa using ((hasDerivAt_id t).smul_const (x - a)).const_add a |
| 89 | have hαt := (((hα.differentiable (by simp)) _).hasFDerivAt.comp_hasDerivAt t hi).clm_apply |
| 90 | (hasDerivAt_const t v) |
| 91 | convert! (hasDerivAt_id t).mul hαt using 1 |
| 92 | simp only [L, add_apply, smul_apply, |
| 93 | ContinuousLinearMap.flip_apply, smul_eq_mul, one_mul, map_zero, add_zero, id_eq, |
| 94 | Function.comp_apply] |
| 95 | rw [hclosed t ht v (x - a)] |
| 96 | have hcalc := intervalIntegral.integral_eq_sub_of_hasDerivAt |
| 97 | (fun t ht => hderiv t (by simpa using ht)) |
| 98 | ((hL.clm_apply continuous_const).intervalIntegrable 0 1) |
| 99 | simpa using hcalc.symm |
| 100 | |
| 101 | /-- A smooth closed one-form has the radial primitive on a convex domain. -/ |
| 102 | theorem fderiv_radialPrimitive_eqOn {α : E → E →L[ℝ] ℝ} |
| 103 | (hα : ContDiff ℝ ∞ α) {U : Set E} (hU : Convex ℝ U) {a : E} (ha : a ∈ U) |
| 104 | (hclosed : ∀ x ∈ U, ∀ u v : E, fderiv ℝ α x u v = fderiv ℝ α x v u) : |
| 105 | EqOn (fderiv ℝ (radialPrimitive α a)) α U := by |
| 106 | intro x hx |
| 107 | apply (hasFDerivAt_radialPrimitive hα a x _).fderiv |
| 108 | intro t ht u v |
| 109 | exact hclosed (a + t • (x - a)) |
| 110 | (hU.add_smul_sub_mem ha hx ht) u v |
| 111 | |
| 112 | /-- A smooth closed one-form on an open domain has a smooth primitive near |
| 113 | each point, with its additive constant fixed by the value at that point. -/ |
| 114 | theorem exists_local_primitive_of_fderiv_symmetric {α : E → E →L[ℝ] ℝ} |
| 115 | {U : Set E} (hU : IsOpen U) (hα : ContDiffOn ℝ ∞ α U) |
| 116 | (hclosed : ∀ x ∈ U, ∀ u v : E, fderiv ℝ α x u v = fderiv ℝ α x v u) |
| 117 | {a : E} (ha : a ∈ U) (c : ℝ) : |
| 118 | ∃ (r : ℝ) (f : E → ℝ), 0 < r ∧ Metric.ball a r ⊆ U ∧ |
| 119 | ContDiff ℝ ∞ f ∧ f a = c ∧ |
| 120 | ∀ x ∈ Metric.ball a r, HasFDerivAt f (α x) x := by |
| 121 | obtain ⟨β, V, hβ, hV, haV, hVU, heq⟩ := |
| 122 | exists_contDiff_extension_near_compact isCompact_singleton hU |
| 123 | (singleton_subset_iff.mpr ha) α hα |
| 124 | obtain ⟨r, hr, hrV⟩ := Metric.mem_nhds_iff.mp |
| 125 | (hV.mem_nhds (haV (mem_singleton a))) |
| 126 | have hsymm (x : E) (hx : x ∈ Metric.ball a r) (u v : E) : |
| 127 | fderiv ℝ β x u v = fderiv ℝ β x v u := by |
| 128 | rw [(heq.eventuallyEq_of_mem (hV.mem_nhds (hrV hx))).fderiv_eq] |
| 129 | exact hclosed x (hVU (hrV hx)) u v |
| 130 | refine ⟨r, fun x => radialPrimitive β a x + c, hr, hrV.trans hVU, |
| 131 | (contDiff_radialPrimitive hβ a).add contDiff_const, ?_, ?_⟩ |
| 132 | · simp [radialPrimitive] |
| 133 | · intro x hx |
| 134 | have hderiv := hasFDerivAt_radialPrimitive hβ a x (fun t ht u v => |
| 135 | hsymm (a + t • (x - a)) |
| 136 | ((convex_ball a r).add_smul_sub_mem (Metric.mem_ball_self hr) hx ht) u v) |
| 137 | simpa [heq (hrV hx)] using hderiv.add_const c |
| 138 | |
| 139 | end Poincare.Analysis |