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.ReducedGeometry.ReducedLength.ODE.LocalSmoothFlow |
| 2 | import Mathlib.Analysis.Calculus.BumpFunction.FiniteDimension |
| 3 | |
| 4 | /-! |
| 5 | # Local flows for coefficients on an open domain |
| 6 | |
| 7 | A cutoff equal to one near the initial point gives a globally smooth |
| 8 | field. Restricting its constructed flow keeps all values where the |
| 9 | cutoff is one and hence solves the original local equation. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | open scoped ContDiff Topology |
| 15 | open Set Filter Metric |
| 16 | |
| 17 | namespace PoincareMT.ReducedLength |
| 18 | |
| 19 | variable {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 20 | [FiniteDimensional ℝ E] [NormedAddCommGroup F] [NormedSpace ℝ F] |
| 21 | |
| 22 | theorem exists_smooth_field_extension (S : Set E) (hS : IsOpen S) |
| 23 | (f : E → F) (hf : ContDiffOn ℝ ∞ f S) (x0 : E) (hx : x0 ∈ S) : |
| 24 | ∃ (g : E → F) (V : Set E), ContDiff ℝ ∞ g ∧ IsOpen V ∧ x0 ∈ V ∧ |
| 25 | V ⊆ S ∧ Set.EqOn g f V := by |
| 26 | obtain ⟨e, he, heS⟩ := Metric.isOpen_iff.mp hS x0 hx |
| 27 | let b : ContDiffBump x0 := { |
| 28 | rIn := e / 4 |
| 29 | rOut := e / 2 |
| 30 | rIn_pos := by positivity |
| 31 | rIn_lt_rOut := by linarith |
| 32 | } |
| 33 | let g : E → F := fun y ↦ b y • f y |
| 34 | have hbS : tsupport b ⊆ S := by |
| 35 | rw [b.tsupport_eq] |
| 36 | intro y hy |
| 37 | apply heS |
| 38 | have hd : dist y x0 ≤ e / 2 := hy |
| 39 | change dist y x0 < e |
| 40 | linarith |
| 41 | have hg : ContDiff ℝ ∞ g := by |
| 42 | apply contDiff_iff_contDiffAt.mpr |
| 43 | intro y |
| 44 | by_cases hy : y ∈ S |
| 45 | · exact b.contDiffAt.smul (hf.contDiffAt (hS.mem_nhds hy)) |
| 46 | · have hnot : y ∉ tsupport b := fun h ↦ hy (hbS h) |
| 47 | have hzero : g =ᶠ[𝓝 y] fun _ ↦ (0 : F) := by |
| 48 | filter_upwards [notMem_tsupport_iff_eventuallyEq.mp hnot] with z hz |
| 49 | change b z • f z = 0 |
| 50 | simp only [hz, Pi.zero_apply, zero_smul] |
| 51 | exact contDiffAt_const.congr_of_eventuallyEq hzero |
| 52 | refine ⟨g, ball x0 (e / 4), hg, isOpen_ball, mem_ball_self (by positivity), ?_, ?_⟩ |
| 53 | · intro y hy |
| 54 | apply heS |
| 55 | have hd : dist y x0 < e / 4 := hy |
| 56 | change dist y x0 < e |
| 57 | linarith |
| 58 | · intro y hy |
| 59 | change b y • f y = f y |
| 60 | rw [b.one_of_mem_closedBall (show dist y x0 ≤ b.rIn from le_of_lt hy), one_smul] |
| 61 | |
| 62 | theorem exists_local_smooth_flow_on (S : Set E) (hS : IsOpen S) |
| 63 | (f : E → E) (hf : ContDiffOn ℝ ∞ f S) (x0 : E) (hx : x0 ∈ S) : |
| 64 | ∃ (alpha : E × ℝ → E) (V : Set E) (d : ℝ), |
| 65 | IsOpen V ∧ x0 ∈ V ∧ V ⊆ S ∧ 0 < d ∧ |
| 66 | ContDiffOn ℝ ∞ alpha (V ×ˢ Set.Ioo (-d) d) ∧ |
| 67 | (∀ x ∈ V, alpha (x, 0) = x) ∧ |
| 68 | ∀ x ∈ V, ∀ t ∈ Set.Ioo (-d) d, |
| 69 | alpha (x, t) ∈ S ∧ HasDerivAt (fun a ↦ alpha (x, a)) (f (alpha (x, t))) t := by |
| 70 | obtain ⟨g, Vg, hg, hVg, hxVg, hVgS, hgf⟩ := exists_smooth_field_extension S hS f hf x0 hx |
| 71 | let gC : C(E, E) := ⟨g, hg.continuous⟩ |
| 72 | obtain ⟨alpha, V0, d0, hV0, hxV0, hd0, hasmooth, hainit, haode⟩ := |
| 73 | exists_local_smooth_flow gC hg x0 |
| 74 | let R : Set (E × ℝ) := V0 ×ˢ Set.Ioo (-d0) d0 |
| 75 | have hR : IsOpen R := hV0.prod isOpen_Ioo |
| 76 | have hxR : (x0, (0 : ℝ)) ∈ R := ⟨hxV0, by constructor <;> linarith⟩ |
| 77 | have hac : ContinuousAt alpha (x0, (0 : ℝ)) := |
| 78 | (hasmooth.contDiffAt (hR.mem_nhds hxR)).continuousAt |
| 79 | have hnearA : ∀ᶠ p in 𝓝 (x0, (0 : ℝ)), alpha p ∈ Vg := |
| 80 | hac.preimage_mem_nhds (hVg.mem_nhds (by simpa only [hainit x0 hxV0] using hxVg)) |
| 81 | have hnearX : ∀ᶠ p : E × ℝ in 𝓝 (x0, (0 : ℝ)), p.1 ∈ Vg := |
| 82 | continuousAt_fst.preimage_mem_nhds (hVg.mem_nhds hxVg) |
| 83 | obtain ⟨r, hr, hrsub⟩ := |
| 84 | Metric.mem_nhds_iff.mp (Filter.inter_mem (hR.mem_nhds hxR) (hnearX.and hnearA)) |
| 85 | have hsmall {x : E} {t : ℝ} (hx' : x ∈ ball x0 (r / 2)) |
| 86 | (ht : t ∈ Set.Ioo (-(r / 2)) (r / 2)) : |
| 87 | (x, t) ∈ R ∧ x ∈ Vg ∧ alpha (x, t) ∈ Vg := by |
| 88 | apply hrsub |
| 89 | change dist (x, t) (x0, (0 : ℝ)) < r |
| 90 | rw [Prod.dist_eq, Real.dist_eq, sub_zero] |
| 91 | have hxd : dist x x0 < r / 2 := hx' |
| 92 | have htd := abs_lt.mpr ht |
| 93 | exact max_lt (by linarith) (by linarith) |
| 94 | have hzero : (0 : ℝ) ∈ Set.Ioo (-(r / 2)) (r / 2) := by constructor <;> linarith |
| 95 | refine ⟨alpha, ball x0 (r / 2), r / 2, isOpen_ball, |
| 96 | mem_ball_self (by positivity), fun x hx' ↦ hVgS (hsmall hx' hzero).2.1, |
| 97 | by positivity, ?_, ?_, ?_⟩ |
| 98 | · exact hasmooth.mono fun z hz ↦ (hsmall hz.1 hz.2).1 |
| 99 | · intro x hx' |
| 100 | exact hainit x (hsmall hx' hzero).1.1 |
| 101 | · intro x hx' t ht |
| 102 | have hs := hsmall hx' ht |
| 103 | refine ⟨hVgS hs.2.2, ?_⟩ |
| 104 | have hd := haode x hs.1.1 t hs.1.2 |
| 105 | change HasDerivAt (fun a ↦ alpha (x, a)) (g (alpha (x, t))) t at hd |
| 106 | rw [hgf hs.2.2] at hd |
| 107 | exact hd |
| 108 | |
| 109 | end PoincareMT.ReducedLength |