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.Generalized.ReducedGeometry.Calculus.ODE.Paths.ClosedPathJointSmooth |
| 2 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Calculus.ODE.Paths.ClosedPathSubstitution |
| 3 | |
| 4 | /-! |
| 5 | # Actual closed time jets of a smooth ODE family |
| 6 | |
| 7 | Morgan-Tian Lemma 6.18, pp. 113-114. Repeated differentiation along |
| 8 | the actual vector (1,f) supplies smooth closed time jets. Substitution |
| 9 | in a smooth family of continuous paths and the actual within ODE give |
| 10 | the hypotheses for joint smoothness at the closed endpoints. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open Set |
| 16 | open scoped Topology ContDiff |
| 17 | |
| 18 | namespace PoincareMT.M14 |
| 19 | |
| 20 | variable {P E : Type*} [NormedAddCommGroup P] [NormedSpace ℝ P] |
| 21 | [FiniteDimensional ℝ P] [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 22 | [FiniteDimensional ℝ E] {a b : ℝ} |
| 23 | |
| 24 | /-- Repeated differentiation of the state projection along the actual |
| 25 | closed-time ODE vector gives its time-jet coefficients, Lemma 6.18, |
| 26 | pp. 113-114. -/ |
| 27 | noncomputable def closedODETimeJet (C : Set ℝ) (f : ℝ × E → E) : ℕ → ℝ × E → E |
| 28 | | 0 => Prod.snd |
| 29 | | j + 1 => fun z => fderivWithin ℝ (closedODETimeJet C f j) (C ×ˢ univ) z (1, f z) |
| 30 | |
| 31 | omit [FiniteDimensional ℝ E] in |
| 32 | /-- The actual time-jet coefficients are smooth on their original |
| 33 | closed slab, retaining within derivatives, Lemma 6.18, pp. 113-114. -/ |
| 34 | theorem closedODETimeJet_contDiffOn {C : Set ℝ} (hC : UniqueDiffOn ℝ C) |
| 35 | (f : ℝ × E → E) (hf : ContDiffOn ℝ ∞ f (C ×ˢ univ)) (j : ℕ) : |
| 36 | ContDiffOn ℝ ∞ (closedODETimeJet C f j) (C ×ˢ univ) := by |
| 37 | induction j with |
| 38 | | zero => exact contDiffOn_snd |
| 39 | | succ j ih => |
| 40 | exact (ih.fderivWithin (hC.prod uniqueDiffOn_univ) (by simp)).clm_apply |
| 41 | (contDiffOn_const.prodMk hf) |
| 42 | |
| 43 | /-- An actual closed ODE family smooth into continuous paths is jointly |
| 44 | smooth on its open parameter set and closed time interval. The actual |
| 45 | ODE supplies every time jet, including endpoints, Lemma 6.18, |
| 46 | pp. 113-114. -/ |
| 47 | theorem closedODEFamily_joint_contDiff (hab : a < b) (t₀ : Icc a b) |
| 48 | {U : Set P} (hU : IsOpen U) (f : ℝ × E → E) |
| 49 | (hf : ContDiffOn ℝ ∞ f (Icc a b ×ˢ univ)) (Φ : P → C(Icc a b, E)) |
| 50 | (hΦ : ContDiffOn ℝ ∞ Φ U) |
| 51 | (ht : ∀ x ∈ U, ∀ r : Icc a b, HasDerivWithinAt |
| 52 | (fun s => Φ x (projIcc a b hab.le s)) (f (r.val, Φ x r)) (Icc a b) r.val) : |
| 53 | ContDiffOn ℝ ∞ (closedPathEvaluation hab.le Φ) (U ×ˢ Icc a b) := by |
| 54 | have hJ := closedODETimeJet_contDiffOn (uniqueDiffOn_Icc hab) f hf |
| 55 | let Ψ : ℕ → P → C(Icc a b, E) := fun j x => |
| 56 | closedTimePostcomp (closedODETimeJet (Icc a b) f j) (hJ j).continuousOn (Φ x) |
| 57 | have hΨ (j : ℕ) : ContDiffOn ℝ ∞ (Ψ j) U := |
| 58 | (closedTimePostcomp_contDiff (uniqueDiffOn_Icc hab) _ (hJ j)).comp_contDiffOn hΦ |
| 59 | have hΨt (j : ℕ) (x : P) (hx : x ∈ U) (r : Icc a b) : HasDerivWithinAt |
| 60 | (fun s => Ψ j x (projIcc a b hab.le s)) (Ψ (j + 1) x r) (Icc a b) r.val := by |
| 61 | let γ : ℝ → ℝ × E := fun s => (s, Φ x (projIcc a b hab.le s)) |
| 62 | have hπ : projIcc a b hab.le r.val = r := projIcc_of_mem hab.le r.property |
| 63 | have hdγ : HasDerivWithinAt γ (1, f (r.val, Φ x r)) (Icc a b) r.val := |
| 64 | (hasDerivWithinAt_id r.val (Icc a b)).prodMk (ht x hx r) |
| 65 | have hγ : γ r.val ∈ Icc a b ×ˢ (univ : Set E) := ⟨r.property, mem_univ _⟩ |
| 66 | have hd := ((hJ j).differentiableOn (by simp) _ hγ).hasFDerivWithinAt.comp_hasDerivWithinAt |
| 67 | r.val hdγ (fun s hs => ⟨hs, mem_univ _⟩) |
| 68 | have hγr : γ r.val = (r.val, Φ x r) := by dsimp only [γ]; rw [hπ] |
| 69 | rw [hγr] at hd |
| 70 | apply hd.congr_of_mem _ r.property |
| 71 | intro s hs |
| 72 | change closedODETimeJet (Icc a b) f j |
| 73 | ((projIcc a b hab.le s).val, Φ x (projIcc a b hab.le s)) = |
| 74 | closedODETimeJet (Icc a b) f j (s, Φ x (projIcc a b hab.le s)) |
| 75 | rw [projIcc_of_mem hab.le hs] |
| 76 | exact closedPath_timeJets_contDiff hab t₀ hU Ψ hΨ hΨt |
| 77 | |
| 78 | end PoincareMT.M14 |