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.ClosedPathPrimitive |
| 2 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Calculus.ODE.Paths.ClosedPathSubstitution |
| 3 | |
| 4 | /-! |
| 5 | # The closed ODE and its actual Picard equation |
| 6 | |
| 7 | Morgan-Tian Lemma 6.18, pp. 113-114. The Banach-valued fundamental |
| 8 | theorem identifies a continuous solution of the actual within ODE with |
| 9 | the closed Picard equation. Conversely the actual primitive derivative |
| 10 | gives the within ODE and initial value, including both endpoints. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open Set |
| 16 | open scoped Topology intervalIntegral |
| 17 | |
| 18 | namespace PoincareMT.M14 |
| 19 | |
| 20 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] |
| 21 | {a b : ℝ} |
| 22 | |
| 23 | /-- An actual continuous within-ODE solution satisfies the closed Picard |
| 24 | equation with its actual initial value, Lemma 6.18, pp. 113-114. -/ |
| 25 | theorem closedPath_picard_equation_of_ode (t₀ : Icc a b) (f : ℝ × E → E) |
| 26 | (hf : ContinuousOn f (Icc a b ×ˢ univ)) (φ : C(Icc a b, E)) |
| 27 | (hode : ∀ r : Icc a b, HasDerivWithinAt |
| 28 | (fun s => φ (projIcc a b (t₀.property.1.trans t₀.property.2) s)) |
| 29 | (f (r.val, φ r)) (Icc a b) r.val) : |
| 30 | φ = ContinuousMap.const _ (φ t₀) + closedPathPrimitive t₀ (closedTimePostcomp f hf φ) := by |
| 31 | let π : C(ℝ, Icc a b) := ⟨projIcc a b (t₀.property.1.trans t₀.property.2), continuous_projIcc⟩ |
| 32 | let γ : C(ℝ, E) := φ.comp π |
| 33 | let g : C(ℝ, E) := (closedTimePostcomp f hf φ).comp π |
| 34 | ext r |
| 35 | have hderiv (s : ℝ) (hs : s ∈ Ioo (min t₀.val r.val) (max t₀.val r.val)) : |
| 36 | HasDerivWithinAt γ (g s) (Ioi s) s := by |
| 37 | have hsab : s ∈ Ioo a b := |
| 38 | ⟨(le_min t₀.property.1 r.property.1).trans_lt hs.1, |
| 39 | hs.2.trans_le (max_le t₀.property.2 r.property.2)⟩ |
| 40 | have hπ : π s = ⟨s, Ioo_subset_Icc_self hsab⟩ := |
| 41 | projIcc_of_mem (t₀.property.1.trans t₀.property.2) (Ioo_subset_Icc_self hsab) |
| 42 | have hg : g s = f (s, φ ⟨s, Ioo_subset_Icc_self hsab⟩) := by |
| 43 | change f ((π s).val, φ (π s)) = _ |
| 44 | rw [hπ] |
| 45 | rw [hg] |
| 46 | exact ((hode ⟨s, Ioo_subset_Icc_self hsab⟩).hasDerivAt |
| 47 | (Icc_mem_nhds hsab.1 hsab.2)).hasDerivWithinAt |
| 48 | have hFTC := intervalIntegral.integral_eq_sub_of_hasDeriv_right γ.continuous.continuousOn |
| 49 | hderiv (g.continuous.intervalIntegrable t₀.val r.val) |
| 50 | have hπr : π r.val = r := projIcc_of_mem (t₀.property.1.trans t₀.property.2) r.property |
| 51 | have hπ₀ : π t₀.val = t₀ := projIcc_of_mem (t₀.property.1.trans t₀.property.2) t₀.property |
| 52 | change (∫ s in t₀.val..r.val, g s) = φ (π r.val) - φ (π t₀.val) at hFTC |
| 53 | rw [hπr, hπ₀] at hFTC |
| 54 | change φ r = φ t₀ + closedPathPrimitive t₀ (closedTimePostcomp f hf φ) r |
| 55 | rw [closedPathPrimitive_apply] |
| 56 | change φ r = φ t₀ + ∫ s in t₀.val..r.val, g s |
| 57 | rw [hFTC, add_sub_cancel] |
| 58 | |
| 59 | /-- The actual closed Picard equation gives its prescribed initial |
| 60 | value and the genuine within ODE at all closed times, Lemma 6.18, |
| 61 | pp. 113-114. -/ |
| 62 | theorem closedPath_ode_of_picard_equation (t₀ : Icc a b) (f : ℝ × E → E) |
| 63 | (hf : ContinuousOn f (Icc a b ×ˢ univ)) (x₀ : E) (φ : C(Icc a b, E)) |
| 64 | (heq : φ = ContinuousMap.const _ x₀ + closedPathPrimitive t₀ (closedTimePostcomp f hf φ)) : |
| 65 | φ t₀ = x₀ ∧ ∀ r : Icc a b, HasDerivWithinAt |
| 66 | (fun s => φ (projIcc a b (t₀.property.1.trans t₀.property.2) s)) |
| 67 | (f (r.val, φ r)) (Icc a b) r.val := by |
| 68 | constructor |
| 69 | · have hi := congrArg (fun v : C(Icc a b, E) => v t₀) heq |
| 70 | simpa only [ContinuousMap.add_apply, ContinuousMap.const_apply, |
| 71 | closedPathPrimitive_initial, add_zero] using hi |
| 72 | · intro r |
| 73 | have hd := (hasDerivWithinAt_const r.val (Icc a b) x₀).add |
| 74 | (closedPathPrimitive_hasDerivWithinAt t₀ r (closedTimePostcomp f hf φ)) |
| 75 | change HasDerivWithinAt |
| 76 | (fun s => x₀ + closedPathPrimitive t₀ (closedTimePostcomp f hf φ) |
| 77 | (projIcc a b (t₀.property.1.trans t₀.property.2) s)) |
| 78 | (0 + f (r.val, φ r)) (Icc a b) r.val at hd |
| 79 | rw [zero_add] at hd |
| 80 | apply hd.congr_of_mem _ r.property |
| 81 | intro s _ |
| 82 | exact congrArg (fun v : C(Icc a b, E) => |
| 83 | v (projIcc a b (t₀.property.1.trans t₀.property.2) s)) heq |
| 84 | |
| 85 | end PoincareMT.M14 |