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.Calculus.SmoothCompactness.Operations |
| 2 | |
| 3 | /-! |
| 4 | # Composition estimates linear in the highest inner derivative |
| 5 | |
| 6 | In the differentiated chain rule, only the undifferentiated outer derivative |
| 7 | multiplies the highest inner derivative. Bounding the remaining terms using |
| 8 | lower jets preserves the affine inequality needed for time propagation. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | set_option backward.isDefEq.respectTransparency false |
| 13 | set_option maxHeartbeats 800000 |
| 14 | |
| 15 | open Set Filter |
| 16 | open scoped ContDiff Topology BigOperators |
| 17 | |
| 18 | namespace PoincareMT.SpacetimeBounds |
| 19 | |
| 20 | variable {D E F G : Type*} |
| 21 | [NormedAddCommGroup D] [NormedSpace ℝ D] |
| 22 | [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 23 | [NormedAddCommGroup F] [NormedSpace ℝ F] |
| 24 | [NormedAddCommGroup G] [NormedSpace ℝ G] |
| 25 | |
| 26 | theorem norm_iteratedFDeriv_bilinear_le_of_contDiffAt |
| 27 | (L : E →L[ℝ] F →L[ℝ] G) {f : D → E} {g : D → F} {x : D} |
| 28 | (hf : ContDiffAt ℝ ∞ f x) (hg : ContDiffAt ℝ ∞ g x) (q : ℕ) : |
| 29 | ‖iteratedFDeriv ℝ q (fun y => L (f y) (g y)) x‖ ≤ |
| 30 | ‖L‖ * ∑ i ∈ Finset.range (q + 1), (q.choose i : ℝ) * |
| 31 | ‖iteratedFDeriv ℝ i f x‖ * ‖iteratedFDeriv ℝ (q - i) g x‖ := by |
| 32 | obtain ⟨s, hs, hfs⟩ := hf.contDiffOn (m := (q : ℕ∞ω)) (by exact_mod_cast le_top) (by simp) |
| 33 | obtain ⟨t, ht, hgt⟩ := hg.contDiffOn (m := (q : ℕ∞ω)) (by exact_mod_cast le_top) (by simp) |
| 34 | obtain ⟨v, hv, hvo, hxv⟩ := mem_nhds_iff.mp (inter_mem hs ht) |
| 35 | have h := L.norm_iteratedFDerivWithin_le_of_bilinear |
| 36 | (hfs.mono (fun _ hy => (hv hy).1)) (hgt.mono (fun _ hy => (hv hy).2)) |
| 37 | hvo.uniqueDiffOn hxv (le_refl (q : ℕ∞ω)) |
| 38 | simpa only [iteratedFDerivWithin_of_isOpen _ hvo hxv] using h |
| 39 | |
| 40 | /-- In a positive-order product jet the two highest derivatives never |
| 41 | occur in the same summand. -/ |
| 42 | theorem norm_iteratedFDeriv_bilinear_le_affine_highest |
| 43 | (L : E →L[ℝ] F →L[ℝ] G) {f : D → E} {g : D → F} {x : D} |
| 44 | (hf : ContDiffAt ℝ ∞ f x) (hg : ContDiffAt ℝ ∞ g x) (q : ℕ) |
| 45 | {A B A' B' T : ℝ} (hA : 0 ≤ A) (hB : 0 ≤ B) (hA' : 0 ≤ A') (hB' : 0 ≤ B') |
| 46 | (hT : 1 ≤ T) |
| 47 | (hflow : ∀ j ≤ q, ‖iteratedFDeriv ℝ j f x‖ ≤ A) |
| 48 | (hglow : ∀ j ≤ q, ‖iteratedFDeriv ℝ j g x‖ ≤ B) |
| 49 | (hftop : ‖iteratedFDeriv ℝ (q + 1) f x‖ ≤ A' * T) |
| 50 | (hgtop : ‖iteratedFDeriv ℝ (q + 1) g x‖ ≤ B' * T) : |
| 51 | ‖iteratedFDeriv ℝ (q + 1) (fun y => L (f y) (g y)) x‖ ≤ |
| 52 | (‖L‖ * (A * B' + A' * B + A * B) * |
| 53 | ∑ i ∈ Finset.range (q + 2), ((q + 1).choose i : ℝ)) * T := by |
| 54 | have hT0 : 0 ≤ T := le_trans zero_le_one hT |
| 55 | let C : ℝ := A * B' + A' * B + A * B |
| 56 | have hAB : 0 ≤ A * B := mul_nonneg hA hB |
| 57 | have hAB' : 0 ≤ A * B' := mul_nonneg hA hB' |
| 58 | have hA'B : 0 ≤ A' * B := mul_nonneg hA' hB |
| 59 | have hterm (i : ℕ) (hi : i ≤ q + 1) : |
| 60 | ‖iteratedFDeriv ℝ i f x‖ * ‖iteratedFDeriv ℝ (q + 1 - i) g x‖ ≤ C * T := by |
| 61 | by_cases hi0 : i = 0 |
| 62 | · subst i |
| 63 | simp only [Nat.sub_zero] |
| 64 | apply (mul_le_mul (hflow 0 (by omega)) hgtop (norm_nonneg _) hA).trans |
| 65 | dsimp [C] |
| 66 | nlinarith [mul_nonneg hA'B hT0, mul_nonneg hAB hT0] |
| 67 | by_cases hitop : i = q + 1 |
| 68 | · subst i |
| 69 | rw [Nat.sub_self] |
| 70 | apply (mul_le_mul hftop (hglow 0 (by omega)) (norm_nonneg _) |
| 71 | (mul_nonneg hA' hT0)).trans |
| 72 | dsimp [C] |
| 73 | nlinarith [mul_nonneg hAB' hT0, mul_nonneg hAB hT0] |
| 74 | · apply (mul_le_mul (hflow i (by omega)) (hglow (q + 1 - i) (by omega)) |
| 75 | (norm_nonneg _) hA).trans |
| 76 | dsimp [C] |
| 77 | nlinarith [mul_nonneg hAB' hT0, mul_nonneg hA'B hT0] |
| 78 | apply (norm_iteratedFDeriv_bilinear_le_of_contDiffAt L hf hg (q + 1)).trans |
| 79 | calc |
| 80 | _ ≤ ‖L‖ * ∑ i ∈ Finset.range (q + 2), ((q + 1).choose i : ℝ) * (C * T) := by |
| 81 | apply mul_le_mul_of_nonneg_left _ (norm_nonneg L) |
| 82 | apply Finset.sum_le_sum |
| 83 | intro i hi |
| 84 | rw [mul_assoc] |
| 85 | exact mul_le_mul_of_nonneg_left (hterm i (by have := Finset.mem_range.mp hi; omega)) |
| 86 | (Nat.cast_nonneg _) |
| 87 | _ = _ := by simp only [← Finset.sum_mul, C]; ring |
| 88 | |
| 89 | /-- The coefficient depends only on the outer jets and the lower inner jets, |
| 90 | and the highest inner jet occurs to the first power. -/ |
| 91 | theorem norm_iteratedFDeriv_comp_le_affine_highest |
| 92 | {f : E → F} {g : F → G} {x : E} |
| 93 | (hf : ContDiffAt ℝ ∞ f x) (hg : ContDiffAt ℝ ∞ g (f x)) |
| 94 | (q : ℕ) {A B : ℝ} (hA : 0 ≤ A) (hB : 1 ≤ B) |
| 95 | (houter : ∀ j ≤ q + 1, ‖iteratedFDeriv ℝ j g (f x)‖ ≤ A) |
| 96 | (hinner : ∀ j, 1 ≤ j → j ≤ q → ‖iteratedFDeriv ℝ j f x‖ ≤ B ^ j) : |
| 97 | ‖iteratedFDeriv ℝ (q + 1) (g ∘ f) x‖ ≤ |
| 98 | (∑ i ∈ Finset.range (q + 1), (q.choose i : ℝ) * (i.factorial * A * B ^ i)) * |
| 99 | (‖iteratedFDeriv ℝ (q + 1) f x‖ + B ^ (q + 1)) := by |
| 100 | have hB0 : 0 ≤ B := le_trans zero_le_one hB |
| 101 | have hdf : ContDiffAt ℝ ∞ (fderiv ℝ f) x := hf.fderiv_right (by simp) |
| 102 | have hdg : ContDiffAt ℝ ∞ (fderiv ℝ g) (f x) := hg.fderiv_right (by simp) |
| 103 | have hchain : fderiv ℝ (g ∘ f) =ᶠ[𝓝 x] |
| 104 | (fun y => (fderiv ℝ g (f y)).comp (fderiv ℝ f y)) := by |
| 105 | have hfe := (hf.of_le (show (1 : ℕ∞ω) ≤ ∞ by simp)).eventually (by simp) |
| 106 | have hge := (hg.of_le (show (1 : ℕ∞ω) ≤ ∞ by simp)).eventually (by simp) |
| 107 | filter_upwards [hfe, hf.continuousAt.tendsto.eventually hge] with y hfy hgy |
| 108 | exact ((hgy.differentiableAt (by simp)).hasFDerivAt.comp y |
| 109 | (hfy.differentiableAt (by simp)).hasFDerivAt).fderiv |
| 110 | have hprod := norm_iteratedFDeriv_bilinear_le_of_contDiffAt |
| 111 | (ContinuousLinearMap.compL ℝ E F G) (hdg.comp x hf) hdf q |
| 112 | have hsum0 : 0 ≤ ∑ i ∈ Finset.range (q + 1), (q.choose i : ℝ) * |
| 113 | ‖iteratedFDeriv ℝ i ((fderiv ℝ g) ∘ f) x‖ * |
| 114 | ‖iteratedFDeriv ℝ (q - i) (fderiv ℝ f) x‖ := |
| 115 | Finset.sum_nonneg (fun i _ => by positivity) |
| 116 | have hprod' := hprod.trans (mul_le_of_le_one_left hsum0 |
| 117 | (ContinuousLinearMap.norm_compL_le ℝ E F G)) |
| 118 | rw [← norm_iteratedFDeriv_fderiv] |
| 119 | rw [(hchain.iteratedFDeriv (𝕜 := ℝ) q).eq_of_nhds] |
| 120 | apply hprod'.trans |
| 121 | rw [Finset.sum_mul] |
| 122 | apply Finset.sum_le_sum |
| 123 | intro i hi |
| 124 | have hiq : i ≤ q := Nat.le_of_lt_succ (Finset.mem_range.mp hi) |
| 125 | have hout : ‖iteratedFDeriv ℝ i ((fderiv ℝ g) ∘ f) x‖ ≤ i.factorial * A * B ^ i := by |
| 126 | apply Poincare.Analysis.Calculus.norm_iteratedFDeriv_comp_le_of_contDiffAt hf hdg i |
| 127 | · intro j hj |
| 128 | rw [norm_iteratedFDeriv_fderiv] |
| 129 | exact houter (j + 1) (by omega) |
| 130 | · intro j hj hj' |
| 131 | exact hinner j hj (hj'.trans hiq) |
| 132 | have hin : ‖iteratedFDeriv ℝ (q - i) (fderiv ℝ f) x‖ ≤ |
| 133 | ‖iteratedFDeriv ℝ (q + 1) f x‖ + B ^ (q + 1) := by |
| 134 | rw [norm_iteratedFDeriv_fderiv] |
| 135 | by_cases hi0 : i = 0 |
| 136 | · subst i |
| 137 | simp only [Nat.sub_zero] |
| 138 | exact le_add_of_nonneg_right (pow_nonneg hB0 _) |
| 139 | · apply (hinner (q - i + 1) (by omega) (by omega)).trans |
| 140 | apply le_trans (pow_le_pow_right₀ hB (by omega : q - i + 1 ≤ q + 1)) |
| 141 | exact le_add_of_nonneg_left (norm_nonneg _) |
| 142 | exact mul_le_mul (mul_le_mul_of_nonneg_left hout (Nat.cast_nonneg _)) hin |
| 143 | (norm_nonneg _) (by positivity) |
| 144 | |
| 145 | end PoincareMT.SpacetimeBounds |