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 Mathlib.Analysis.Calculus.ContDiff.Basic |
| 2 | import Mathlib.Analysis.Calculus.ContDiff.Operations |
| 3 | import Mathlib.Analysis.Calculus.ContDiff.FTaylorSeries |
| 4 | |
| 5 | /-! |
| 6 | # Spatial iterated derivatives |
| 7 | |
| 8 | The iterated derivative of a smooth function on a time-space product, restricted |
| 9 | to a fixed time slice, is the ambient iterated derivative on spatial vectors. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | open scoped ContDiff Topology Pointwise |
| 15 | open Set |
| 16 | |
| 17 | namespace Poincare.Analysis |
| 18 | |
| 19 | /-! Restriction of a local smooth time-space function to a fixed time slice. -/ |
| 20 | theorem iteratedFDeriv_spatial_slice |
| 21 | {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 22 | [NormedAddCommGroup F] [NormedSpace ℝ F] |
| 23 | (f : ℝ × E → F) {t : ℝ} {x : E} |
| 24 | (hf : ContDiffAt ℝ ∞ f (t, x)) (r : ℕ) |
| 25 | (v : Fin r → E) : |
| 26 | iteratedFDeriv ℝ r (fun y => f (t, y)) x v = |
| 27 | iteratedFDeriv ℝ r f (t, x) (fun i => (0, v i)) := by |
| 28 | let a : ℝ × E := (t, 0) |
| 29 | let ι : E →L[ℝ] ℝ × E := ContinuousLinearMap.inr ℝ ℝ E |
| 30 | have hr_le : (r : ℕ∞ω) ≤ (∞ : ℕ∞ω) := by |
| 31 | change (↑(r : ℕ∞) : ℕ∞ω) ≤ (↑(⊤ : ℕ∞) : ℕ∞ω) |
| 32 | exact WithTop.coe_le_coe.mpr le_top |
| 33 | have hr_ne : (r : ℕ∞ω) ≠ (∞ : ℕ∞ω) := by |
| 34 | change (↑(r : ℕ∞) : ℕ∞ω) ≠ (↑(⊤ : ℕ∞) : ℕ∞ω) |
| 35 | intro h |
| 36 | have h' : (r : ℕ∞) = (⊤ : ℕ∞) := WithTop.coe_inj.mp h |
| 37 | exact WithTop.coe_ne_top h' |
| 38 | obtain ⟨u, hu, hfu⟩ := hf.contDiffOn (m := (r : ℕ∞ω)) hr_le (by |
| 39 | intro hr |
| 40 | exact (hr_ne hr).elim) |
| 41 | obtain ⟨s, hsu, hsopen, hxs⟩ := mem_nhds_iff.mp hu |
| 42 | let s' : Set (ℝ × E) := (fun z : ℝ × E => a + z) ⁻¹' s |
| 43 | have hs'open : IsOpen s' := hsopen.preimage (continuous_const.add continuous_id) |
| 44 | have hshift : ContDiffOn ℝ (r : ℕ∞ω) (fun z : ℝ × E => f (a + z)) s' := by |
| 45 | apply hfu.comp |
| 46 | · exact (contDiff_const.add contDiff_id).contDiffOn |
| 47 | · intro z hz |
| 48 | change a + z ∈ s at hz |
| 49 | exact hsu hz |
| 50 | have hιopen : IsOpen (ι ⁻¹' s') := hs'open.preimage ι.continuous |
| 51 | have hιx : ι x ∈ s' := by |
| 52 | change a + (0, x) ∈ s |
| 53 | simpa [a] using hxs |
| 54 | have hcomp := ι.iteratedFDerivWithin_comp_right hshift hs'open.uniqueDiffOn |
| 55 | hιopen.uniqueDiffOn hιx (i := r) (by simp) |
| 56 | have hset : a +ᵥ s' = s := by |
| 57 | ext y |
| 58 | rw [Set.mem_vadd_set_iff_neg_vadd_mem] |
| 59 | simp [s'] |
| 60 | have hleft := iteratedFDerivWithin_of_isOpen (𝕜 := ℝ) |
| 61 | (f := (fun z : E => f (a + ι z))) (s := ι ⁻¹' s') r hιopen hιx |
| 62 | have hright := iteratedFDerivWithin_comp_add_left (𝕜 := ℝ) (f := f) |
| 63 | (s := s') r a (ι x) |
| 64 | calc |
| 65 | iteratedFDeriv ℝ r (fun y => f (t, y)) x v = |
| 66 | iteratedFDerivWithin ℝ r ((fun z : ℝ × E => f (a + z)) ∘ ι) |
| 67 | (ι ⁻¹' s') x v := by |
| 68 | change iteratedFDeriv ℝ r (fun y => f (t, y)) x v = |
| 69 | (iteratedFDerivWithin ℝ r (fun z : E => f (a + ι z)) |
| 70 | (ι ⁻¹' s') x) v |
| 71 | rw [hleft] |
| 72 | simp [a, ι] |
| 73 | _ = ((iteratedFDerivWithin ℝ r (fun z : ℝ × E => f (a + z)) |
| 74 | s' (ι x)).compContinuousLinearMap (fun _ => ι)) v := by |
| 75 | rw [hcomp] |
| 76 | _ = iteratedFDeriv ℝ r f (t, x) (fun i => (0, v i)) := by |
| 77 | rw [hright, hset] |
| 78 | have hax : a + ι x = (t, x) := by simp [a, ι] |
| 79 | rw [hax] |
| 80 | rw [iteratedFDerivWithin_of_isOpen (𝕜 := ℝ) r hsopen hxs] |
| 81 | simp [ι] |
| 82 | |
| 83 | end Poincare.Analysis |