Lean / Reader
Lean reader

BealBakerBound.lean

256 lines10 declarationsno sorryimports Mathlib BealBaker

Lean 4 Web has Mathlib, so it can check files that import only Mathlib. This one also imports BealBaker, which it does not have: you can read it there, but it will not check. Build the project itself to check it.

  1. import Mathlib
  2. import BealBaker
  3. /-!
  4. # D12: an explicit bound from Baker's conjecture for the signature {3, 5, 19}
  5. `baker_bound_3_5_19`: assuming `BakerAbc` (Baker's explicit abc conjecture for `c > 2`), every solution of
  6. `A^x + B^y = C^z` with `gcd(A, B, C) = 1`, all exponents at least 3, `xyz = 285` and `xy + yz + zx = 167` (that is,
  7. `{x, y, z} = {3, 5, 19}` in some order) has `C^z < 10^56`. A computer search of all three orders up to `10^56`
  8. then settles `{3, 5, 19}` under Baker's conjecture (the search is not part of this file).
  9. Ingredients:
  10. * `g n = 2·3·5·7·…·(2n−1)` is a lower bound for any product of `n` distinct primes (`g_le_prod`), so
  11. `rad m ≥ g ω(m)` (`g_le_rad`).
  12. * `(L^ω/ω!)^3 ≤ 3^(3ω) e^L` (`pow_div_factorial_cube_le`), from `(L/3)^ω/ω! ≤ e^(L/3)`.
  13. * With `N = rad(abc)`, `N^285 < c^167` (`BealAbc.abc_sharp`) and Baker, this gives `c^187 < (6/5)^855 · 3^(855 ω)`.
  14. For `ω ≤ 25` that forces `c < 10^56`; for `ω ≥ 26` it contradicts `N ≥ g ω`.
  15. -/
  16. namespace BealBakerBound
  17. open BealAbc BealPartial BealBaker Real Finset
  18. /-- `g n = 2·3·5·…·(2n−1)` (the product of `2` and the first `n − 1` odd numbers above 1). -/
  19. def g : ℕ → ℕ
  20. | 0 => 1
  21. | 1 => 2
  22. | (n + 2) => g (n + 1) * (2 * n + 3)
  23. lemma g_succ {n : ℕ} (hn : 1 ≤ n) : g (n + 1) = g n * (2 * n + 1) := by
  24. obtain ⟨k, rfl⟩ : ∃ k, n = k + 1 := ⟨n - 1, by omega⟩
  25. show g (k + 2) = g (k + 1) * (2 * (k + 1) + 1)
  26. simp only [g]; ring
  27. lemma g_pos (n : ℕ) : 0 < g n := by
  28. induction n using Nat.strong_induction_on with
  29. | _ n ih =>
  30. match n, ih with
  31. | 0, _ => simp [g]
  32. | 1, _ => simp [g]
  33. | (k + 2), ih => simp only [g]; exact Nat.mul_pos (ih (k + 1) (by omega)) (by omega)
  34. /-- A set of primes, all at most `m`, has at most `1 + (m − 1)/2` elements (all but `2` are odd). -/
  35. lemma card_le_of_primes {S : Finset ℕ} (hS : ∀ p ∈ S, p.Prime) {m : ℕ} (hm : ∀ p ∈ S, p ≤ m) :
  36. S.card ≤ 1 + (m - 1) / 2 := by
  37. have hodd : ∀ p ∈ S.erase 2, p % 2 = 1 ∧ 3 ≤ p ∧ p ≤ m := by
  38. intro p hp
  39. rw [Finset.mem_erase] at hp
  40. have hpr := hS p hp.2
  41. have h1 : p % 2 = 1 := by
  42. rcases hpr.eq_two_or_odd with h | h
  43. · exact absurd h hp.1
  44. · exact h
  45. have h2 := hpr.two_le
  46. exact ⟨h1, by omega, hm p hp.2⟩
  47. have h1 : (S.erase 2).card ≤ (Finset.Icc 1 ((m - 1) / 2)).card := by
  48. refine Finset.card_le_card_of_injOn (fun p => p / 2) ?_ ?_
  49. · intro p hp
  50. obtain ⟨ho, h3, hle⟩ := hodd p hp
  51. simp only [Finset.coe_Icc, Set.mem_Icc]
  52. constructor <;> omega
  53. · intro p hp q hq hpq
  54. obtain ⟨hpo, _, _⟩ := hodd p hp
  55. obtain ⟨hqo, _, _⟩ := hodd q hq
  56. simp only at hpq
  57. omega
  58. have h2 : S.card - 1 ≤ (S.erase 2).card := Finset.pred_card_le_card_erase
  59. rw [Nat.card_Icc] at h1
  60. omega
  61. /-- Any product of distinct primes is at least `g` of their number. -/
  62. lemma g_le_prod (S : Finset ℕ) (hS : ∀ p ∈ S, p.Prime) : g S.card ≤ ∏ p ∈ S, p := by
  63. induction S using Finset.induction_on_max with
  64. | empty => simp [g]
  65. | insert a s hlt ih =>
  66. have has : a ∉ s := fun h => lt_irrefl a (hlt a h)
  67. have hs : ∀ p ∈ s, p.Prime := fun p hp => hS p (Finset.mem_insert_of_mem hp)
  68. have ha : a.Prime := hS a (Finset.mem_insert_self a s)
  69. rw [Finset.card_insert_of_notMem has, Finset.prod_insert has]
  70. have hih := ih hs
  71. -- the largest of the `card s + 1` primes is at least `2 card s + 1`
  72. have hcard := card_le_of_primes hS (m := a) (by
  73. intro p hp
  74. rcases Finset.mem_insert.mp hp with h | h
  75. · exact h.le
  76. · exact (hlt p h).le)
  77. rw [Finset.card_insert_of_notMem has] at hcard
  78. rcases Nat.eq_zero_or_pos s.card with h0 | hpos
  79. · rw [h0]
  80. have h2 := ha.two_le
  81. have : ∏ p ∈ s, p = 1 := by rw [Finset.card_eq_zero.mp h0]; simp
  82. rw [this]; simp [g]; omega
  83. · rw [g_succ hpos]
  84. have ha' : 2 * s.card + 1 ≤ a := by omega
  85. calc g s.card * (2 * s.card + 1) ≤ (∏ p ∈ s, p) * a := Nat.mul_le_mul hih ha'
  86. _ = a * ∏ p ∈ s, p := by ring
  87. /-- `rad m ≥ g (number of prime factors of m)`. -/
  88. lemma g_le_rad (m : ℕ) : g m.primeFactors.card ≤ rad m :=
  89. g_le_prod _ (fun p hp => Nat.prime_of_mem_primeFactors hp)
  90. /-- `(L^ω/ω!)^3 ≤ 3^(3ω) e^L` for `L ≥ 0`. -/
  91. lemma pow_div_factorial_cube_le {L : ℝ} (hL : 0 ≤ L) (w : ℕ) :
  92. (L ^ w / w.factorial) ^ 3 ≤ (3 : ℝ) ^ (3 * w) * Real.exp L := by
  93. have h := Real.pow_div_factorial_le_exp (x := L / 3) (by positivity) w
  94. have heq : L ^ w / w.factorial = (3 : ℝ) ^ w * ((L / 3) ^ w / w.factorial) := by
  95. rw [div_pow]; field_simp
  96. have hnn : 0 ≤ (L / 3) ^ w / w.factorial := by positivity
  97. calc (L ^ w / w.factorial) ^ 3 = ((3 : ℝ) ^ w * ((L / 3) ^ w / w.factorial)) ^ 3 := by rw [heq]
  98. _ ≤ ((3 : ℝ) ^ w * Real.exp (L / 3)) ^ 3 := by
  99. apply pow_le_pow_left₀ (by positivity)
  100. exact mul_le_mul_of_nonneg_left h (by positivity)
  101. _ = (3 : ℝ) ^ (3 * w) * Real.exp L := by
  102. rw [mul_pow, ← pow_mul, ← Real.exp_nat_mul]
  103. congr 1
  104. · ring_nf
  105. · congr 1; ring
  106. set_option exponentiation.threshold 30000
  107. set_option maxRecDepth 200000
  108. /-- The numeric step for many prime factors: `6^501 · 3^(501 n) ≤ 5^501 · g(n)^187` for `n ≥ 26`. -/
  109. lemma big_omega_ineq : ∀ n, 26 ≤ n → 6 ^ 501 * 3 ^ (501 * n) ≤ 5 ^ 501 * g n ^ 187 := by
  110. intro n hn
  111. induction n, hn using Nat.le_induction with
  112. | base => decide
  113. | succ n hn ih =>
  114. rw [g_succ (by omega), mul_pow]
  115. have h53 : 3 ^ 501 ≤ (2 * n + 1) ^ 187 :=
  116. calc 3 ^ 501 ≤ 53 ^ 187 := by decide
  117. _ ≤ (2 * n + 1) ^ 187 := Nat.pow_le_pow_left (by omega) 187
  118. calc 6 ^ 501 * 3 ^ (501 * (n + 1)) = 3 ^ 501 * (6 ^ 501 * 3 ^ (501 * n)) := by ring
  119. _ ≤ (2 * n + 1) ^ 187 * (5 ^ 501 * g n ^ 187) := Nat.mul_le_mul h53 ih
  120. _ = 5 ^ 501 * (g n ^ 187 * (2 * n + 1) ^ 187) := by ring
  121. /-- The numeric step for few prime factors: `6^855 · 3^(855·25) ≤ 5^855 · 10^(56·187)`. -/
  122. lemma small_omega_ineq : 6 ^ 855 * 3 ^ (855 * 25) ≤ 5 ^ 855 * 10 ^ (56 * 187) := by decide
  123. /-- **D12.** Baker's conjecture bounds every solution with exponents `{3, 5, 19}` (any order) by `10^56`. -/
  124. theorem baker_bound_3_5_19 (H : BakerAbc) {A B C x y z : ℕ} (hA : 0 < A) (hB : 0 < B)
  125. (hx : 3 ≤ x) (hy : 3 ≤ y) (hz : 3 ≤ z) (hxyz : x * y * z = 285) (hs : x * y + y * z + z * x = 167)
  126. (hsum : A ^ x + B ^ y = C ^ z) (hg : Nat.gcd A (Nat.gcd B C) = 1) : C ^ z < 10 ^ 56 := by
  127. -- the abc triple a + b = c
  128. set a := A ^ x with ha_def
  129. set b := B ^ y with hb_def
  130. set c := C ^ z with hc_def
  131. have hx0 : x ≠ 0 := by omega
  132. have hy0 : y ≠ 0 := by omega
  133. have hz0 : z ≠ 0 := by omega
  134. have hcop := coprime_of_gcd_eq_one hx0 hy0 hz0 hsum hg
  135. have hab : Nat.Coprime a b := Nat.Coprime.pow x y hcop.1
  136. have hapos : 0 < a := pow_pos hA x
  137. have hbpos : 0 < b := pow_pos hB y
  138. have hC : 0 < C := by
  139. rcases Nat.eq_zero_or_pos C with h | h
  140. · have : c = 0 := by rw [hc_def, h, zero_pow hz0]
  141. omega
  142. · exact h
  143. have hC2 : 2 ≤ C := by
  144. rcases Nat.lt_or_ge C 2 with h | h
  145. · have h1 : C = 1 := by omega
  146. have : c = 1 := by rw [hc_def, h1, one_pow]
  147. omega
  148. · exact h
  149. have hc8 : 8 ≤ c := calc 8 = 2 ^ 3 := by norm_num
  150. _ ≤ C ^ 3 := Nat.pow_le_pow_left hC2 3
  151. _ ≤ C ^ z := Nat.pow_le_pow_right hC hz
  152. have hc2 : 2 < c := by omega
  153. -- Baker's inequality
  154. have hbaker := H a b c hapos hbpos hsum hab hc2
  155. set N := rad (a * b * c) with hN_def
  156. set w := (a * b * c).primeFactors.card with hw_def
  157. -- N^285 < c^167 from abc_sharp
  158. have hsharp := abc_sharp (Nat.pos_iff_ne_zero.mp hA) (Nat.pos_iff_ne_zero.mp hB) hx0 hy0 hz0 hsum
  159. rw [hxyz, hs] at hsharp
  160. have hNle : N ≤ A * B * C := by
  161. rw [hN_def, ha_def, hb_def, hc_def,
  162. rad_pow_mul (Nat.pos_iff_ne_zero.mp hA) (Nat.pos_iff_ne_zero.mp hB) (Nat.pos_iff_ne_zero.mp hC) hx0 hy0 hz0]
  163. exact rad_le (by positivity)
  164. have hN285 : N ^ 285 < c ^ 167 := lt_of_le_of_lt (Nat.pow_le_pow_left hNle 285) hsharp
  165. have hN1 : 1 ≤ N := one_le_rad _
  166. -- real form: c^187 < (6/5)^855 · 3^(855 w)
  167. have hNr : (1 : ℝ) ≤ N := by exact_mod_cast hN1
  168. have hL : 0 ≤ Real.log N := Real.log_nonneg hNr
  169. have hcube := pow_div_factorial_cube_le hL w
  170. rw [Real.exp_log (by linarith)] at hcube
  171. have hcr : (0 : ℝ) < c := by exact_mod_cast (by omega : 0 < c)
  172. have hX : (0 : ℝ) ≤ (6 / 5 : ℝ) * N * (Real.log N) ^ w / w.factorial := by positivity
  173. have h3 : (c : ℝ) ^ 3 < ((6 / 5 : ℝ) * N * (Real.log N) ^ w / w.factorial) ^ 3 :=
  174. pow_lt_pow_left₀ hbaker hcr.le (by norm_num)
  175. have h3' : (c : ℝ) ^ 3 < (6 / 5 : ℝ) ^ 3 * (3 : ℝ) ^ (3 * w) * (N : ℝ) ^ 4 := by
  176. calc (c : ℝ) ^ 3 < ((6 / 5 : ℝ) * N * (Real.log N) ^ w / w.factorial) ^ 3 := h3
  177. _ = (6 / 5 : ℝ) ^ 3 * (N : ℝ) ^ 3 * ((Real.log N) ^ w / w.factorial) ^ 3 := by ring
  178. _ ≤ (6 / 5 : ℝ) ^ 3 * (N : ℝ) ^ 3 * ((3 : ℝ) ^ (3 * w) * N) :=
  179. mul_le_mul_of_nonneg_left hcube (by positivity)
  180. _ = (6 / 5 : ℝ) ^ 3 * (3 : ℝ) ^ (3 * w) * (N : ℝ) ^ 4 := by ring
  181. have hN285r : (N : ℝ) ^ 285 < (c : ℝ) ^ 167 := by exact_mod_cast hN285
  182. have h855 : (c : ℝ) ^ 855 < (6 / 5 : ℝ) ^ 855 * (3 : ℝ) ^ (855 * w) * (c : ℝ) ^ 668 := by
  183. have hpos : (0 : ℝ) ≤ (c : ℝ) ^ 3 := by positivity
  184. calc (c : ℝ) ^ 855 = ((c : ℝ) ^ 3) ^ 285 := by ring
  185. _ < ((6 / 5 : ℝ) ^ 3 * (3 : ℝ) ^ (3 * w) * (N : ℝ) ^ 4) ^ 285 :=
  186. pow_lt_pow_left₀ h3' hpos (by norm_num)
  187. _ = (6 / 5 : ℝ) ^ 855 * (3 : ℝ) ^ (855 * w) * ((N : ℝ) ^ 285) ^ 4 := by
  188. rw [mul_pow, mul_pow, ← pow_mul, ← pow_mul, ← pow_mul, ← pow_mul]; ring_nf
  189. _ ≤ (6 / 5 : ℝ) ^ 855 * (3 : ℝ) ^ (855 * w) * ((c : ℝ) ^ 167) ^ 4 := by
  190. apply mul_le_mul_of_nonneg_left _ (by positivity)
  191. exact pow_le_pow_left₀ (by positivity) hN285r.le 4
  192. _ = (6 / 5 : ℝ) ^ 855 * (3 : ℝ) ^ (855 * w) * (c : ℝ) ^ 668 := by ring
  193. have h187 : (c : ℝ) ^ 187 < (6 / 5 : ℝ) ^ 855 * (3 : ℝ) ^ (855 * w) := by
  194. have hc668 : (0 : ℝ) < (c : ℝ) ^ 668 := by positivity
  195. have : (c : ℝ) ^ 187 * (c : ℝ) ^ 668 < (6 / 5 : ℝ) ^ 855 * (3 : ℝ) ^ (855 * w) * (c : ℝ) ^ 668 := by
  196. calc (c : ℝ) ^ 187 * (c : ℝ) ^ 668 = (c : ℝ) ^ 855 := by ring
  197. _ < _ := h855
  198. exact lt_of_mul_lt_mul_right this hc668.le
  199. rcases Nat.lt_or_ge w 26 with hw | hw
  200. · -- few prime factors: c^187 < (10^56)^187
  201. have hsmall : (6 / 5 : ℝ) ^ 855 * (3 : ℝ) ^ (855 * w) ≤ ((10 : ℝ) ^ 56) ^ 187 := by
  202. have hnat : 6 ^ 855 * 3 ^ (855 * w) ≤ 5 ^ 855 * 10 ^ (56 * 187) :=
  203. le_trans (Nat.mul_le_mul_left _ (Nat.pow_le_pow_right (by norm_num) (by omega))) small_omega_ineq
  204. have hnatr : ((6 : ℝ) ^ 855 * (3 : ℝ) ^ (855 * w)) ≤ (5 : ℝ) ^ 855 * (10 : ℝ) ^ (56 * 187) := by
  205. exact_mod_cast hnat
  206. rw [div_pow, ← pow_mul]
  207. rw [div_mul_eq_mul_div, div_le_iff₀ (by positivity)]
  208. linarith [hnatr]
  209. have hlt : (c : ℝ) ^ 187 < ((10 : ℝ) ^ 56) ^ 187 := lt_of_lt_of_le h187 hsmall
  210. have hcr' : (c : ℝ) < (10 : ℝ) ^ 56 :=
  211. lt_of_pow_lt_pow_left₀ 187 (by positivity) hlt
  212. exact_mod_cast hcr'
  213. · -- many prime factors: contradiction with N ≥ g w
  214. exfalso
  215. have hgN : g w ≤ N := g_le_rad _
  216. have hgr : ((g w : ℕ) : ℝ) ^ 285 < (c : ℝ) ^ 167 :=
  217. lt_of_le_of_lt (pow_le_pow_left₀ (by positivity) (by exact_mod_cast hgN) 285) hN285r
  218. have hbig := big_omega_ineq w hw
  219. have hbigr : (6 : ℝ) ^ 501 * (3 : ℝ) ^ (501 * w) ≤ (5 : ℝ) ^ 501 * ((g w : ℕ) : ℝ) ^ 187 := by
  220. exact_mod_cast hbig
  221. -- (g w)^(285·187) < c^(167·187) < ((6/5)^855 3^(855 w))^167 = ((6/5)^501 3^(501 w))^285
  222. have h1 : (((g w : ℕ) : ℝ) ^ 187) ^ 285 < ((6 / 5 : ℝ) ^ 501 * (3 : ℝ) ^ (501 * w)) ^ 285 := by
  223. calc (((g w : ℕ) : ℝ) ^ 187) ^ 285 = (((g w : ℕ) : ℝ) ^ 285) ^ 187 := by ring
  224. _ < ((c : ℝ) ^ 167) ^ 187 := pow_lt_pow_left₀ hgr (by positivity) (by norm_num)
  225. _ = ((c : ℝ) ^ 187) ^ 167 := by ring
  226. _ < ((6 / 5 : ℝ) ^ 855 * (3 : ℝ) ^ (855 * w)) ^ 167 :=
  227. pow_lt_pow_left₀ h187 (by positivity) (by norm_num)
  228. _ = ((6 / 5 : ℝ) ^ 501 * (3 : ℝ) ^ (501 * w)) ^ 285 := by
  229. rw [mul_pow, mul_pow, ← pow_mul, ← pow_mul, ← pow_mul, ← pow_mul]; ring_nf
  230. have h2 : ((g w : ℕ) : ℝ) ^ 187 < (6 / 5 : ℝ) ^ 501 * (3 : ℝ) ^ (501 * w) :=
  231. lt_of_pow_lt_pow_left₀ 285 (by positivity) h1
  232. have h3 : (6 / 5 : ℝ) ^ 501 * (3 : ℝ) ^ (501 * w) ≤ ((g w : ℕ) : ℝ) ^ 187 := by
  233. rw [div_pow, div_mul_eq_mul_div, div_le_iff₀ (by positivity)]
  234. linarith [hbigr]
  235. linarith
  236. end BealBakerBound
  237. #print axioms BealBakerBound.baker_bound_3_5_19