Lean / Reader
Lean readerBealBakerBound.lean
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.
import Mathlibimport BealBaker/-!# D12: an explicit bound from Baker's conjecture for the signature {3, 5, 19}`baker_bound_3_5_19`: assuming `BakerAbc` (Baker's explicit abc conjecture for `c > 2`), every solution of`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,`{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`then settles `{3, 5, 19}` under Baker's conjecture (the search is not part of this file).Ingredients:* `g n = 2·3·5·7·…·(2n−1)` is a lower bound for any product of `n` distinct primes (`g_le_prod`), so`rad m ≥ g ω(m)` (`g_le_rad`).* `(L^ω/ω!)^3 ≤ 3^(3ω) e^L` (`pow_div_factorial_cube_le`), from `(L/3)^ω/ω! ≤ e^(L/3)`.* With `N = rad(abc)`, `N^285 < c^167` (`BealAbc.abc_sharp`) and Baker, this gives `c^187 < (6/5)^855 · 3^(855 ω)`.For `ω ≤ 25` that forces `c < 10^56`; for `ω ≥ 26` it contradicts `N ≥ g ω`.-/namespace BealBakerBoundopen BealAbc BealPartial BealBaker Real Finset/-- `g n = 2·3·5·…·(2n−1)` (the product of `2` and the first `n − 1` odd numbers above 1). -/def g : ℕ → ℕ| 0 => 1| 1 => 2| (n + 2) => g (n + 1) * (2 * n + 3)lemma g_succ {n : ℕ} (hn : 1 ≤ n) : g (n + 1) = g n * (2 * n + 1) := byobtain ⟨k, rfl⟩ : ∃ k, n = k + 1 := ⟨n - 1, by omega⟩show g (k + 2) = g (k + 1) * (2 * (k + 1) + 1)simp only [g]; ringlemma g_pos (n : ℕ) : 0 < g n := byinduction n using Nat.strong_induction_on with| _ n ih =>match n, ih with| 0, _ => simp [g]| 1, _ => simp [g]| (k + 2), ih => simp only [g]; exact Nat.mul_pos (ih (k + 1) (by omega)) (by omega)/-- A set of primes, all at most `m`, has at most `1 + (m − 1)/2` elements (all but `2` are odd). -/lemma card_le_of_primes {S : Finset ℕ} (hS : ∀ p ∈ S, p.Prime) {m : ℕ} (hm : ∀ p ∈ S, p ≤ m) :S.card ≤ 1 + (m - 1) / 2 := byhave hodd : ∀ p ∈ S.erase 2, p % 2 = 1 ∧ 3 ≤ p ∧ p ≤ m := byintro p hprw [Finset.mem_erase] at hphave hpr := hS p hp.2have h1 : p % 2 = 1 := byrcases hpr.eq_two_or_odd with h | h· exact absurd h hp.1· exact hhave h2 := hpr.two_leexact ⟨h1, by omega, hm p hp.2⟩have h1 : (S.erase 2).card ≤ (Finset.Icc 1 ((m - 1) / 2)).card := byrefine Finset.card_le_card_of_injOn (fun p => p / 2) ?_ ?_· intro p hpobtain ⟨ho, h3, hle⟩ := hodd p hpsimp only [Finset.coe_Icc, Set.mem_Icc]constructor <;> omega· intro p hp q hq hpqobtain ⟨hpo, _, _⟩ := hodd p hpobtain ⟨hqo, _, _⟩ := hodd q hqsimp only at hpqomegahave h2 : S.card - 1 ≤ (S.erase 2).card := Finset.pred_card_le_card_eraserw [Nat.card_Icc] at h1omega/-- Any product of distinct primes is at least `g` of their number. -/lemma g_le_prod (S : Finset ℕ) (hS : ∀ p ∈ S, p.Prime) : g S.card ≤ ∏ p ∈ S, p := byinduction S using Finset.induction_on_max with| empty => simp [g]| insert a s hlt ih =>have has : a ∉ s := fun h => lt_irrefl a (hlt a h)have hs : ∀ p ∈ s, p.Prime := fun p hp => hS p (Finset.mem_insert_of_mem hp)have ha : a.Prime := hS a (Finset.mem_insert_self a s)rw [Finset.card_insert_of_notMem has, Finset.prod_insert has]have hih := ih hs-- the largest of the `card s + 1` primes is at least `2 card s + 1`have hcard := card_le_of_primes hS (m := a) (byintro p hprcases Finset.mem_insert.mp hp with h | h· exact h.le· exact (hlt p h).le)rw [Finset.card_insert_of_notMem has] at hcardrcases Nat.eq_zero_or_pos s.card with h0 | hpos· rw [h0]have h2 := ha.two_lehave : ∏ p ∈ s, p = 1 := by rw [Finset.card_eq_zero.mp h0]; simprw [this]; simp [g]; omega· rw [g_succ hpos]have ha' : 2 * s.card + 1 ≤ a := by omegacalc g s.card * (2 * s.card + 1) ≤ (∏ p ∈ s, p) * a := Nat.mul_le_mul hih ha'_ = a * ∏ p ∈ s, p := by ring/-- `rad m ≥ g (number of prime factors of m)`. -/lemma g_le_rad (m : ℕ) : g m.primeFactors.card ≤ rad m :=g_le_prod _ (fun p hp => Nat.prime_of_mem_primeFactors hp)/-- `(L^ω/ω!)^3 ≤ 3^(3ω) e^L` for `L ≥ 0`. -/lemma pow_div_factorial_cube_le {L : ℝ} (hL : 0 ≤ L) (w : ℕ) :(L ^ w / w.factorial) ^ 3 ≤ (3 : ℝ) ^ (3 * w) * Real.exp L := byhave h := Real.pow_div_factorial_le_exp (x := L / 3) (by positivity) whave heq : L ^ w / w.factorial = (3 : ℝ) ^ w * ((L / 3) ^ w / w.factorial) := byrw [div_pow]; field_simphave hnn : 0 ≤ (L / 3) ^ w / w.factorial := by positivitycalc (L ^ w / w.factorial) ^ 3 = ((3 : ℝ) ^ w * ((L / 3) ^ w / w.factorial)) ^ 3 := by rw [heq]_ ≤ ((3 : ℝ) ^ w * Real.exp (L / 3)) ^ 3 := byapply pow_le_pow_left₀ (by positivity)exact mul_le_mul_of_nonneg_left h (by positivity)_ = (3 : ℝ) ^ (3 * w) * Real.exp L := byrw [mul_pow, ← pow_mul, ← Real.exp_nat_mul]congr 1· ring_nf· congr 1; ringset_option exponentiation.threshold 30000set_option maxRecDepth 200000/-- The numeric step for many prime factors: `6^501 · 3^(501 n) ≤ 5^501 · g(n)^187` for `n ≥ 26`. -/lemma big_omega_ineq : ∀ n, 26 ≤ n → 6 ^ 501 * 3 ^ (501 * n) ≤ 5 ^ 501 * g n ^ 187 := byintro n hninduction n, hn using Nat.le_induction with| base => decide| succ n hn ih =>rw [g_succ (by omega), mul_pow]have h53 : 3 ^ 501 ≤ (2 * n + 1) ^ 187 :=calc 3 ^ 501 ≤ 53 ^ 187 := by decide_ ≤ (2 * n + 1) ^ 187 := Nat.pow_le_pow_left (by omega) 187calc 6 ^ 501 * 3 ^ (501 * (n + 1)) = 3 ^ 501 * (6 ^ 501 * 3 ^ (501 * n)) := by ring_ ≤ (2 * n + 1) ^ 187 * (5 ^ 501 * g n ^ 187) := Nat.mul_le_mul h53 ih_ = 5 ^ 501 * (g n ^ 187 * (2 * n + 1) ^ 187) := by ring/-- The numeric step for few prime factors: `6^855 · 3^(855·25) ≤ 5^855 · 10^(56·187)`. -/lemma small_omega_ineq : 6 ^ 855 * 3 ^ (855 * 25) ≤ 5 ^ 855 * 10 ^ (56 * 187) := by decide/-- **D12.** Baker's conjecture bounds every solution with exponents `{3, 5, 19}` (any order) by `10^56`. -/theorem baker_bound_3_5_19 (H : BakerAbc) {A B C x y z : ℕ} (hA : 0 < A) (hB : 0 < B)(hx : 3 ≤ x) (hy : 3 ≤ y) (hz : 3 ≤ z) (hxyz : x * y * z = 285) (hs : x * y + y * z + z * x = 167)(hsum : A ^ x + B ^ y = C ^ z) (hg : Nat.gcd A (Nat.gcd B C) = 1) : C ^ z < 10 ^ 56 := by-- the abc triple a + b = cset a := A ^ x with ha_defset b := B ^ y with hb_defset c := C ^ z with hc_defhave hx0 : x ≠ 0 := by omegahave hy0 : y ≠ 0 := by omegahave hz0 : z ≠ 0 := by omegahave hcop := coprime_of_gcd_eq_one hx0 hy0 hz0 hsum hghave hab : Nat.Coprime a b := Nat.Coprime.pow x y hcop.1have hapos : 0 < a := pow_pos hA xhave hbpos : 0 < b := pow_pos hB yhave hC : 0 < C := byrcases Nat.eq_zero_or_pos C with h | h· have : c = 0 := by rw [hc_def, h, zero_pow hz0]omega· exact hhave hC2 : 2 ≤ C := byrcases Nat.lt_or_ge C 2 with h | h· have h1 : C = 1 := by omegahave : c = 1 := by rw [hc_def, h1, one_pow]omega· exact hhave hc8 : 8 ≤ c := calc 8 = 2 ^ 3 := by norm_num_ ≤ C ^ 3 := Nat.pow_le_pow_left hC2 3_ ≤ C ^ z := Nat.pow_le_pow_right hC hzhave hc2 : 2 < c := by omega-- Baker's inequalityhave hbaker := H a b c hapos hbpos hsum hab hc2set N := rad (a * b * c) with hN_defset w := (a * b * c).primeFactors.card with hw_def-- N^285 < c^167 from abc_sharphave hsharp := abc_sharp (Nat.pos_iff_ne_zero.mp hA) (Nat.pos_iff_ne_zero.mp hB) hx0 hy0 hz0 hsumrw [hxyz, hs] at hsharphave hNle : N ≤ A * B * C := byrw [hN_def, ha_def, hb_def, hc_def,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]exact rad_le (by positivity)have hN285 : N ^ 285 < c ^ 167 := lt_of_le_of_lt (Nat.pow_le_pow_left hNle 285) hsharphave hN1 : 1 ≤ N := one_le_rad _-- real form: c^187 < (6/5)^855 · 3^(855 w)have hNr : (1 : ℝ) ≤ N := by exact_mod_cast hN1have hL : 0 ≤ Real.log N := Real.log_nonneg hNrhave hcube := pow_div_factorial_cube_le hL wrw [Real.exp_log (by linarith)] at hcubehave hcr : (0 : ℝ) < c := by exact_mod_cast (by omega : 0 < c)have hX : (0 : ℝ) ≤ (6 / 5 : ℝ) * N * (Real.log N) ^ w / w.factorial := by positivityhave h3 : (c : ℝ) ^ 3 < ((6 / 5 : ℝ) * N * (Real.log N) ^ w / w.factorial) ^ 3 :=pow_lt_pow_left₀ hbaker hcr.le (by norm_num)have h3' : (c : ℝ) ^ 3 < (6 / 5 : ℝ) ^ 3 * (3 : ℝ) ^ (3 * w) * (N : ℝ) ^ 4 := bycalc (c : ℝ) ^ 3 < ((6 / 5 : ℝ) * N * (Real.log N) ^ w / w.factorial) ^ 3 := h3_ = (6 / 5 : ℝ) ^ 3 * (N : ℝ) ^ 3 * ((Real.log N) ^ w / w.factorial) ^ 3 := by ring_ ≤ (6 / 5 : ℝ) ^ 3 * (N : ℝ) ^ 3 * ((3 : ℝ) ^ (3 * w) * N) :=mul_le_mul_of_nonneg_left hcube (by positivity)_ = (6 / 5 : ℝ) ^ 3 * (3 : ℝ) ^ (3 * w) * (N : ℝ) ^ 4 := by ringhave hN285r : (N : ℝ) ^ 285 < (c : ℝ) ^ 167 := by exact_mod_cast hN285have h855 : (c : ℝ) ^ 855 < (6 / 5 : ℝ) ^ 855 * (3 : ℝ) ^ (855 * w) * (c : ℝ) ^ 668 := byhave hpos : (0 : ℝ) ≤ (c : ℝ) ^ 3 := by positivitycalc (c : ℝ) ^ 855 = ((c : ℝ) ^ 3) ^ 285 := by ring_ < ((6 / 5 : ℝ) ^ 3 * (3 : ℝ) ^ (3 * w) * (N : ℝ) ^ 4) ^ 285 :=pow_lt_pow_left₀ h3' hpos (by norm_num)_ = (6 / 5 : ℝ) ^ 855 * (3 : ℝ) ^ (855 * w) * ((N : ℝ) ^ 285) ^ 4 := byrw [mul_pow, mul_pow, ← pow_mul, ← pow_mul, ← pow_mul, ← pow_mul]; ring_nf_ ≤ (6 / 5 : ℝ) ^ 855 * (3 : ℝ) ^ (855 * w) * ((c : ℝ) ^ 167) ^ 4 := byapply mul_le_mul_of_nonneg_left _ (by positivity)exact pow_le_pow_left₀ (by positivity) hN285r.le 4_ = (6 / 5 : ℝ) ^ 855 * (3 : ℝ) ^ (855 * w) * (c : ℝ) ^ 668 := by ringhave h187 : (c : ℝ) ^ 187 < (6 / 5 : ℝ) ^ 855 * (3 : ℝ) ^ (855 * w) := byhave hc668 : (0 : ℝ) < (c : ℝ) ^ 668 := by positivityhave : (c : ℝ) ^ 187 * (c : ℝ) ^ 668 < (6 / 5 : ℝ) ^ 855 * (3 : ℝ) ^ (855 * w) * (c : ℝ) ^ 668 := bycalc (c : ℝ) ^ 187 * (c : ℝ) ^ 668 = (c : ℝ) ^ 855 := by ring_ < _ := h855exact lt_of_mul_lt_mul_right this hc668.lercases Nat.lt_or_ge w 26 with hw | hw· -- few prime factors: c^187 < (10^56)^187have hsmall : (6 / 5 : ℝ) ^ 855 * (3 : ℝ) ^ (855 * w) ≤ ((10 : ℝ) ^ 56) ^ 187 := byhave hnat : 6 ^ 855 * 3 ^ (855 * w) ≤ 5 ^ 855 * 10 ^ (56 * 187) :=le_trans (Nat.mul_le_mul_left _ (Nat.pow_le_pow_right (by norm_num) (by omega))) small_omega_ineqhave hnatr : ((6 : ℝ) ^ 855 * (3 : ℝ) ^ (855 * w)) ≤ (5 : ℝ) ^ 855 * (10 : ℝ) ^ (56 * 187) := byexact_mod_cast hnatrw [div_pow, ← pow_mul]rw [div_mul_eq_mul_div, div_le_iff₀ (by positivity)]linarith [hnatr]have hlt : (c : ℝ) ^ 187 < ((10 : ℝ) ^ 56) ^ 187 := lt_of_lt_of_le h187 hsmallhave hcr' : (c : ℝ) < (10 : ℝ) ^ 56 :=lt_of_pow_lt_pow_left₀ 187 (by positivity) hltexact_mod_cast hcr'· -- many prime factors: contradiction with N ≥ g wexfalsohave hgN : g w ≤ N := g_le_rad _have hgr : ((g w : ℕ) : ℝ) ^ 285 < (c : ℝ) ^ 167 :=lt_of_le_of_lt (pow_le_pow_left₀ (by positivity) (by exact_mod_cast hgN) 285) hN285rhave hbig := big_omega_ineq w hwhave hbigr : (6 : ℝ) ^ 501 * (3 : ℝ) ^ (501 * w) ≤ (5 : ℝ) ^ 501 * ((g w : ℕ) : ℝ) ^ 187 := byexact_mod_cast hbig-- (g w)^(285·187) < c^(167·187) < ((6/5)^855 3^(855 w))^167 = ((6/5)^501 3^(501 w))^285have h1 : (((g w : ℕ) : ℝ) ^ 187) ^ 285 < ((6 / 5 : ℝ) ^ 501 * (3 : ℝ) ^ (501 * w)) ^ 285 := bycalc (((g w : ℕ) : ℝ) ^ 187) ^ 285 = (((g w : ℕ) : ℝ) ^ 285) ^ 187 := by ring_ < ((c : ℝ) ^ 167) ^ 187 := pow_lt_pow_left₀ hgr (by positivity) (by norm_num)_ = ((c : ℝ) ^ 187) ^ 167 := by ring_ < ((6 / 5 : ℝ) ^ 855 * (3 : ℝ) ^ (855 * w)) ^ 167 :=pow_lt_pow_left₀ h187 (by positivity) (by norm_num)_ = ((6 / 5 : ℝ) ^ 501 * (3 : ℝ) ^ (501 * w)) ^ 285 := byrw [mul_pow, mul_pow, ← pow_mul, ← pow_mul, ← pow_mul, ← pow_mul]; ring_nfhave h2 : ((g w : ℕ) : ℝ) ^ 187 < (6 / 5 : ℝ) ^ 501 * (3 : ℝ) ^ (501 * w) :=lt_of_pow_lt_pow_left₀ 285 (by positivity) h1have h3 : (6 / 5 : ℝ) ^ 501 * (3 : ℝ) ^ (501 * w) ≤ ((g w : ℕ) : ℝ) ^ 187 := byrw [div_pow, div_mul_eq_mul_div, div_le_iff₀ (by positivity)]linarith [hbigr]linarithend BealBakerBound#print axioms BealBakerBound.baker_bound_3_5_19