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.Local.ClosedPicardEquation |
| 2 | |
| 3 | /-! |
| 4 | # Commuting parameter and closed time derivatives of path families |
| 5 | |
| 6 | Morgan-Tian Lemma 6.18, pp. 113-114. The actual within time equation |
| 7 | is equivalent to an identity in the Banach space of continuous paths. |
| 8 | Its bounded linear primitive commutes with parameter differentiation, |
| 9 | giving mixed derivatives at the closed endpoints too. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | open Set Filter |
| 15 | open scoped Topology ContDiff |
| 16 | |
| 17 | namespace PoincareMT.M14 |
| 18 | |
| 19 | variable {P F : Type*} [NormedAddCommGroup P] [NormedSpace ℝ P] |
| 20 | [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] {a b : ℝ} |
| 21 | |
| 22 | /-- The actual within derivative of a continuous path gives its integral |
| 23 | identity in the sup path norm, the closed FTC used in Lemma 6.18, |
| 24 | pp. 113-114. -/ |
| 25 | theorem closedPath_eq_const_add_primitive (t₀ : Icc a b) (φ ψ : C(Icc a b, F)) |
| 26 | (hd : ∀ r : Icc a b, HasDerivWithinAt |
| 27 | (fun s => φ (projIcc a b (t₀.property.1.trans t₀.property.2) s)) |
| 28 | (ψ r) (Icc a b) r.val) : |
| 29 | φ = ContinuousMap.const _ (φ t₀) + closedPathPrimitive t₀ ψ := by |
| 30 | let f : ℝ × F → F := fun z => ψ (projIcc a b (t₀.property.1.trans t₀.property.2) z.1) |
| 31 | have hf : ContinuousOn f (Icc a b ×ˢ univ) := |
| 32 | (ψ.continuous.comp (continuous_projIcc.comp continuous_fst)).continuousOn |
| 33 | have hpost : closedTimePostcomp f hf φ = ψ := by |
| 34 | ext r |
| 35 | change ψ (projIcc a b (t₀.property.1.trans t₀.property.2) r.val) = ψ r |
| 36 | rw [projIcc_of_mem (t₀.property.1.trans t₀.property.2) r.property] |
| 37 | have h := closedPath_picard_equation_of_ode t₀ f hf φ (fun r => by |
| 38 | dsimp only [f] |
| 39 | rw [projIcc_of_mem (t₀.property.1.trans t₀.property.2) r.property] |
| 40 | exact hd r) |
| 41 | rwa [hpost] at h |
| 42 | |
| 43 | /-- A path integral identity retains its actual within derivative at |
| 44 | both endpoints, the reverse closed FTC in Lemma 6.18, pp. 113-114. -/ |
| 45 | theorem closedPath_hasDerivWithinAt_of_primitive (t₀ : Icc a b) |
| 46 | (φ ψ : C(Icc a b, F)) (c : F) |
| 47 | (heq : φ = ContinuousMap.const _ c + closedPathPrimitive t₀ ψ) (r : Icc a b) : |
| 48 | HasDerivWithinAt |
| 49 | (fun s => φ (projIcc a b (t₀.property.1.trans t₀.property.2) s)) |
| 50 | (ψ r) (Icc a b) r.val := by |
| 51 | have h := (hasDerivWithinAt_const r.val (Icc a b) c).add |
| 52 | (closedPathPrimitive_hasDerivWithinAt t₀ r ψ) |
| 53 | rw [zero_add] at h |
| 54 | apply h.congr_of_mem _ r.property |
| 55 | intro s _ |
| 56 | exact congrArg (fun v : C(Icc a b, F) => |
| 57 | v (projIcc a b (t₀.property.1.trans t₀.property.2) s)) heq |
| 58 | |
| 59 | /-- Parameter differentiation in the sup path norm commutes with the |
| 60 | actual closed time derivative, including endpoints. This supplies the |
| 61 | mixed-derivative bootstrap in Lemma 6.18, pp. 113-114. -/ |
| 62 | theorem closedPath_parameter_time_derivative (t₀ : Icc a b) {U : Set P} (hU : IsOpen U) |
| 63 | (Φ Ψ : P → C(Icc a b, F)) (hΦ : DifferentiableOn ℝ Φ U) |
| 64 | (hΨ : DifferentiableOn ℝ Ψ U) |
| 65 | (ht : ∀ x ∈ U, ∀ r : Icc a b, HasDerivWithinAt |
| 66 | (fun s => Φ x (projIcc a b (t₀.property.1.trans t₀.property.2) s)) |
| 67 | (Ψ x r) (Icc a b) r.val) {x : P} (hx : x ∈ U) (v : P) (r : Icc a b) : |
| 68 | HasDerivWithinAt |
| 69 | (fun s => fderiv ℝ Φ x v (projIcc a b (t₀.property.1.trans t₀.property.2) s)) |
| 70 | (fderiv ℝ Ψ x v r) (Icc a b) r.val := by |
| 71 | let C₀ : F →L[ℝ] C(Icc a b, F) := ContinuousLinearMap.const ℝ (Icc a b) |
| 72 | let ev : C(Icc a b, F) →L[ℝ] F := ContinuousMap.evalCLM ℝ t₀ |
| 73 | let L := closedPathPrimitive (E := F) t₀ |
| 74 | have hdΦ := ((hΦ x hx).differentiableAt (hU.mem_nhds hx)).hasFDerivAt |
| 75 | have hdΨ := ((hΨ x hx).differentiableAt (hU.mem_nhds hx)).hasFDerivAt |
| 76 | have heq : ∀ᶠ y in 𝓝 x, Φ y = C₀ (ev (Φ y)) + L (Ψ y) := by |
| 77 | filter_upwards [hU.mem_nhds hx] with y hy |
| 78 | exact closedPath_eq_const_add_primitive t₀ (Φ y) (Ψ y) (ht y hy) |
| 79 | have hd := ((C₀.hasFDerivAt.comp x (ev.hasFDerivAt.comp x hdΦ)).add |
| 80 | (L.hasFDerivAt.comp x hdΨ)).congr_of_eventuallyEq heq |
| 81 | have hpath : fderiv ℝ Φ x v = ContinuousMap.const _ (fderiv ℝ Φ x v t₀) + |
| 82 | closedPathPrimitive t₀ (fderiv ℝ Ψ x v) := |
| 83 | congrArg (fun A : P →L[ℝ] C(Icc a b, F) => A v) (hdΦ.unique hd) |
| 84 | exact closedPath_hasDerivWithinAt_of_primitive t₀ _ _ _ hpath r |
| 85 | |
| 86 | end PoincareMT.M14 |