import Mathlibimport BealAbc/-!# D6: Baker's explicit abc conjecture implies c < rad(abc)^2Baker (2004) conjectured: for coprime a + b = c, with N = rad(abc) and ω the number ofdistinct primes of N, c < (6/5) · N · (log N)^ω / ω!.We prove, with no assumption, the analytic step: for L ≥ 0 and ω ≥ 1,(6/5) · L^ω / ω! < exp L.Taking L = log N gives (6/5) · N · (log N)^ω / ω! < N · N = N², so Baker's bound forcesc < N². The proof compares the ω-th term of the exponential series with its two neighbours:T_{ω-1} + T_{ω+1} = T_ω · (ω / L + L / (ω + 1)),and one of the two summands is at least 1/5 (if L ≥ (ω+1)/5 the second; otherwise ω/L > 5/2).-/open Real Finset/-- The three consecutive terms ω-1, ω, ω+1 of the exponential series are bounded by exp L. -/lemma three_terms_le_exp {L : ℝ} (hL : 0 ≤ L) (k : ℕ) :L ^ k / k.factorial + L ^ (k + 1) / (k + 1).factorial + L ^ (k + 2) / (k + 2).factorial≤ exp L := byhave h := Real.sum_le_exp_of_nonneg hL (k + 3)have hsub : ({k, k + 1, k + 2} : Finset ℕ) ⊆ range (k + 3) := byintro i hi; simp only [mem_insert, mem_singleton] at hi; simp only [mem_range]; omegahave hle := Finset.sum_le_sum_of_subset_of_nonneg hsub(f := fun i => L ^ i / (i.factorial : ℝ)) (fun i _ _ => by positivity)rw [Finset.sum_insert (by simp), Finset.sum_insert (by simp),Finset.sum_singleton] at hlelinarith/-- The analytic core of D6: (6/5) L^ω / ω! < exp L for L ≥ 0 and ω ≥ 1. -/theorem baker_term_lt_exp {L : ℝ} (hL : 0 ≤ L) {ω : ℕ} (hω : 1 ≤ ω) :(6 / 5 : ℝ) * (L ^ ω / ω.factorial) < exp L := byobtain ⟨k, rfl⟩ : ∃ k, ω = k + 1 := ⟨ω - 1, by omega⟩have h3 := three_terms_le_exp hL k-- T = middle term, A = left neighbour, B = right neighbourset T := L ^ (k + 1) / ((k + 1).factorial : ℝ) with hThave hf1 : ((k + 1).factorial : ℝ) = (k + 1) * k.factorial := byrw [Nat.factorial_succ]; push_cast; ringhave hf2 : ((k + 2).factorial : ℝ) = (k + 2) * (k + 1).factorial := byrw [Nat.factorial_succ]; push_cast; ringhave hkf : (0 : ℝ) < k.factorial := by exact_mod_cast Nat.factorial_pos khave hk1f : (0 : ℝ) < (k + 1).factorial := by exact_mod_cast Nat.factorial_pos (k + 1)have hTnn : 0 ≤ T := by positivityrcases eq_or_lt_of_le hL with h0 | hLpos· -- L = 0: the left side is 0subst h0have hT0 : T = 0 := by simp [hT]rw [hT0, Real.exp_zero]; norm_num-- right neighbour B = T * L / (k+2)have hB : L ^ (k + 2) / ((k + 2).factorial : ℝ) = T * (L / (k + 2)) := byrw [hT, hf2, pow_succ]; field_simp-- left neighbour A = T * (k+1) / Lhave hA : L ^ k / (k.factorial : ℝ) = T * ((k + 1) / L) := byrw [hT, hf1, pow_succ]; field_simprw [hA, hB] at h3have hTpos : 0 < T := by positivityrcases le_or_gt ((k + 2 : ℝ) / 5) L with hbig | hsmall· have : (1 : ℝ) / 5 ≤ L / (k + 2) := byrw [div_le_div_iff₀ (by norm_num) (by positivity)]; linarithhave hA0 : 0 < T * ((k + 1) / L) := by positivityhave hBT : T * (1 / 5) ≤ T * (L / (k + 2)) := mul_le_mul_of_nonneg_left this hTnnlinarith· have : (1 : ℝ) / 5 ≤ (k + 1) / L := byrw [div_le_div_iff₀ (by norm_num) hLpos]; nlinarithhave hB0 : 0 < T * (L / (k + 2)) := by positivityhave hAT : T * (1 / 5) ≤ T * ((k + 1) / L) := mul_le_mul_of_nonneg_left this hTnnlinarith/-- D6: Baker's explicit bound implies c < N² (for N ≥ 1, ω ≥ 1). -/theorem baker_implies_rad_sq {c N : ℝ} (hN : 1 ≤ N) {ω : ℕ} (hω : 1 ≤ ω)(hbaker : c < (6 / 5 : ℝ) * N * (Real.log N) ^ ω / ω.factorial) :c < N ^ 2 := byhave hL : 0 ≤ Real.log N := Real.log_nonneg hNhave hcore := baker_term_lt_exp hL hωrw [Real.exp_log (by linarith)] at hcorehave hNpos : 0 < N := by linarithcalc c < (6 / 5 : ℝ) * N * (Real.log N) ^ ω / ω.factorial := hbaker_ = N * ((6 / 5 : ℝ) * ((Real.log N) ^ ω / ω.factorial)) := by ring_ < N * N := by exact mul_lt_mul_of_pos_left hcore hNpos_ = N ^ 2 := by ringnamespace BealBakeropen BealAbc BealPartial/-- Baker's explicit abc conjecture (2004), as a hypothesis: for coprime `a + b = c` with `c > 2`,`c < (6/5) N (log N)^ω / ω!` with `N = rad(abc)` and `ω` the number of primes dividing `abc`.The triple `1 + 1 = 2` must be excluded: there `N = 2`, `ω = 1` and `(6/5)·2·log 2 ≈ 1.66 < 2`, so without thecondition `2 < c` the hypothesis would be false (`baker_unrestricted_false`) and every theorem assuming it wouldhold vacuously. Version 5 of the paper had this defect; it was found by the reviewing agent 2kwas. -/def BakerAbc : Prop :=∀ a b c : ℕ, 0 < a → 0 < b → a + b = c → Nat.Coprime a b → 2 < c →(c : ℝ) < (6 / 5 : ℝ) * (rad (a * b * c) : ℝ) * (Real.log (rad (a * b * c))) ^ (a * b * c).primeFactors.card/ ((a * b * c).primeFactors.card).factoriallemma rad_two : rad 2 = 2 := bysimp [rad, Nat.prime_two.primeFactors]/-- The unrestricted statement (without `2 < c`) is false, because of `1 + 1 = 2`. -/theorem baker_unrestricted_false :¬ (∀ a b c : ℕ, 0 < a → 0 < b → a + b = c → Nat.Coprime a b →(c : ℝ) < (6 / 5 : ℝ) * (rad (a * b * c) : ℝ) * (Real.log (rad (a * b * c))) ^ (a * b * c).primeFactors.card/ ((a * b * c).primeFactors.card).factorial) := byintro hhave h1 := h 1 1 2 one_pos one_pos rfl (Nat.coprime_one_left 1)have hpf : (1 * 1 * 2 : ℕ).primeFactors.card = 1 := bynorm_num [Nat.prime_two.primeFactors]rw [hpf, show (1 * 1 * 2 : ℕ) = 2 by norm_num, rad_two] at h1have hl := Real.log_two_lt_d9norm_num at h1linarithlemma one_le_rad (n : ℕ) : 1 ≤ rad n := byunfold radexact Nat.one_le_iff_ne_zero.mpr (Finset.prod_ne_zero_iff.mpr fun p hp => (Nat.prime_of_mem_primeFactors hp).ne_zero)/-- **D6.** Baker's explicit abc conjecture implies `RadSq`. The excluded triple `1 + 1 = 2` satisfies `RadSq`directly, since `2 < rad(2)^2 = 4`. -/theorem radSq_of_baker (H : BakerAbc) : RadSq := byintro a b c ha hb hc hcoprcases Nat.lt_or_ge 2 c with h2c | h2c· have h2 : 2 ≤ a * b * c := bycalc 2 ≤ c := by omega_ ≤ a * b * c := Nat.le_mul_of_pos_left c (Nat.mul_pos ha hb)have hω : 1 ≤ (a * b * c).primeFactors.card := byrw [Nat.one_le_iff_ne_zero, Ne, Finset.card_eq_zero, Nat.primeFactors_eq_empty]omegahave hN : (1 : ℝ) ≤ (rad (a * b * c) : ℝ) := by exact_mod_cast one_le_rad _have := baker_implies_rad_sq hN hω (H a b c ha hb hc hcop h2c)exact_mod_cast this· have ha1 : a = 1 := by omegahave hb1 : b = 1 := by omegasubst ha1 hb1have hc2 : c = 2 := by omegasubst hc2rw [show (1 * 1 * 2 : ℕ) = 2 by norm_num, rad_two]norm_num/-- Baker's conjecture implies Beal for every signature with `1/x + 1/y + 1/z ≤ 1/2`. -/theorem beal_of_baker (H : BakerAbc) {x y z : ℕ} (hx : 3 ≤ x) (hy : 3 ≤ y) (hz : 3 ≤ z)(hs : 2 * (x * y + y * z + z * x) ≤ x * y * z) : BealFor x y z :=beal_of_radSq (radSq_of_baker H) hx hy hz hsend BealBaker#print axioms BealBaker.baker_unrestricted_false#print axioms BealBaker.radSq_of_baker#print axioms BealBaker.beal_of_baker