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.Analysis.ODE.ParameterSuperposition |
| 2 | import Mathlib.Analysis.Calculus.ContDiff.Comp |
| 3 | import Mathlib.Analysis.Calculus.ContDiff.Operations |
| 4 | import Mathlib.Analysis.Calculus.ImplicitContDiff |
| 5 | |
| 6 | /-! |
| 7 | # Implicit for parameter dependent ODEs |
| 8 | |
| 9 | Adapted from the corresponding DoCarmo analytic development at workspace |
| 10 | revision 1971ab2f. Supports Morgan--Tian (2007), equation (3.9) and |
| 11 | Claim 3.16, p. 42, through smooth dependence of local flows. |
| 12 | -/ |
| 13 | |
| 14 | open Filter Set |
| 15 | open scoped Topology ContDiff |
| 16 | |
| 17 | set_option linter.unusedSectionVars false |
| 18 | |
| 19 | noncomputable section |
| 20 | |
| 21 | namespace Poincare.ODE.Parameter |
| 22 | |
| 23 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] |
| 24 | |
| 25 | theorem contDiff_picardResidual {T : ℝ} (hT : 0 ≤ T) {f : E → E} (hf : ContDiff ℝ ∞ f) : |
| 26 | ContDiff ℝ ∞ (picardResidual hT f) := by |
| 27 | have h1 : ContDiff ℝ ∞ (fun q : E × C(Set.Icc (0:ℝ) T, E) => q.2) := contDiff_snd |
| 28 | have h2 : ContDiff ℝ ∞ |
| 29 | (fun q : E × C(Set.Icc (0:ℝ) T, E) => ContinuousMap.const (Set.Icc (0:ℝ) T) q.1) := |
| 30 | ContDiff.continuousLinearMap_comp |
| 31 | (ContinuousLinearMap.const ℝ (Set.Icc (0:ℝ) T) : E →L[ℝ] C(Set.Icc (0:ℝ) T, E)) |
| 32 | contDiff_fst |
| 33 | have h3 : ContDiff ℝ ∞ |
| 34 | (fun q : E × C(Set.Icc (0:ℝ) T, E) => intervalPrimitive hT (superposition f q.2)) := |
| 35 | ContDiff.continuousLinearMap_comp (intervalPrimitive hT) |
| 36 | ((contDiff_superposition_infty hf).comp contDiff_snd) |
| 37 | exact (h1.sub h2).sub h3 |
| 38 | |
| 39 | theorem hasStrictFDerivAt_picardResidual {T : ℝ} (hT : 0 < T) |
| 40 | {f : E → E} {f' : E → E →L[ℝ] E} {u : Set E} (hu : IsOpen u) |
| 41 | (hd : ∀ x ∈ u, HasFDerivAt f (f' x) x) |
| 42 | {x₀ : E} {α₀ : C(Set.Icc (0:ℝ) T, E)} (hmem : ∀ t, α₀ t ∈ u) |
| 43 | (hc : ∀ t, ContinuousAt f' (α₀ t)) |
| 44 | {A₀ : C(Set.Icc (0:ℝ) T, E →L[ℝ] E)} (hA₀ : ∀ t, A₀ t = f' (α₀ t)) : |
| 45 | HasStrictFDerivAt (picardResidual hT.le f) |
| 46 | (ContinuousLinearMap.snd ℝ E C(Set.Icc (0:ℝ) T, E) |
| 47 | - (ContinuousLinearMap.const ℝ (Set.Icc (0:ℝ) T)).comp |
| 48 | (ContinuousLinearMap.fst ℝ E C(Set.Icc (0:ℝ) T, E)) |
| 49 | - ((intervalPrimitive hT.le).comp (postcompCurve A₀)).comp |
| 50 | (ContinuousLinearMap.snd ℝ E C(Set.Icc (0:ℝ) T, E))) (x₀, α₀) := by |
| 51 | set pt : E × C(Set.Icc (0:ℝ) T, E) := (x₀, α₀) with hpt_def |
| 52 | set constE : E →L[ℝ] C(Set.Icc (0:ℝ) T, E) := ContinuousLinearMap.const ℝ (Set.Icc (0:ℝ) T) |
| 53 | set JP : C(Set.Icc (0:ℝ) T, E) →L[ℝ] C(Set.Icc (0:ℝ) T, E) := |
| 54 | (intervalPrimitive hT.le).comp (postcompCurve A₀) with hJP_def |
| 55 | have hN : HasStrictFDerivAt (superposition f) (postcompCurve A₀) α₀ := |
| 56 | hasStrictFDerivAt_superposition hu hd hmem hc hA₀ |
| 57 | have h1 : HasStrictFDerivAt (fun q : E × C(Set.Icc (0:ℝ) T, E) => q.2) |
| 58 | (ContinuousLinearMap.snd ℝ E (C(Set.Icc (0:ℝ) T, E))) pt := hasStrictFDerivAt_snd |
| 59 | have h2 : HasStrictFDerivAt |
| 60 | (fun q : E × C(Set.Icc (0:ℝ) T, E) => ContinuousMap.const (Set.Icc (0:ℝ) T) q.1) |
| 61 | (constE.comp (ContinuousLinearMap.fst ℝ E (C(Set.Icc (0:ℝ) T, E)))) pt := |
| 62 | constE.hasStrictFDerivAt.comp pt hasStrictFDerivAt_fst |
| 63 | have h3b : HasStrictFDerivAt |
| 64 | (fun q : E × C(Set.Icc (0:ℝ) T, E) => superposition f q.2) |
| 65 | ((postcompCurve A₀).comp (ContinuousLinearMap.snd ℝ E (C(Set.Icc (0:ℝ) T, E)))) pt := |
| 66 | hN.comp pt hasStrictFDerivAt_snd |
| 67 | have h3 : HasStrictFDerivAt |
| 68 | (fun q : E × C(Set.Icc (0:ℝ) T, E) => intervalPrimitive hT.le (superposition f q.2)) |
| 69 | (JP.comp (ContinuousLinearMap.snd ℝ E (C(Set.Icc (0:ℝ) T, E)))) pt := |
| 70 | (intervalPrimitive hT.le).hasStrictFDerivAt.comp pt h3b |
| 71 | exact (h1.sub h2).sub h3 |
| 72 | |
| 73 | theorem contDiffAt_flow_of_picardResidual {T : ℝ} (hT : 0 < T) |
| 74 | {f : E → E} (hf : ContDiff ℝ ∞ f) |
| 75 | {x₀ : E} {α₀ : C(Set.Icc (0:ℝ) T, E)} |
| 76 | {A₀ : C(Set.Icc (0:ℝ) T, E →L[ℝ] E)} (hA₀ : ∀ t, A₀ t = fderiv ℝ f (α₀ t)) |
| 77 | (hTL : T * ‖A₀‖ < 1) |
| 78 | {σ : E → C(Set.Icc (0:ℝ) T, E)} |
| 79 | (hσ0 : σ x₀ = α₀) (hσc : ContinuousAt σ x₀) |
| 80 | (hσ : ∀ᶠ x in 𝓝 x₀, picardResidual hT.le f (x, σ x) = 0) : |
| 81 | ContDiffAt ℝ ∞ σ x₀ := by |
| 82 | classical |
| 83 | set pt : E × C(Set.Icc (0:ℝ) T, E) := (x₀, α₀) with hpt_def |
| 84 | set JP : C(Set.Icc (0:ℝ) T, E) →L[ℝ] C(Set.Icc (0:ℝ) T, E) := |
| 85 | (intervalPrimitive hT.le).comp (postcompCurve A₀) with hJP_def |
| 86 | have hcdf : ContDiffAt ℝ ∞ (picardResidual hT.le f) pt := |
| 87 | (contDiff_picardResidual hT.le hf).contDiffAt |
| 88 | have hpn : (∞ : WithTop ℕ∞) ≠ 0 := by simp |
| 89 | have hu0 : picardResidual hT.le f pt = 0 := by |
| 90 | have h := hσ.self_of_nhds; rw [hσ0] at h; exact h |
| 91 | have hG : HasStrictFDerivAt (picardResidual hT.le f) |
| 92 | (ContinuousLinearMap.snd ℝ E C(Set.Icc (0:ℝ) T, E) |
| 93 | - (ContinuousLinearMap.const ℝ (Set.Icc (0:ℝ) T)).comp |
| 94 | (ContinuousLinearMap.fst ℝ E C(Set.Icc (0:ℝ) T, E)) |
| 95 | - JP.comp (ContinuousLinearMap.snd ℝ E C(Set.Icc (0:ℝ) T, E))) pt := |
| 96 | hasStrictFDerivAt_picardResidual hT isOpen_univ |
| 97 | (fun x _ => (hf.differentiable (by simp)).differentiableAt.hasFDerivAt) |
| 98 | (fun _ => Set.mem_univ _) (fun _ => (hf.continuous_fderiv (by simp)).continuousAt) hA₀ |
| 99 | have hfderiv : fderiv ℝ (picardResidual hT.le f) pt |
| 100 | = ContinuousLinearMap.snd ℝ E C(Set.Icc (0:ℝ) T, E) |
| 101 | - (ContinuousLinearMap.const ℝ (Set.Icc (0:ℝ) T)).comp |
| 102 | (ContinuousLinearMap.fst ℝ E C(Set.Icc (0:ℝ) T, E)) |
| 103 | - JP.comp (ContinuousLinearMap.snd ℝ E C(Set.Icc (0:ℝ) T, E)) := hG.hasFDerivAt.fderiv |
| 104 | have hJPnorm : ‖JP‖ < 1 := |
| 105 | (norm_intervalPrimitive_comp_postcompCurve_le hT.le A₀).trans_lt hTL |
| 106 | set w : (C(Set.Icc (0:ℝ) T, E) →L[ℝ] C(Set.Icc (0:ℝ) T, E))ˣ := |
| 107 | Units.oneSub JP hJPnorm with hw_def |
| 108 | have hinvertible : |
| 109 | ((1 : C(Set.Icc (0:ℝ) T, E) →L[ℝ] C(Set.Icc (0:ℝ) T, E)) - JP).IsInvertible := |
| 110 | ContinuousLinearMap.IsInvertible.of_inverse w.mul_inv w.inv_mul |
| 111 | have hinr : fderiv ℝ (picardResidual hT.le f) pt |
| 112 | ∘L ContinuousLinearMap.inr ℝ E C(Set.Icc (0:ℝ) T, E) |
| 113 | = (1 : C(Set.Icc (0:ℝ) T, E) →L[ℝ] C(Set.Icc (0:ℝ) T, E)) - JP := by |
| 114 | rw [hfderiv] |
| 115 | refine ContinuousLinearMap.ext fun β => ?_ |
| 116 | simp |
| 117 | have if₂ : (fderiv ℝ (picardResidual hT.le f) pt |
| 118 | ∘L ContinuousLinearMap.inr ℝ E C(Set.Icc (0:ℝ) T, E)).IsInvertible := by |
| 119 | rw [hinr]; exact hinvertible |
| 120 | set ψ : E → C(Set.Icc (0:ℝ) T, E) := hcdf.implicitFunction hpn if₂ with hψ_def |
| 121 | have hψcd : ContDiffAt ℝ ∞ ψ x₀ := hcdf.contDiffAt_implicitFunction hpn if₂ |
| 122 | have hmap : Filter.Tendsto (fun x : E => (x, σ x)) (𝓝 x₀) (𝓝 pt) := by |
| 123 | have h : Filter.Tendsto (fun x : E => (x, σ x)) (𝓝 x₀) (𝓝 (x₀, σ x₀)) := |
| 124 | continuousAt_id.prodMk hσc |
| 125 | rwa [hσ0] at h |
| 126 | have hev : ∀ᶠ x in 𝓝 x₀, σ x = ψ x := by |
| 127 | filter_upwards [hmap.eventually (hcdf.eventually_apply_eq_iff_implicitFunction hpn if₂), hσ] |
| 128 | with x hx hx0 |
| 129 | exact (hx.mp (by rw [hx0, hu0])).symm |
| 130 | exact hψcd.congr_of_eventuallyEq hev |
| 131 | |
| 132 | end Poincare.ODE.Parameter |
| 133 | |
| 134 | end |
| 135 |