| 1 | module |
| 2 | |
| 3 | public import E424.Defs |
| 4 | |
| 5 | @[expose] public section |
| 6 | |
| 7 | /-! |
| 8 | # Lemma 31 auxiliaries: coefficients of powers of a cell polynomial |
| 9 | |
| 10 | For a finite set `S` of positive integers and `ℓ : ℕ`, the `ℓ`-th power of `∑_{s ∈ S} s^{-1-it}` is a |
| 11 | Dirichlet polynomial `∑_n (c(n)/n) n^{-it}`, where `c(n)` counts ordered `ℓ`-tuples in `S` with product `n`. |
| 12 | * `cardFactors_le_of_isFam`: a θ-family element has at most `200` prime factors. |
| 13 | * `card_divisors_cardFactors_le`: `#{d ∣ n : Ω d ≤ k} ≤ (Ω n + 1)^k`. |
| 14 | * `tupleCount_le`: `c(n) ≤ #{s ∈ S : s ∣ n}^(ℓ-1)`. |
| 15 | * `pow_sum_nit`: the expansion of the power. |
| 16 | -/ |
| 17 | |
| 18 | set_option linter.style.header false |
| 19 | open Finset |
| 20 | |
| 21 | namespace E424 |
| 22 | |
| 23 | /-- `z^{length L} ≤ ∏ L` when every entry of `L` is at least `z ≥ 0`. -/ |
| 24 | theorem pow_length_le_prod_of_forall_le {z : ℝ} (hz : 0 ≤ z) : |
| 25 | ∀ L : List ℕ, (∀ p ∈ L, z ≤ p) → z ^ L.length ≤ (L.prod : ℝ) |
| 26 | | [], _ => by simp |
| 27 | | p :: L, h => by |
| 28 | have hp : z ≤ p := h p (by simp) |
| 29 | have ih := pow_length_le_prod_of_forall_le hz L fun q hq => h q (by simp [hq]) |
| 30 | rw [List.length_cons, List.prod_cons, Nat.cast_mul, pow_succ'] |
| 31 | exact mul_le_mul hp ih (pow_nonneg hz _) (le_trans hz hp) |
| 32 | |
| 33 | /-- Every element of a θ-family (`IsFam z`, `z ≥ 3`) has at most `200` prime factors, counted with |
| 34 | multiplicity, because each prime factor exceeds `z` and the element is at most `z^200`. -/ |
| 35 | theorem cardFactors_le_of_isFam {z : ℝ} (hz : 3 ≤ z) {s : ℕ} (hs : z < s ∧ (s : ℝ) ≤ z ^ 200 ∧ Rough z s) : |
| 36 | ArithmeticFunction.cardFactors s ≤ 200 := by |
| 37 | obtain ⟨h1, h2, h3⟩ := hs |
| 38 | have hs0 : s ≠ 0 := by |
| 39 | rintro rfl |
| 40 | simp at h1 |
| 41 | linarith |
| 42 | have hL : ∀ p ∈ s.primeFactorsList, z ≤ p := fun p hp => |
| 43 | (h3 p (Nat.prime_of_mem_primeFactorsList hp) (Nat.dvd_of_mem_primeFactorsList hp)).le |
| 44 | have hpow := pow_length_le_prod_of_forall_le (by linarith) s.primeFactorsList hL |
| 45 | rw [Nat.prod_primeFactorsList hs0] at hpow |
| 46 | rw [ArithmeticFunction.cardFactors_apply] |
| 47 | have hle : z ^ s.primeFactorsList.length ≤ z ^ 200 := hpow.trans h2 |
| 48 | exact_mod_cast (pow_le_pow_iff_right₀ (by linarith : (1 : ℝ) < z)).1 hle |
| 49 | |
| 50 | /-- The divisors of `n` with at most `k` prime factors (with multiplicity) number at most |
| 51 | `(Ω n + 1)^k`. Each such `d ≠ 1` is `p * d'` with `p` a prime factor of `n` and `d'` of one fewer. -/ |
| 52 | theorem card_divisors_cardFactors_le (n : ℕ) (hn : n ≠ 0) (k : ℕ) : |
| 53 | ((n.divisors.filter fun d => ArithmeticFunction.cardFactors d ≤ k)).card ≤ |
| 54 | (ArithmeticFunction.cardFactors n + 1) ^ k := by |
| 55 | induction k with |
| 56 | | zero => |
| 57 | have hsub : n.divisors.filter (fun d => ArithmeticFunction.cardFactors d ≤ 0) ⊆ {1} := by |
| 58 | intro d hd |
| 59 | simp only [mem_filter, Nat.mem_divisors] at hd |
| 60 | obtain ⟨⟨hdn, -⟩, hk⟩ := hd |
| 61 | have h0 : ArithmeticFunction.cardFactors d = 0 := by omega |
| 62 | rcases ArithmeticFunction.cardFactors_eq_zero_iff_eq_zero_or_one.1 h0 with h | h |
| 63 | · exact absurd (Nat.eq_zero_of_zero_dvd (h ▸ hdn)) (fun h' => hn h') |
| 64 | · simp [h] |
| 65 | simpa using (card_le_card hsub) |
| 66 | | succ k ih => |
| 67 | set M := ArithmeticFunction.cardFactors n |
| 68 | have hsub : n.divisors.filter (fun d => ArithmeticFunction.cardFactors d ≤ k + 1) ⊆ |
| 69 | insert 1 ((n.primeFactors ×ˢ (n.divisors.filter fun d => ArithmeticFunction.cardFactors d ≤ k)).image |
| 70 | fun x => x.1 * x.2) := by |
| 71 | intro d hd |
| 72 | simp only [mem_filter, Nat.mem_divisors] at hd |
| 73 | obtain ⟨⟨hdn, -⟩, hk⟩ := hd |
| 74 | by_cases h1 : d = 1 |
| 75 | · simp [h1] |
| 76 | have hd0 : d ≠ 0 := fun h => hn (Nat.eq_zero_of_zero_dvd (h ▸ hdn)) |
| 77 | set p := d.minFac with hp_def |
| 78 | have hpp : p.Prime := Nat.minFac_prime h1 |
| 79 | have hpd : p ∣ d := Nat.minFac_dvd d |
| 80 | have hpn : p ∈ n.primeFactors := Nat.mem_primeFactors.2 ⟨hpp, hpd.trans hdn, hn⟩ |
| 81 | have hdiv : d / p ∣ n := (Nat.div_dvd_of_dvd hpd).trans hdn |
| 82 | have hdp0 : d / p ≠ 0 := fun h => hd0 (by |
| 83 | rcases Nat.div_eq_zero_iff.1 h with h' | h' |
| 84 | · exact absurd h' hpp.pos.ne' |
| 85 | · exact absurd (Nat.le_of_dvd (by omega) hpd) (by omega)) |
| 86 | have hcard : ArithmeticFunction.cardFactors d = ArithmeticFunction.cardFactors p + |
| 87 | ArithmeticFunction.cardFactors (d / p) := by |
| 88 | rw [← ArithmeticFunction.cardFactors_mul hpp.ne_zero hdp0, Nat.mul_div_cancel' hpd] |
| 89 | rw [ArithmeticFunction.cardFactors_apply_prime hpp] at hcard |
| 90 | have hk' : ArithmeticFunction.cardFactors (d / p) ≤ k := by omega |
| 91 | refine mem_insert_of_mem (mem_image.2 ⟨(p, d / p), mem_product.2 ⟨hpn, ?_⟩, Nat.mul_div_cancel' hpd⟩) |
| 92 | exact mem_filter.2 ⟨Nat.mem_divisors.2 ⟨hdiv, hn⟩, hk'⟩ |
| 93 | have hprime : n.primeFactors.card ≤ M := |
| 94 | (List.toFinset_card_le _).trans (le_of_eq ArithmeticFunction.cardFactors_apply.symm) |
| 95 | calc _ ≤ (insert 1 ((n.primeFactors ×ˢ (n.divisors.filter fun d => ArithmeticFunction.cardFactors d ≤ k)).image |
| 96 | fun x => x.1 * x.2)).card := card_le_card hsub |
| 97 | _ ≤ 1 + (n.primeFactors ×ˢ (n.divisors.filter fun d => ArithmeticFunction.cardFactors d ≤ k)).card := by |
| 98 | exact (card_insert_le _ _).trans (by |
| 99 | rw [add_comm 1]; exact Nat.add_le_add_right card_image_le 1) |
| 100 | _ = 1 + n.primeFactors.card * (n.divisors.filter fun d => ArithmeticFunction.cardFactors d ≤ k).card := by |
| 101 | rw [card_product] |
| 102 | _ ≤ 1 + M * (M + 1) ^ k := by |
| 103 | exact Nat.add_le_add_left (Nat.mul_le_mul hprime ih) 1 |
| 104 | _ ≤ (M + 1) ^ (k + 1) := by |
| 105 | have h1 : 1 ≤ (M + 1) ^ k := Nat.one_le_pow _ _ (by omega) |
| 106 | rw [pow_succ] |
| 107 | nlinarith |
| 108 | |
| 109 | /-- The number of ordered `ℓ`-tuples of `S` with product `n ≠ 0` (with `S` positive). -/ |
| 110 | noncomputable def tupleCount (S : Finset ℕ) (ℓ n : ℕ) : ℕ := |
| 111 | ((Fintype.piFinset fun _ : Fin ℓ => S).filter fun f => ∏ i, f i = n).card |
| 112 | |
| 113 | /-- `c(n) ≤ #{s ∈ S : s ∣ n}^(ℓ - 1)`: the last entry of an `ℓ`-tuple with product `n` is determined by the |
| 114 | others. Stated with `ℓ + 1` entries. -/ |
| 115 | theorem tupleCount_le (S : Finset ℕ) (hS : ∀ s ∈ S, s ≠ 0) (ℓ n : ℕ) : |
| 116 | tupleCount S (ℓ + 1) n ≤ ((S.filter (· ∣ n)).card) ^ ℓ := by |
| 117 | unfold tupleCount |
| 118 | have hmaps : ∀ f ∈ (Fintype.piFinset fun _ : Fin (ℓ + 1) => S).filter (fun f => ∏ i, f i = n), |
| 119 | (fun i : Fin ℓ => f i.castSucc) ∈ Fintype.piFinset fun _ : Fin ℓ => S.filter (· ∣ n) := by |
| 120 | intro f hf |
| 121 | obtain ⟨hf1, hf2⟩ := mem_filter.1 hf |
| 122 | refine Fintype.mem_piFinset.2 fun i => mem_filter.2 ⟨Fintype.mem_piFinset.1 hf1 _, ?_⟩ |
| 123 | rw [← hf2] |
| 124 | exact Finset.dvd_prod_of_mem f (mem_univ _) |
| 125 | have hinj : Set.InjOn (fun f : Fin (ℓ + 1) → ℕ => fun i : Fin ℓ => f i.castSucc) |
| 126 | ↑((Fintype.piFinset fun _ : Fin (ℓ + 1) => S).filter (fun f => ∏ i, f i = n)) := by |
| 127 | intro f hf g hg hfg |
| 128 | simp only [coe_filter, Fintype.mem_piFinset, Set.mem_ofPred_eq] at hf hg |
| 129 | have hfg' : ∀ i : Fin ℓ, f i.castSucc = g i.castSucc := fun i => congrFun hfg i |
| 130 | have hP : (∏ i : Fin ℓ, f i.castSucc) = ∏ i : Fin ℓ, g i.castSucc := |
| 131 | Finset.prod_congr rfl fun i _ => hfg' i |
| 132 | have hlast : f (Fin.last ℓ) = g (Fin.last ℓ) := by |
| 133 | have hf' := hf.2 |
| 134 | have hg' := hg.2 |
| 135 | rw [Fin.prod_univ_castSucc] at hf' hg' |
| 136 | rw [hP] at hf' |
| 137 | have hpos : (∏ i : Fin ℓ, g i.castSucc) ≠ 0 := |
| 138 | Finset.prod_ne_zero_iff.2 fun i _ => hS _ (hg.1 _) |
| 139 | exact Nat.eq_of_mul_eq_mul_left (Nat.pos_of_ne_zero hpos) (hf'.trans hg'.symm) |
| 140 | funext i |
| 141 | refine Fin.lastCases ?_ (fun j => hfg' j) i |
| 142 | exact hlast |
| 143 | have := card_le_card_of_injOn _ hmaps hinj |
| 144 | simpa [Fintype.card_piFinset, Finset.prod_const] using this |
| 145 | |
| 146 | /-- `nit` turns a product of nonzero naturals into the product of the `nit` values. -/ |
| 147 | theorem nit_prod {ι : Type*} (s : Finset ι) (f : ι → ℕ) (hf : ∀ i ∈ s, f i ≠ 0) (t : ℝ) : |
| 148 | nit (∏ i ∈ s, f i) t = ∏ i ∈ s, nit (f i) t := by |
| 149 | unfold nit |
| 150 | rw [Nat.cast_prod, Real.log_prod (fun i hi => by exact_mod_cast hf i hi), ← Complex.exp_sum] |
| 151 | congr 1 |
| 152 | push_cast |
| 153 | simp [Finset.mul_sum, Finset.sum_mul, Finset.sum_neg_distrib] |
| 154 | |
| 155 | /-- The `ℓ`-th power of the cell sum `∑_{s ∈ S} s^{-1} s^{-it}` is the Dirichlet polynomial |
| 156 | `∑_n (c(n)/n) n^{-it}`, `c(n) = tupleCount S ℓ n` counting ordered `ℓ`-tuples with product `n`. -/ |
| 157 | theorem pow_sum_nit (S : Finset ℕ) (hS : ∀ s ∈ S, s ≠ 0) (ℓ : ℕ) (t : ℝ) : |
| 158 | (∑ s ∈ S, ((1 / (s : ℝ) : ℝ) : ℂ) * nit s t) ^ ℓ = |
| 159 | ∑ n ∈ (Fintype.piFinset fun _ : Fin ℓ => S).image (fun f => ∏ i, f i), |
| 160 | ((tupleCount S ℓ n : ℕ) : ℂ) / (n : ℂ) * nit n t := by |
| 161 | set P := Fintype.piFinset fun _ : Fin ℓ => S with hP |
| 162 | have hnz : ∀ x ∈ P, ∀ i, x i ≠ 0 := fun x hx i => hS _ (Fintype.mem_piFinset.1 hx i) |
| 163 | have hpow : (∑ s ∈ S, ((1 / (s : ℝ) : ℝ) : ℂ) * nit s t) ^ ℓ = |
| 164 | ∏ _i : Fin ℓ, ∑ s ∈ S, ((1 / (s : ℝ) : ℝ) : ℂ) * nit s t := by |
| 165 | simp [Finset.prod_const] |
| 166 | have key : ∀ x ∈ P, ∏ i, ((1 / (x i : ℝ) : ℝ) : ℂ) * nit (x i) t = |
| 167 | (1 / ((∏ i, x i : ℕ) : ℂ)) * nit (∏ i, x i) t := by |
| 168 | intro x hx |
| 169 | rw [nit_prod _ _ (fun i _ => hnz x hx i), Finset.prod_mul_distrib] |
| 170 | congr 1 |
| 171 | push_cast |
| 172 | simp |
| 173 | rw [hpow, Finset.prod_univ_sum, Finset.sum_congr rfl key, |
| 174 | ← Finset.sum_fiberwise_of_maps_to (g := fun f => ∏ i, f i) |
| 175 | (t := P.image fun f => ∏ i, f i) fun x hx => mem_image_of_mem _ hx] |
| 176 | refine Finset.sum_congr rfl fun n _ => ?_ |
| 177 | have hc : ∀ x ∈ P.filter (fun f => ∏ i, f i = n), |
| 178 | (1 / ((∏ i, x i : ℕ) : ℂ)) * nit (∏ i, x i) t = (1 / (n : ℂ)) * nit n t := by |
| 179 | intro x hx |
| 180 | rw [(mem_filter.1 hx).2] |
| 181 | rw [Finset.sum_congr rfl hc, Finset.sum_const, nsmul_eq_mul, tupleCount] |
| 182 | rw [hP] |
| 183 | ring |
| 184 | |
| 185 | /-- The elements of a θ-family dividing `n` number at most `(Ω n + 1)^200`. -/ |
| 186 | theorem card_filter_dvd_le {z : ℝ} (hz : 3 ≤ z) {S : Finset ℕ} (hS : IsFam z S) {n : ℕ} (hn : n ≠ 0) : |
| 187 | (S.filter (· ∣ n)).card ≤ (ArithmeticFunction.cardFactors n + 1) ^ 200 := |
| 188 | (card_le_card fun s hs => by |
| 189 | obtain ⟨hsS, hsn⟩ := mem_filter.1 hs |
| 190 | exact mem_filter.2 ⟨Nat.mem_divisors.2 ⟨hsn, hn⟩, cardFactors_le_of_isFam hz (hS s hsS)⟩).trans |
| 191 | (card_divisors_cardFactors_le n hn 200) |
| 192 | |
| 193 | /-- Main coefficient bound for Lemma 31: for a θ-family `S` at `z ≥ 3`, the number of ordered |
| 194 | `(ℓ+1)`-tuples in `S` with product `n` is at most `((Ω n + 1)^200)^ℓ`. -/ |
| 195 | theorem tupleCount_le_isFam {z : ℝ} (hz : 3 ≤ z) {S : Finset ℕ} (hS : IsFam z S) (ℓ : ℕ) {n : ℕ} |
| 196 | (hn : n ≠ 0) : |
| 197 | tupleCount S (ℓ + 1) n ≤ ((ArithmeticFunction.cardFactors n + 1) ^ 200) ^ ℓ := by |
| 198 | have hS0 : ∀ s ∈ S, s ≠ 0 := fun s hs h0 => by |
| 199 | have := (hS s hs).1 |
| 200 | rw [h0] at this |
| 201 | norm_num at this |
| 202 | linarith |
| 203 | exact (tupleCount_le S hS0 ℓ n).trans (Nat.pow_le_pow_left (card_filter_dvd_le hz hS hn) ℓ) |
| 204 | |
| 205 | end E424 |
| 206 | |