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.Surgery.StandardCap.Persistence.Limit.Coordinates.RicciTimeGluing |
| 2 | |
| 3 | /-! |
| 4 | # The limiting coordinate Ricci equation at birth |
| 5 | |
| 6 | Continuity of the actual spatial jets makes the Ricci right-hand side |
| 7 | continuous at time zero. The interior equation therefore extends as a |
| 8 | right derivative at the included birth endpoint. |
| 9 | Morgan--Tian, Claim 16.6 and Corollary 16.9, pp. 371-373; |
| 10 | M44 derivation 80. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | set_option backward.isDefEq.respectTransparency false |
| 15 | -- The Ricci two-jet uses nested continuous-linear coefficient spaces. |
| 16 | set_option maxSynthPendingDepth 12 |
| 17 | |
| 18 | open Set Filter |
| 19 | open scoped ContDiff Topology |
| 20 | |
| 21 | namespace PoincareMT.M44 |
| 22 | |
| 23 | open SpacetimeBounds SpacetimeBounds.Bootstrap |
| 24 | |
| 25 | /-- A continuous interior evolution equation extends to its |
| 26 | included birth endpoint. Source: the birth step of Corollary 16.9; |
| 27 | M44 derivation 80, using Mathlib's one-sided derivative extension. -/ |
| 28 | theorem hasDerivWithinAt_birth_of_continuous_evolution |
| 29 | {V : Type*} [NormedAddCommGroup V] [NormedSpace ℝ V] |
| 30 | {f g : ℝ → V} {T : ℝ} (hT : 0 < T) |
| 31 | (hf : ContinuousOn f (Ico 0 T)) (hg : ContinuousOn g (Ico 0 T)) |
| 32 | (hevolution : ∀ t ∈ Ioo 0 T, HasDerivAt f (g t) t) : |
| 33 | HasDerivWithinAt f (g 0) (Ico 0 T) 0 := by |
| 34 | have hzero : (0 : ℝ) ∈ Ico 0 T := ⟨le_rfl, hT⟩ |
| 35 | have hderiv : ∀ᶠ t in 𝓝[>] (0 : ℝ), HasDerivAt f (g t) t := by |
| 36 | filter_upwards [Ioo_mem_nhdsGT hT] with t ht |
| 37 | exact hevolution t ht |
| 38 | have hglim : Tendsto g (𝓝[>] (0 : ℝ)) (𝓝 (g 0)) := |
| 39 | ((hg 0 hzero).mono_of_mem_nhdsWithin (Ico_mem_nhdsGE hT)).mono Ioi_subset_Ici_self |
| 40 | have hright : HasDerivWithinAt f (g 0) (Ici 0) 0 := |
| 41 | hasDerivWithinAt_Ici_of_tendsto_deriv |
| 42 | (s := Ioo 0 T) |
| 43 | (fun t ht => (hevolution t ht).differentiableAt.differentiableWithinAt) |
| 44 | ((hf 0 hzero).mono Ioo_subset_Ico_self) (Ioo_mem_nhdsGT hT) |
| 45 | (hglim.congr' (hderiv.mono fun _ ht => ht.deriv.symm)) |
| 46 | exact hright.mono (fun _ ht => ht.1) |
| 47 | |
| 48 | set_option maxHeartbeats 800000 in |
| 49 | -- Reducing the actual Ricci two-jet requires the neighboring gluing lemma's budget. |
| 50 | /-- The actual coordinate Ricci equation extends to birth from |
| 51 | continuous spatial jets and invertible limiting coefficients. |
| 52 | Source: Claim 16.6 and Corollary 16.9; M44 derivation 80. -/ |
| 53 | theorem hasDerivWithinAt_ricci_coefficients_birth |
| 54 | {n : ℕ} {T : ℝ} {U : Set (EuclideanSpace ℝ (Fin n))} |
| 55 | (hT : 0 < T) |
| 56 | {B : ℝ × EuclideanSpace ℝ (Fin n) → MetricCoefficient n} |
| 57 | (hB : ContinuousOn B (Ico 0 T ×ˢ U)) |
| 58 | (hjets : ∀ m : ℕ, ContinuousOn |
| 59 | (fun p => iteratedFDeriv ℝ m (fun x => B (p.1, x)) p.2) (Ico 0 T ×ˢ U)) |
| 60 | (hinvertible : ∀ p ∈ Ico 0 T ×ˢ U, (B p).IsInvertible) |
| 61 | (hevolution : ∀ t ∈ Ioo 0 T, ∀ x ∈ U, |
| 62 | HasDerivAt (fun s => B (s, x)) |
| 63 | (ricciFlowOperator n (metricTwoJet (fun y => B (t, y)) x)) t) |
| 64 | {x : EuclideanSpace ℝ (Fin n)} (hx : x ∈ U) : |
| 65 | HasDerivWithinAt (fun s => B (s, x)) |
| 66 | (ricciFlowOperator n (metricTwoJet (fun y => B (0, y)) x)) (Ico 0 T) 0 := by |
| 67 | have hjet : ContinuousOn (spatialJet 2 B) (Ico 0 T ×ˢ U) := |
| 68 | continuousOn_pi.mpr fun m => hjets m.1 |
| 69 | have hrhs : ContinuousOn (fun p => jetRicciFlowOperator n (spatialJet 2 B p)) |
| 70 | (Ico 0 T ×ˢ U) := by |
| 71 | apply (contDiffOn_jetRicciFlowOperator n).continuousOn.comp hjet |
| 72 | intro p hp |
| 73 | change (twoJetProjection n (spatialJet 2 B p)).1.IsInvertible |
| 74 | rw [twoJetProjection_spatialJet] |
| 75 | exact hinvertible p hp |
| 76 | have htime := hrhs.comp (continuousOn_id.prodMk continuousOn_const) |
| 77 | (fun _ ht => ⟨ht, hx⟩) |
| 78 | simp only [jetRicciFlowOperator, Function.comp_apply, twoJetProjection_spatialJet] at htime |
| 79 | exact hasDerivWithinAt_birth_of_continuous_evolution hT |
| 80 | (hB.comp (continuousOn_id.prodMk continuousOn_const) (fun _ ht => ⟨ht, hx⟩)) |
| 81 | htime (fun t ht => hevolution t ht x hx) |
| 82 | |
| 83 | end PoincareMT.M44 |