module import Mathlib.Algebra.GroupWithZero.Submonoid.CancelMulZero import Mathlib.Algebra.Order.Star.Int import Mathlib.Data.Rat.Cast.OfScientific import TauCeti.Algebra.Ring.GeomSum public import New.Reduction.Data.AdmissibleData import New.Reduction.Data.Magnitudes /-! # Tight frames in `π”žβ‚€` A tight frame of length `h` is a finite family of vectors `y` of the lattice `π”žβ‚€`, counted with multiplicities, such that `βˆ‘ y, (y† z) y = h z` for all `z`: a resolution of `h`. * `New.Parameters.exists_isTightFrame_coprime`: a tight frame in `π”žβ‚€` of length `h ≀ (d q₁) ^ 6` prime to `q₁`, together with the unit-linear-form property. * `New.Parameters.exists_isTightFrame_of_coprime`: this frame and the powers of `ΞΆ` give tight frames of every length `m β‰₯ q₁ h + R (q₁ + h)` with multiplicities at least `R`. * `New.Data.exists_isTightFrame`: a tight frame of length `pβ‚€ p₁ = D.M` with large multiplicities, where `pβ‚€` and `p₁` are the two primes `D.levelPrime 0` and `D.levelPrime 1` of the data. The powers of `ΞΆ` form a tight frame of length `q₁`. To construct a tight frame of coprime length `h` without using a dual basis, we solve a quadratic congruence `n zΒ² + z + 1 ≑ 0 (mod q₁)` where `n = (d + 1) / 4 = Ξ² (1 - Ξ²)`, set `t = (1 - Ξ²) + n z`, and for each prime factor `β„“ ∣ q₁` with `q₁ = β„“ r` and `r = β„“^a M` (`β„“ ∀ M`), we form the family `u(β„“, j, k, i) = ΞΆ^j (0^k a_β„“^i + (t M / q₁) (a_β„“^i - a_β„“^k))` where `a_β„“ = ΞΆ^r`. Summing over `(β„“, j, k, i)` gives a tight frame whose length `h` is bounded by `(d q₁) ^ 6` and coprime to `q₁`. Notions from other files: * `P.E s` is the field `E = K(ΞΆ)`, where `K = β„š(√-d)` and `ΞΆ = P.ΞΆ s` is a primitive root of unity of order `q₁ = P.q₁ s = P.qβ‚€ * towerDeg s`. `P.zetaInt s` is `ΞΆ` as an element of `π“ž E`. * `P.Ξ¦ s` is the set of infinite places of `E`; `Ξ¦ Ο„` is the complex embedding of `E` chosen at `Ο„`. * `finiteImage id y ∈ Γ” E` says that `y` lies in the lattice `π”žβ‚€ = E ∩ Ξ± Γ”`, where `Ξ±` is the idele of the Weil data and `Γ”` is the ring of integral finite adeles. * `P.periodFactor s` is a complex number; by `norm_iota_periodFactor` its absolute value at an embedding `ΞΉβ‚š : β„‚ β†’+* β„‚_[p]` is given by the idele `Ξ±`. * `Ξ² = (1 + √-d) / 2` is `quadGen d` in `β„‚`, `QuadField.betaK d` in `π“ž K` and `P.betaKInE s` in `π“ž E`. -/ @[expose] public section open Polynomial Finset ComplexConjugate NumberField namespace New section Families variable {E I J : Type} [Field E] [CMType E] [WeilData E] [Fintype I] [Fintype J] /-- The disjoint union of a tight frame `w` with multiplicities `m` and frame bound `M` and a tight frame `w'` with multiplicities `m'` and frame bound `M'` is a tight frame with frame bound `M + M'`. This disjoint union is the family `Sum.elim w w'` with multiplicities `Sum.elim m m'`. -/ lemma IsTightFrame.sumElim {w : I β†’ E} {w' : J β†’ E} {m : I β†’ β„•} {m' : J β†’ β„•} {M M' : β„•} (hw : IsTightFrame w m M) (hw' : IsTightFrame w' m' M') : IsTightFrame (Sum.elim w w') (Sum.elim m m') (M + M') := by refine ⟨Sum.forall.2 ⟨hw.finiteImage_mem, hw'.finiteImage_mem⟩, fun Οƒ Ο„ ↦ ?_⟩ simp [Fintype.sum_sum_type, hw.sum_mul_conj, hw'.sum_mul_conj, ite_add_ite] end Families /-- Let `d` be a prime with `d ≑ 7 mod 8`. An element of `K = β„š(√-d)` fixed by complex conjugation is rational. -/ lemma QuadField.exists_algebraMap_eq_of_star_eq {d : β„•} [PrimeSevenModEight d] {a : QuadField d} (ha : star a = a) : βˆƒ q : β„š, algebraMap β„š (QuadField d) q = a := by let aReal : maximalRealSubfield (QuadField d) := ⟨a, mem_maximalRealSubfield_iff_star_eq.2 ha⟩ exact ⟨(CMExtension.equivMaximalRealSubfield β„š (QuadField d)).symm aReal, CMExtension.algebraMap_equivMaximalRealSubfield_symm_apply β„š (QuadField d) aReal⟩ /-- Let `d` be a prime with `d ≑ 7 mod 8`. If a complex number `z` lies in `quadInt d`, the ring of integers of `K = β„š(√-d)` as a subring of `β„‚`, and is real, then `z` is a rational integer. -/ lemma exists_eq_intCast_of_mem_quadInt_of_conj_eq {d : β„•} [PrimeSevenModEight d] {z : β„‚} (hz : z ∈ quadInt d) (h_real : conj z = z) : βˆƒ n : β„€, z = n := by obtain ⟨a, rfl⟩ : βˆƒ a : π“ž (QuadField d), ((a : QuadField d) : β„‚) = z := RingHom.mem_range.1 hz have ha_real : star (a : QuadField d) = a := Subtype.ext ((QuadField.coe_star_eq_conj d a).trans h_real) obtain ⟨q, hq⟩ : βˆƒ q : β„š, algebraMap β„š (QuadField d) q = a := QuadField.exists_algebraMap_eq_of_star_eq ha_real have h_int : IsIntegral β„€ q := by rw [← isIntegral_algebraMap_iff (B := QuadField d), hq] exact a.isIntegral_coe obtain ⟨n, rfl⟩ : βˆƒ n : β„€, algebraMap β„€ β„š n = q := IsIntegrallyClosed.algebraMap_eq_of_integral h_int exact ⟨n, by simp [← hq]⟩ namespace Parameters variable {P : Parameters} {s : β„•} open scoped Classical in /-- An element `y` of `E` lies in the lattice `π”žβ‚€`, that is `finiteImage id y ∈ Γ” E`, if and only if `relDifferentGen * y` is integral at the finite places dividing `betaKInE = (1 + √-d) / 2` and `y` is integral at the other finite places. Here `relDifferentGen` generates the different of `E/K`. -/ lemma finiteImage_mem_iff {y : P.E s} : finiteImage id y ∈ Γ” (P.E s) ↔ βˆ€ w : FinPlace (P.E s), w.valuation (P.E s) ((if P.betaKInE s ∈ w.asIdeal then (P.relDifferentGen s : P.E s) else 1) * y) ≀ 1 := by refine mem_Γ”.trans (forall_congr' fun w ↦ ?_) by_cases hw : P.betaKInE s ∈ w.asIdeal <;> simp [finiteImage, WeilData.Ξ±, Ξ±, hw] /-- `Ξ¦ Ο„ (betaKInE s) = quadGen P.d` for every infinite place `Ο„` of `E`. -/ private lemma phi_betaKInE (Ο„ : P.Ξ¦ s) : Ξ¦ Ο„ (P.betaKInE s : P.E s) = quadGen P.d := by rw [show (P.betaKInE s : P.E s) = algebraMap P.K (P.E s) (QuadField.betaK P.d) from rfl, P.phi_algebraMap s Ο„] rfl /-- Let `N = l * r` and `r = l ^ a * M` with `l` prime not dividing `M`, and let `ΞΆ` be a root of the cyclotomic polynomial `Ξ¦_N`. Then `N` divides `Ξ¦_N'(ΞΆ) * (ΞΆ ^ r - 1) * M`, by expanding `Ξ¦_M(X ^ l) = Ξ¦_{M l}(X) * Ξ¦_M(X)` by `l ^ a` and differentiating at `ΞΆ`. -/ private lemma natCast_dvd_eval_derivative_cyclotomic_mul {R : Type*} [CommRing R] [CharZero R] {N l r a M : β„•} {ΞΆ : R} (hl_prime : l.Prime) (hl_ndvd_M : Β¬ l ∣ M) (hN_eq : N = l * r) (hr_eq : r = l ^ a * M) (h_root : (cyclotomic N R).eval ΞΆ = 0) : (N : R) ∣ (cyclotomic N R).derivative.eval ΞΆ * (ΞΆ ^ r - 1) * M := by have hN_fac : M * l * l ^ a = N := by rw [hN_eq, hr_eq]; ring have h_exp_eq : expand R (l ^ a * l) (cyclotomic M R) = cyclotomic N R * expand R (l ^ a) (cyclotomic M R) := by have h_step := congrArg (expand R (l ^ a)) (cyclotomic_expand_eq_cyclotomic_mul hl_prime hl_ndvd_M R) rw [expand_mul, h_step, map_mul, expand_pow_cyclotomic hl_prime (dvd_mul_left l M), hN_fac] have h_deriv_exp : (N : R) * ((cyclotomic M R).derivative.eval (ΞΆ ^ (l ^ a * l)) * ΞΆ ^ (l ^ a * l - 1)) = (M : R) * ((cyclotomic N R).derivative.eval ΞΆ * (expand R (l ^ a) (cyclotomic M R)).eval ΞΆ) := by have h_eq := congrArg (fun f : R[X] ↦ f.derivative.eval ΞΆ) h_exp_eq simp only [derivative_expand, derivative_mul, eval_mul, eval_add, eval_natCast, eval_pow, eval_X, expand_eval, h_root, zero_mul, add_zero] at h_eq have h_mul := congrArg (fun x : R ↦ (M : R) * x) h_eq have hN_cast : (M : R) * ((l ^ a * l : β„•) : R) = (N : R) := by exact_mod_cast (show M * (l ^ a * l) = N by rw [hN_eq, hr_eq]; ring) calc (N : R) * ((cyclotomic M R).derivative.eval (ΞΆ ^ (l ^ a * l)) * ΞΆ ^ (l ^ a * l - 1)) = (M : R) * ((cyclotomic M R).derivative.eval (ΞΆ ^ (l ^ a * l)) * (((l ^ a * l : β„•) : R) * ΞΆ ^ (l ^ a * l - 1))) := by rw [← hN_cast]; ring _ = (M : R) * ((cyclotomic N R).derivative.eval ΞΆ * (expand R (l ^ a) (cyclotomic M R)).eval ΞΆ) := by simpa [expand_eval] using h_mul have h_dvd_exp : (expand R (l ^ a) (cyclotomic M R)).eval ΞΆ ∣ ΞΆ ^ r - 1 := by simpa [expand_eval, ← pow_mul, ← hr_eq] using (Polynomial.eval_dvd (cyclotomic.dvd_X_pow_sub_one M R) (x := ΞΆ ^ l ^ a)) have h1 : (N : R) ∣ (M : R) * ((cyclotomic N R).derivative.eval ΞΆ * (expand R (l ^ a) (cyclotomic M R)).eval ΞΆ) := ⟨_, h_deriv_exp.symm⟩ have h2 : (N : R) ∣ (M : R) * ((cyclotomic N R).derivative.eval ΞΆ * (ΞΆ ^ r - 1)) := h1.trans (mul_dvd_mul_left (M : R) (mul_dvd_mul_left _ h_dvd_exp)) simpa [mul_assoc, mul_left_comm, mul_comm] using h2 /-- Let `ΞΆ` be a primitive `N`-th root of unity in a characteristic-zero domain `R`, and let `β„“` be a prime factor of `N = β„“ * r`. Writing `r = β„“ ^ a * M` with `β„“ ∀ M`, we have `M ≀ N`, the prime factors of `N` dividing `M` are precisely those different from `β„“`, and there exists `V ∈ R` with `V ∣ M` and `Ξ¦_N'(ΞΆ) * (ΞΆ ^ r - 1) * M = N * V`. -/ lemma exists_cyclotomic_different_factor {R : Type*} [CommRing R] [IsDomain R] [CharZero R] {N : β„•} {ΞΆ : R} (hΞΆ : IsPrimitiveRoot ΞΆ N) (β„“ : N.primeFactors) : βˆƒ r M : β„•, M ≀ N ∧ N = β„“.val * r ∧ (βˆ€ p ∈ N.primeFactors, p ∣ M ↔ p β‰  β„“.val) ∧ βˆƒ V : R, V ∣ (M : R) ∧ (cyclotomic N R).derivative.eval ΞΆ * (ΞΆ ^ r - 1) * M = N * V := by rcases β„“ with ⟨l, hl⟩ obtain ⟨hl_prime, ⟨r, hN_eq⟩, hN_ne⟩ := Nat.mem_primeFactors.1 hl have hN_pos : 0 < N := Nat.pos_of_ne_zero hN_ne have hr_pos : 0 < r := Nat.pos_of_ne_zero fun hr0 ↦ hN_ne (by simp [hN_eq, hr0]) have hr_lt : r < N := by rw [hN_eq] exact lt_mul_of_one_lt_left hr_pos hl_prime.one_lt obtain ⟨q, hq⟩ : (X ^ r - 1) * cyclotomic N R ∣ X ^ N - 1 := X_pow_sub_one_mul_cyclotomic_dvd_X_pow_sub_one_of_dvd R (Nat.mem_properDivisors.2 ⟨⟨l, by rw [hN_eq, mul_comm]⟩, hr_lt⟩) obtain ⟨a, M, hl_ndvd_M, hr_eq⟩ := r.exists_eq_pow_mul_and_not_dvd hr_pos.ne' l hl_prime.ne_one have hM_le : M ≀ N := by calc M ≀ l ^ a * M := Nat.le_mul_of_pos_left M (pow_pos hl_prime.pos a) _ = r := hr_eq.symm _ ≀ N := hr_lt.le have hM_primes : βˆ€ p ∈ N.primeFactors, p ∣ M ↔ p β‰  l := by grind [Nat.Prime.dvd_mul, Nat.prime_eq_prime_of_dvd_pow, Nat.prime_dvd_prime_iff_eq] -- Differentiate `X ^ N - 1 = (X ^ r - 1) * Ξ¦_N(X) * q(X)` at `ΞΆ` and multiply by `ΞΆ`. have h_root : (cyclotomic N R).eval ΞΆ = 0 := hΞΆ.isRoot_cyclotomic hN_pos have h_deriv_N : (N : R) = (ΞΆ ^ r - 1) * (cyclotomic N R).derivative.eval ΞΆ * (q.eval ΞΆ * ΞΆ) := by have hz : ((X ^ r - 1) * cyclotomic N R).eval ΞΆ = 0 := by simp [h_root] simpa [derivative_mul, h_root, mul_assoc] using natCast_eq_eval_derivative_mul hN_ne hΞΆ.pow_eq_one hz hq -- `N` divides `Ξ¦_N'(ΞΆ) * (ΞΆ ^ r - 1) * M`, by expanding `Ξ¦_M` at `ΞΆ ^ l ^ a`. obtain ⟨V, hV_eq⟩ := natCast_dvd_eval_derivative_cyclotomic_mul hl_prime hl_ndvd_M hN_eq hr_eq h_root have hV_dvd_M : V ∣ (M : R) := ⟨q.eval ΞΆ * ΞΆ, mul_left_cancelβ‚€ (Nat.cast_ne_zero.2 hN_ne) (by linear_combination (q.eval ΞΆ * ΞΆ) * hV_eq + (M : R) * h_deriv_N)⟩ exact ⟨r, M, hM_le, hN_eq, hM_primes, V, hV_dvd_M, hV_eq⟩ /-- Every prime factor of `q₁ = P.q₁ s` divides `n = (d + 1) / 4`, so `q₁ ∣ n ^ q₁`. -/ private lemma q₁_dvd_pow_q₁ : P.q₁ s ∣ ((P.d + 1) / 4) ^ P.q₁ s := by have hn : (P.d + 1) / 4 β‰  0 := by grind [P.sixty_four_lt_d] refine (Nat.dvd_pow_self_iff (NeZero.ne _) hn).2 fun p hp ↦ ?_ obtain ⟨h_prime, h_dvd, -⟩ := Nat.mem_primeFactors.1 hp exact h_prime.mem_primeFactors (P.dvd_d_add_one_div_four_of_dvd_q₁ h_prime h_dvd) hn /-- Since `n = (d + 1) / 4` is nilpotent modulo `q₁`, the quadratic polynomial `n yΒ² + y + 1` has a root `z < q₁` modulo `q₁`. -/ private lemma exists_quad_congr_mod_q₁ : βˆƒ z < P.q₁ s, βˆƒ e : β„•, ((P.d + 1) / 4) * z ^ 2 + z + 1 = P.q₁ s * e := by set N : β„• := P.q₁ s set n : β„• := (P.d + 1) / 4 have hn : IsNilpotent (n : ZMod N) := ⟨N, by rw [← Nat.cast_pow, (ZMod.natCast_eq_zero_iff _ N).2 q₁_dvd_pow_q₁]⟩ -- The map `y ↦ n * y ^ 2 + y` on `ZMod N` is injective because `1 + n * (a + b)` is a unit. have h_inj : Function.Injective fun y : ZMod N ↦ (n : ZMod N) * y ^ 2 + y := by intro a b hab have h_unit : IsUnit ((n : ZMod N) * (a + b) + 1) := ((Commute.all _ _).isNilpotent_mul_right hn).isUnit_add_one have h_fac : ((n : ZMod N) * (a + b) + 1) * (a - b) = 0 := by linear_combination hab exact sub_eq_zero.1 (h_unit.mul_left_cancel (by simpa using h_fac)) obtain ⟨y, hy⟩ := Finite.surjective_of_injective h_inj (-1 : ZMod N) have h_dvd : N ∣ n * y.val ^ 2 + y.val + 1 := by rw [← ZMod.natCast_eq_zero_iff] push_cast rw [ZMod.natCast_zmod_val] linear_combination hy obtain ⟨e, he⟩ := h_dvd exact ⟨y.val, y.val_lt, e, he⟩ /-- Inner sum identity for the cyclotomic-orbit tight frame: for `Ξ±, Ξ²', W : β„‚` with `βˆ‘ i : Fin l, Ξ± ^ i = 0` and `βˆ‘ i : Fin l, Ξ²' ^ i = 0` (`0 < l`), summing `(0 ^ k * Ξ± ^ i + W * (Ξ± ^ i - Ξ± ^ k)) * (0 ^ k * Ξ²' ^ i + conj W * (Ξ²' ^ i - Ξ²' ^ k))` over `k, i : Fin l` yields `(1 + W + conj W + 2 * l * (W * conj W)) * βˆ‘ i : Fin l, (Ξ± * Ξ²') ^ i`. -/ private lemma sum_inner_frame {l : β„•} (hl : 0 < l) {Ξ± Ξ²' W : β„‚} (hΞ± : βˆ‘ i : Fin l, Ξ± ^ i.val = 0) (hΞ²' : βˆ‘ i : Fin l, Ξ²' ^ i.val = 0) : βˆ‘ k : Fin l, βˆ‘ i : Fin l, ((0 : β„‚) ^ k.val * Ξ± ^ i.val + W * (Ξ± ^ i.val - Ξ± ^ k.val)) * ((0 : β„‚) ^ k.val * Ξ²' ^ i.val + conj W * (Ξ²' ^ i.val - Ξ²' ^ k.val)) = (1 + W + conj W + 2 * (l : β„‚) * (W * conj W)) * βˆ‘ i : Fin l, (Ξ± * Ξ²') ^ i.val := by have h_zeroPow (g : Fin l β†’ β„‚) : βˆ‘ k : Fin l, (0 : β„‚) ^ k.val * g k = g ⟨0, hl⟩ := by rw [Finset.sum_eq_single ⟨0, hl⟩] Β· simp Β· intro k _ hk; simp [zero_pow (fun h ↦ hk (Fin.ext h))] Β· simp -- Expand each summand into a `0 ^ k` term and a `W * conj W` term. have h_expand (k i : Fin l) : ((0 : β„‚) ^ k.val * Ξ± ^ i.val + W * (Ξ± ^ i.val - Ξ± ^ k.val)) * ((0 : β„‚) ^ k.val * Ξ²' ^ i.val + conj W * (Ξ²' ^ i.val - Ξ²' ^ k.val)) = (0 : β„‚) ^ k.val * ((0 : β„‚) ^ k.val * (Ξ± * Ξ²') ^ i.val + conj W * ((Ξ± * Ξ²') ^ i.val - Ξ± ^ i.val * Ξ²' ^ k.val) + W * ((Ξ± * Ξ²') ^ i.val - Ξ± ^ k.val * Ξ²' ^ i.val)) + W * conj W * ((Ξ± * Ξ²') ^ i.1 - Ξ± ^ i.1 * Ξ²' ^ k.1 - Ξ± ^ k.1 * Ξ²' ^ i.1 + (Ξ± * Ξ²') ^ k.1) := by rw [mul_pow, mul_pow]; ring simp_rw [h_expand, Finset.sum_add_distrib, ← Finset.mul_sum, h_zeroPow] simp_rw [Finset.sum_add_distrib, Finset.sum_sub_distrib, ← Finset.mul_sum, ← Finset.sum_mul, pow_zero, one_mul, mul_one, hΞ±, hΞ²', mul_zero, zero_mul, sub_zero, Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul, ← Finset.mul_sum] simp_rw [Finset.sum_sub_distrib, hΞ±, hΞ²', sub_zero] ring /-- `periodFactor * conj (Ξ¦ Ο„ y)` has absolute value 1 at the embedding `ΞΉβ‚š : β„‚ β†’+* β„‚_[p]` (the instance `PadicPlace p`) for all `Ο„` in the CM type. These numbers are the coefficients of the linear form `z ↦ periodFactor * βˆ‘ Ο„, conj (Ξ¦ Ο„ y) * Ξ¦ Ο„ z`. -/ def HasUnitLinearForm (P : Parameters) (s p : β„•) [Fact p.Prime] [PadicPlace p] (y : P.E s) : Prop := βˆ€ Ο„ : InfinitePlace (P.E s), β€–(ΞΉβ‚š (P.periodFactor s * conj (Ξ¦ Ο„ y)) : β„‚_[p])β€– = 1 /-- There is a tight frame `v` in `π”žβ‚€` with multiplicities `1` of length `h ≀ (d q₁) ^ 6` prime to `q₁`, such that for every prime `p` and embedding `ΞΉβ‚š : β„‚ β†’+* β„‚_[p]`, either `1` or some member `v i` has `HasUnitLinearForm`. -/ theorem exists_isTightFrame_coprime (P : Parameters) (s : β„•) : βˆƒ (h : β„•) (I : Type) (_ : Fintype I) (v : I β†’ P.E s), IsTightFrame v 1 h ∧ h ≀ (P.d * P.q₁ s) ^ 6 ∧ h.Coprime (P.q₁ s) ∧ βˆ€ (p : β„•) [Fact p.Prime] [PadicPlace p], P.HasUnitLinearForm s p 1 ∨ βˆƒ i : I, P.HasUnitLinearForm s p (v i) := by classical set N : β„• := P.q₁ s set n : β„• := (P.d + 1) / 4 have hN_ne : N β‰  0 := NeZero.ne N have hN_pos : 0 < N := NeZero.pos N have hΞΆ : IsPrimitiveRoot (P.zetaInt s) N := isPrimitiveRoot_zetaInt have hΞ²_mul : P.betaKInE s * (1 - P.betaKInE s) = (n : π“ž (P.E s)) := P.betaKInE_mul_one_sub s -- Factor `Ξ¦_N'(ΞΆ)` at each prime `β„“ ∣ N`, and solve `n zΒ² + z + 1 = N e`. choose r M hM_le hN_eq hM_primes V hV_dvd hV_eq using fun β„“ : N.primeFactors ↦ exists_cyclotomic_different_factor hΞΆ β„“ obtain ⟨z, hz_lt, e, he_eq⟩ := exists_quad_congr_mod_q₁ (P := P) (s := s) obtain ⟨f, hf_eq⟩ : N ∣ n ^ N := q₁_dvd_pow_q₁ let t : π“ž (P.E s) := 1 - P.betaKInE s + (n : π“ž (P.E s)) * (z : π“ž (P.E s)) let a (β„“ : N.primeFactors) : π“ž (P.E s) := P.zetaInt s ^ r β„“ -- The frame vectors indexed by `(β„“, j, k, i) ∈ Ξ£ β„“ : N.primeFactors, Fin (r β„“) Γ— Fin β„“ Γ— Fin β„“`. let I : Type := Ξ£ β„“ : N.primeFactors, Fin (r β„“) Γ— Fin β„“.val Γ— Fin β„“.val let u : I β†’ P.E s := fun βŸ¨β„“, j, k, i⟩ ↦ (P.zetaInt s : P.E s) ^ j.val * ((0 : P.E s) ^ k.val * (a β„“ : P.E s) ^ i.val + ((t : P.E s) * (M β„“ : P.E s) / (N : P.E s)) * ((a β„“ : P.E s) ^ i.val - (a β„“ : P.E s) ^ k.val)) let c : β„• := βˆ‘ β„“ : N.primeFactors, (N + M β„“ * (1 + 2 * n * (z + β„“.val * (M β„“ * e)))) -- Step 1: Every `u x` lies in the lattice `π”žβ‚€ = E ∩ Ξ± Γ”`. have hu_mem (x : I) : finiteImage id (u x) ∈ Γ” (P.E s) := by rcases x with βŸ¨β„“, j, k, i⟩ refine finiteImage_mem_iff.2 fun v ↦ ?_ obtain ⟨g, hg⟩ : a β„“ - 1 ∣ a β„“ ^ i.val - a β„“ ^ k.val := by simpa using dvd_sub (sub_one_dvd_pow_sub_one (a β„“) i.1) (sub_one_dvd_pow_sub_one (a β„“) k.1) have h_int_of_dvd (y : π“ž (P.E s)) (hdvd : (N : π“ž (P.E s)) ∣ y * t * (M β„“ * (a β„“ - 1))) : v.valuation (P.E s) ((y : P.E s) * u βŸ¨β„“, j, k, i⟩) ≀ 1 := by obtain ⟨q, hq⟩ := hdvd have h_eq : (y : P.E s) * u βŸ¨β„“, j, k, i⟩ = ((P.zetaInt s ^ j.val * (y * (0 : π“ž (P.E s)) ^ k.val * a β„“ ^ i.val + q * g) : π“ž (P.E s)) : P.E s) := by have hN_E : (N : P.E s) β‰  0 := Nat.cast_ne_zero.2 hN_ne have hg_E : (a β„“ : P.E s) ^ i.val - (a β„“ : P.E s) ^ k.val = ((a β„“ : P.E s) - 1) * (g : P.E s) := by exact_mod_cast hg have hq_E : (y : P.E s) * (t : P.E s) * ((M β„“ : P.E s) * ((a β„“ : P.E s) - 1)) = (N : P.E s) * (q : P.E s) := by exact_mod_cast hq simp only [u] rw [hg_E] field_simp [hN_E] push_cast linear_combination (P.zetaInt s : P.E s) ^ j.val * (g : P.E s) * hq_E rw [h_eq] exact v.valuation_le_one _ by_cases hv : P.betaKInE s ∈ v.asIdeal Β· rw [ite_eq_left hv] refine h_int_of_dvd (P.relDifferentGen s) ⟨t * V β„“, ?_⟩ have hV_mul : P.relDifferentGen s * (a β„“ - 1) * M β„“ = N * V β„“ := hV_eq β„“ linear_combination t * hV_mul Β· rw [ite_eq_right hv, one_mul] have h_unit : v.valuation (P.E s) (P.betaKInE s : P.E s) = 1 := v.valuation_eq_one_iff_notMem.2 hv have h_beta_dvd : (N : π“ž (P.E s)) ∣ P.betaKInE s ^ N * t := by obtain ⟨w, hw⟩ := sub_dvd_pow_sub_pow (P.betaKInE s) (-(n : π“ž (P.E s)) * (z : π“ž (P.E s))) N have h_prod : (P.betaKInE s - (-(n : π“ž (P.E s)) * (z : π“ž (P.E s)))) * t = (n : π“ž (P.E s)) * ((N : π“ž (P.E s)) * (e : π“ž (P.E s))) := by have he_O : (n : π“ž (P.E s)) * (z : π“ž (P.E s)) ^ 2 + (z : π“ž (P.E s)) + 1 = (N : π“ž (P.E s)) * (e : π“ž (P.E s)) := by exact_mod_cast he_eq linear_combination hΞ²_mul + (n : π“ž (P.E s)) * he_O have hf_O : (n : π“ž (P.E s)) ^ N = (N : π“ž (P.E s)) * (f : π“ž (P.E s)) := by exact_mod_cast hf_eq refine ⟨(n : π“ž (P.E s)) * (e : π“ž (P.E s)) * w + (f : π“ž (P.E s)) * (-(z : π“ž (P.E s))) ^ N * t, ?_⟩ have h_pow_neg : (-(n : π“ž (P.E s)) * (z : π“ž (P.E s))) ^ N = (n : π“ž (P.E s)) ^ N * (-(z : π“ž (P.E s))) ^ N := by rw [show -(n : π“ž (P.E s)) * (z : π“ž (P.E s)) = (n : π“ž (P.E s)) * (-(z : π“ž (P.E s))) by ring, mul_pow] linear_combination t * hw + w * h_prod + (-(z : π“ž (P.E s))) ^ N * t * hf_O + t * h_pow_neg have h_le := h_int_of_dvd (P.betaKInE s ^ N) (dvd_mul_of_dvd_left h_beta_dvd _) simpa [map_mul, h_unit] using h_le -- Step 2: Compute the frame Gram matrix `βˆ‘ x, Ξ¦ Οƒ (u x) * conj (Ξ¦ Ο„ (u x)) = Ξ΄(Οƒ, Ο„) * c`. have h_frame_sum (Οƒ Ο„ : P.Ξ¦ s) : βˆ‘ x : I, Ξ¦ Οƒ (u x) * conj (Ξ¦ Ο„ (u x)) = if Οƒ = Ο„ then (c : β„‚) else 0 := by have h_zeta_frame : βˆ‘ m : Fin N, Ξ¦ Οƒ ((P.zetaInt s : P.E s) ^ m.val) * conj (Ξ¦ Ο„ ((P.zetaInt s : P.E s) ^ m.val)) = if Οƒ = Ο„ then (N : β„‚) else 0 := by have h1 := (P.isTightFrame_zeta_pow s 1).sum_mul_conj Οƒ Ο„ have hN_C : ((P.qβ‚€ : β„‚) * (towerDeg s : β„‚)) = (N : β„‚) := by exact_mod_cast rfl simpa [hN_C] using h1 have h_phi_t (ρ : P.Ξ¦ s) : Ξ¦ ρ (t : P.E s) = 1 - quadGen P.d + (n : β„‚) * (z : β„‚) := by simp [t, phi_betaKInE] have hΞ²_sum : quadGen P.d + conj (quadGen P.d) = 1 := by have := congrArg (fun x : π“ž (P.E s) ↦ Ξ¦ Οƒ (x : P.E s)) (P.star_betaKInE s) simp only [coe_star_ringOfIntegers, map_star_complex, Complex.star_def, map_sub, map_one, phi_betaKInE] at this linear_combination this have h_t_add : (1 - quadGen P.d + (n : β„‚) * (z : β„‚)) + conj (1 - quadGen P.d + (n : β„‚) * (z : β„‚)) = 1 + 2 * (n : β„‚) * (z : β„‚) := by simp only [map_add, map_sub, map_one, map_mul, map_natCast] linear_combination -hΞ²_sum have h_t_mul : (1 - quadGen P.d + (n : β„‚) * (z : β„‚)) * conj (1 - quadGen P.d + (n : β„‚) * (z : β„‚)) = (n : β„‚) * ((N : β„‚) * (e : β„‚)) := by have hΞ²_prod : quadGen P.d * (1 - quadGen P.d) = (n : β„‚) := by have := congrArg (fun x : π“ž (P.E s) ↦ Ξ¦ Οƒ (x : P.E s)) hΞ²_mul simpa [phi_betaKInE] using this have he_C : (n : β„‚) * (z : β„‚) ^ 2 + (z : β„‚) + 1 = (N : β„‚) * (e : β„‚) := by exact_mod_cast he_eq simp only [map_add, map_sub, map_one, map_mul, map_natCast] linear_combination (1 - quadGen P.d + (n : β„‚) * (z : β„‚)) * (-hΞ²_sum) + hΞ²_prod + (n : β„‚) * he_C -- Compute the contribution of each prime factor `β„“ ∣ N`. have h_block (β„“ : N.primeFactors) : βˆ‘ p : Fin (r β„“) Γ— Fin β„“.val Γ— Fin β„“.val, Ξ¦ Οƒ (u βŸ¨β„“, p⟩) * conj (Ξ¦ Ο„ (u βŸ¨β„“, p⟩)) = if Οƒ = Ο„ then ((N + M β„“ * (1 + 2 * n * (z + β„“.val * (M β„“ * e))) : β„•) : β„‚) else 0 := by have hβ„“_prime : β„“.val.Prime := Nat.prime_of_mem_primeFactors β„“.property have hN_comm : N = r β„“ * β„“.val := (hN_eq β„“).trans (mul_comm _ _) have h_prim_a : IsPrimitiveRoot (a β„“) β„“.val := hΞΆ.pow hN_pos hN_comm have h_sum_a : βˆ‘ i : Fin β„“.val, (a β„“ : P.E s) ^ i.val = 0 := by have h0 : βˆ‘ i ∈ range β„“.val, (a β„“) ^ i = 0 := h_prim_a.geom_sum_eq_zero hβ„“_prime.one_lt rw [← Fin.sum_univ_eq_sum_range] at h0 exact_mod_cast h0 let Ξ± : β„‚ := Ξ¦ Οƒ (a β„“ : P.E s) let Ξ²' : β„‚ := conj (Ξ¦ Ο„ (a β„“ : P.E s)) have h_sum_Ξ±Οƒ : βˆ‘ i : Fin β„“.val, Ξ± ^ i.val = 0 := by simpa [Ξ±, map_sum, map_pow] using congrArg (Ξ¦ Οƒ) h_sum_a have h_sum_Ξ±Ο„ : βˆ‘ i : Fin β„“.val, Ξ²' ^ i.val = 0 := by simpa [Ξ²', map_sum, map_pow] using congrArg (conj ∘ Ξ¦ Ο„) h_sum_a let Ξ³ : β„‚ := Ξ¦ Οƒ (P.zetaInt s : P.E s) * conj (Ξ¦ Ο„ (P.zetaInt s : P.E s)) have h_prod_sum : (βˆ‘ j : Fin (r β„“), Ξ³ ^ j.val) * (βˆ‘ i : Fin β„“.val, (Ξ³ ^ r β„“) ^ i.val) = if Οƒ = Ο„ then (N : β„‚) else 0 := by calc _ = βˆ‘ m : Fin N, Ξ³ ^ m.val := by simp_rw [Fin.sum_univ_eq_sum_range] rw [← TauCeti.geom_sum_range_mul, ← hN_comm] _ = _ := by simpa [Ξ³, mul_pow, map_pow] using h_zeta_frame set W : β„‚ := (1 - quadGen P.d + (n : β„‚) * (z : β„‚)) * (M β„“ : β„‚) / (N : β„‚) have h_Ξ±Ξ² : Ξ± * Ξ²' = Ξ³ ^ r β„“ := by simp [Ξ±, Ξ²', Ξ³, a, mul_pow, map_pow] have h_inner : βˆ‘ k : Fin β„“.val, βˆ‘ i : Fin β„“.val, ((0 : β„‚) ^ k.val * Ξ± ^ i.val + W * (Ξ± ^ i.val - Ξ± ^ k.val)) * ((0 : β„‚) ^ k.val * Ξ²' ^ i.val + conj W * (Ξ²' ^ i.val - Ξ²' ^ k.val)) = (1 + W + conj W + 2 * (β„“.val : β„‚) * (W * conj W)) * βˆ‘ i : Fin β„“.val, (Ξ³ ^ r β„“) ^ i.val := by simpa [h_Ξ±Ξ²] using sum_inner_frame hβ„“_prime.pos h_sum_Ξ±Οƒ h_sum_Ξ±Ο„ have h_factor_val : (1 + W + conj W + 2 * (β„“.val : β„‚) * (W * conj W)) * (N : β„‚) = ((N + M β„“ * (1 + 2 * n * (z + β„“.val * (M β„“ * e))) : β„•) : β„‚) := by have hN_C : (N : β„‚) β‰  0 := Nat.cast_ne_zero.2 hN_ne have hW_conj : conj W = conj (1 - quadGen P.d + (n : β„‚) * (z : β„‚)) * (M β„“ : β„‚) / (N : β„‚) := by simp [W] rw [hW_conj] simp only [W] field_simp [hN_C] push_cast linear_combination (M β„“ : β„‚) * (N : β„‚) * h_t_add + 2 * (β„“.val : β„‚) * (M β„“ : β„‚) ^ 2 * h_t_mul have h_u_apply (j : Fin (r β„“)) (k i : Fin β„“.val) : Ξ¦ Οƒ (u βŸ¨β„“, j, k, i⟩) * conj (Ξ¦ Ο„ (u βŸ¨β„“, j, k, i⟩)) = Ξ³ ^ j.val * (((0 : β„‚) ^ k.val * Ξ± ^ i.val + W * (Ξ± ^ i.val - Ξ± ^ k.val)) * ((0 : β„‚) ^ k.val * Ξ²' ^ i.val + conj W * (Ξ²' ^ i.val - Ξ²' ^ k.val))) := by simp only [u, map_mul, map_add, map_sub, map_divβ‚€, map_pow, map_zero, map_natCast, h_phi_t, W, Ξ±, Ξ²', Ξ³, mul_pow] ring calc βˆ‘ p : Fin (r β„“) Γ— Fin β„“.val Γ— Fin β„“.val, Ξ¦ Οƒ (u βŸ¨β„“, p⟩) * conj (Ξ¦ Ο„ (u βŸ¨β„“, p⟩)) = βˆ‘ j : Fin (r β„“), βˆ‘ k : Fin β„“.val, βˆ‘ i : Fin β„“.val, Ξ¦ Οƒ (u βŸ¨β„“, j, k, i⟩) * conj (Ξ¦ Ο„ (u βŸ¨β„“, j, k, i⟩)) := by simp [Fintype.sum_prod_type] _ = (βˆ‘ j : Fin (r β„“), Ξ³ ^ j.val) * ((1 + W + conj W + 2 * (β„“.val : β„‚) * (W * conj W)) * βˆ‘ i : Fin β„“.val, (Ξ³ ^ r β„“) ^ i.val) := by simp_rw [h_u_apply, ← Finset.mul_sum, h_inner, ← Finset.sum_mul] _ = (1 + W + conj W + 2 * (β„“.val : β„‚) * (W * conj W)) * ((βˆ‘ j : Fin (r β„“), Ξ³ ^ j.val) * (βˆ‘ i : Fin β„“.val, (Ξ³ ^ r β„“) ^ i.val)) := by ring _ = if Οƒ = Ο„ then ((N + M β„“ * (1 + 2 * n * (z + β„“.val * (M β„“ * e))) : β„•) : β„‚) else 0 := by rw [h_prod_sum] split_ifs Β· exact h_factor_val Β· ring rw [Fintype.sum_sigma] simp_rw [h_block] split_ifs <;> simp [c] -- Step 3: `c` is coprime to `N`. have hc_coprime : c.Coprime N := by refine Nat.coprime_of_dvd fun p hp hpc hpN ↦ ?_ have hp_mem : p ∈ N.primeFactors := Nat.mem_primeFactors.2 ⟨hp, hpN, hN_ne⟩ have hp_n : p ∣ n := P.dvd_d_add_one_div_four_of_dvd_q₁ hp hpN have h_zero : (c : ZMod p) = 0 := (ZMod.natCast_eq_zero_iff c p).2 hpc have h_eval : (c : ZMod p) = (M ⟨p, hp_mem⟩ : ZMod p) := by simp only [c, Nat.cast_sum] rw [Finset.sum_eq_single ⟨p, hp_mem⟩] Β· have hN0 : (N : ZMod p) = 0 := (ZMod.natCast_eq_zero_iff N p).2 hpN have hn0 : (n : ZMod p) = 0 := (ZMod.natCast_eq_zero_iff n p).2 hp_n simp [hN0, hn0] Β· intro β„“ _ hβ„“_ne have hN0 : (N : ZMod p) = 0 := (ZMod.natCast_eq_zero_iff N p).2 hpN have hM0 : (M β„“ : ZMod p) = 0 := (ZMod.natCast_eq_zero_iff (M β„“) p).2 ((hM_primes β„“ p hp_mem).2 fun h ↦ hβ„“_ne (Subtype.ext h.symm)) simp [hN0, hM0] Β· simp have hp_M : p ∣ M ⟨p, hp_mem⟩ := (ZMod.natCast_eq_zero_iff _ p).1 (h_eval.symm.trans h_zero) exact (hM_primes ⟨p, hp_mem⟩ p hp_mem).1 hp_M rfl -- Step 4: Elementary polynomial bound `c ≀ (d * N) ^ 6`. have hc_le : c ≀ (P.d * N) ^ 6 := by have hd_ge : 7 ≀ P.d := by have hmod : P.d % 8 = 7 := PrimeSevenModEight.mod_eight omega have hn_le : n ≀ P.d := by omega have h_card : Fintype.card N.primeFactors ≀ N := by rw [Fintype.card_coe] calc N.primeFactors.card ≀ (Finset.Icc 1 N).card := Finset.card_le_card fun p hp ↦ Finset.mem_Icc.2 ⟨(Nat.prime_of_mem_primeFactors hp).pos, Nat.le_of_mem_primeFactors hp⟩ _ = N := by simp have h_e_le : e ≀ n * N + 2 := by have h1 : N * e ≀ n * N ^ 2 + N + 1 := by have he' : n * z ^ 2 + z + 1 = N * e := he_eq have hz_le : z ≀ N := hz_lt.le have hmul : n * z ^ 2 ≀ n * N ^ 2 := Nat.mul_le_mul_left n (Nat.pow_le_pow_left hz_le 2) omega have h2 : N * e ≀ N * (n * N + 2) := by calc N * e ≀ n * N ^ 2 + N + 1 := h1 _ ≀ n * N ^ 2 + N + N := by omega _ = N * (n * N + 2) := by ring exact Nat.le_of_mul_le_mul_left h2 hN_pos have h_term_le (β„“ : N.primeFactors) : N + M β„“ * (1 + 2 * n * (z + β„“.val * (M β„“ * e))) ≀ P.d ^ 6 * N ^ 5 := by have hβ„“_le : β„“.val ≀ N := Nat.le_of_mem_primeFactors β„“.property have hM : M β„“ ≀ N := hM_le β„“ have hz_le : z ≀ N := hz_lt.le have h_inner1 : M β„“ * e ≀ (P.d + 2) * N ^ 2 := by calc M β„“ * e ≀ N * (n * N + 2) := Nat.mul_le_mul hM h_e_le _ ≀ N * (P.d * N + 2 * N) := by gcongr; omega _ = (P.d + 2) * N ^ 2 := by ring have h_inner2 : z + β„“.val * (M β„“ * e) ≀ (P.d + 3) * N ^ 4 := by calc z + β„“.val * (M β„“ * e) ≀ N + N * ((P.d + 2) * N ^ 2) := Nat.add_le_add hz_le (Nat.mul_le_mul hβ„“_le h_inner1) _ ≀ N ^ 4 + (P.d + 2) * N ^ 4 := by have hN4 : N ≀ N ^ 4 := Nat.le_self_pow (by norm_num) N have hN34 : N ^ 3 ≀ N ^ 4 := Nat.pow_le_pow_right hN_pos (by norm_num) have h_mul : N * ((P.d + 2) * N ^ 2) = (P.d + 2) * N ^ 3 := by ring rw [h_mul] exact Nat.add_le_add hN4 (Nat.mul_le_mul_left _ hN34) _ = (P.d + 3) * N ^ 4 := by ring have h_inner3 : 1 + 2 * n * (z + β„“.val * (M β„“ * e)) ≀ (2 * P.d * (P.d + 3) + 1) * N ^ 4 := by calc 1 + 2 * n * (z + β„“.val * (M β„“ * e)) ≀ N ^ 4 + 2 * P.d * ((P.d + 3) * N ^ 4) := Nat.add_le_add (one_le_powβ‚€ hN_pos) (Nat.mul_le_mul (Nat.mul_le_mul_left 2 hn_le) h_inner2) _ = (2 * P.d * (P.d + 3) + 1) * N ^ 4 := by ring have h_coeff : 1 + (2 * P.d * (P.d + 3) + 1) ≀ P.d ^ 6 := by have hd_pos : 0 < P.d := lt_of_lt_of_le (by norm_num) hd_ge have h7 : 7 * P.d ≀ P.d * P.d := Nat.mul_le_mul_right _ hd_ge have h3 : P.d * P.d * 3 ≀ P.d ^ 6 := calc P.d * P.d * 3 ≀ P.d * P.d * P.d := Nat.mul_le_mul_left _ (le_trans (by norm_num) hd_ge) _ = P.d ^ 3 := (pow_three' P.d).symm _ ≀ P.d ^ 6 := Nat.pow_le_pow_right hd_pos (by norm_num) have h_eq : 1 + (2 * P.d * (P.d + 3) + 1) = 2 * (P.d * P.d) + 6 * P.d + 2 := by ring omega calc N + M β„“ * (1 + 2 * n * (z + β„“.val * (M β„“ * e))) ≀ N ^ 5 + N * ((2 * P.d * (P.d + 3) + 1) * N ^ 4) := Nat.add_le_add (Nat.le_self_pow (by norm_num) N) (Nat.mul_le_mul hM h_inner3) _ = (1 + (2 * P.d * (P.d + 3) + 1)) * N ^ 5 := by ring _ ≀ P.d ^ 6 * N ^ 5 := Nat.mul_le_mul_right _ h_coeff calc c ≀ βˆ‘ _β„“ : N.primeFactors, P.d ^ 6 * N ^ 5 := Finset.sum_le_sum fun β„“ _ ↦ h_term_le β„“ _ = Fintype.card N.primeFactors * (P.d ^ 6 * N ^ 5) := by simp _ ≀ N * (P.d ^ 6 * N ^ 5) := Nat.mul_le_mul_right _ h_card _ = (P.d * N) ^ 6 := by ring -- Step 5: Unit linear form for every prime `p` and embedding `ΞΉβ‚š : β„‚ β†’+* β„‚_[p]`. have h_unit (p : β„•) [Fact p.Prime] [PadicPlace p] : P.HasUnitLinearForm s p 1 ∨ βˆƒ x : I, P.HasUnitLinearForm s p (u x) := by by_cases h1 : P.HasUnitLinearForm s p 1 Β· exact .inl h1 right have hp_dvd : p ∣ N := by by_contra hp_ndvd exact h1 fun Ο„ ↦ by simp [P.norm_iota_periodFactor_eq_one s hp_ndvd] have hp_prime : p.Prime := Fact.out let β„“ : N.primeFactors := ⟨p, Nat.mem_primeFactors.2 ⟨hp_prime, hp_dvd, hN_ne⟩⟩ have hr_pos : 0 < r β„“ := Nat.pos_of_ne_zero fun hr0 ↦ hN_ne (by simp [hN_eq β„“, hr0]) have h_emb (Ο„ : P.Ξ¦ s) (y : P.E s) : weightEmbedding ΞΉβ‚š Ο„ y = ΞΉβ‚š (conj (Ξ¦ Ο„ y)) := congrArg ΞΉβ‚š (map_star_complex _ y) have hΞ²_mem (Ο„ : P.Ξ¦ s) : P.betaKInE s ∈ (placeOfEmb (weightEmbedding ΞΉβ‚š Ο„)).asIdeal := by have h_const : βˆ€ τ₁ Ο„β‚‚ : P.Ξ¦ s, P.betaKInE s ∈ (placeOfEmb (weightEmbedding ΞΉβ‚š τ₁)).asIdeal ↔ P.betaKInE s ∈ (placeOfEmb (weightEmbedding ΞΉβ‚š Ο„β‚‚)).asIdeal := fun τ₁ Ο„β‚‚ ↦ by simp [mem_placeOfEmb, h_emb, phi_betaKInE] by_contra h_not refine h1 fun Ο„' ↦ ?_ have h_not' : P.betaKInE s βˆ‰ (placeOfEmb (weightEmbedding ΞΉβ‚š Ο„')).asIdeal := mt (h_const Ο„' Ο„).1 h_not simp [norm_iota_periodFactor Ο„', adeleExtension_alpha, h_not'] refine βŸ¨βŸ¨β„“, ⟨0, hr_pos⟩, ⟨1, hp_prime.one_lt⟩, ⟨0, hp_prime.pos⟩⟩, fun Ο„ ↦ ?_⟩ let Ο† : P.E s β†’+* β„‚_[p] := weightEmbedding ΞΉβ‚š Ο„ have h_factor : β€–ΞΉβ‚š (P.periodFactor s)β€– = β€–Ο† (P.relDifferentGen s)β€– := by rw [norm_iota_periodFactor Ο„, adeleExtension_alpha, ite_eq_left (hΞ²_mem Ο„), norm_inv, inv_inv] have h_u_eq : (P.relDifferentGen s : P.E s) * u βŸ¨β„“, ⟨0, hr_pos⟩, ⟨1, hp_prime.one_lt⟩, ⟨0, hp_prime.pos⟩⟩ = ((-t * V β„“ : π“ž (P.E s)) : P.E s) := by have hN_E : (N : P.E s) β‰  0 := Nat.cast_ne_zero.2 hN_ne have hV_E : (P.relDifferentGen s : P.E s) * ((a β„“ : P.E s) - 1) * (M β„“ : P.E s) = (N : P.E s) * (V β„“ : P.E s) := by exact_mod_cast hV_eq β„“ simp only [u, pow_zero, pow_one, one_mul, zero_mul, zero_add] field_simp [hN_E] push_cast linear_combination -(t : P.E s) * hV_E rw [map_mul, norm_mul, ← h_emb, h_factor, ← norm_mul, ← map_mul, h_u_eq] refine (norm_ringOfIntegers_le Ο† (-t * V β„“)).eq_of_not_lt fun h_lt ↦ ?_ have h_mem : -t * V β„“ ∈ (placeOfEmb Ο†).asIdeal := (mem_placeOfEmb Ο† _).2 h_lt have h_t_notMem : t βˆ‰ (placeOfEmb Ο†).asIdeal := by intro ht_mem have h1_mem : (1 : π“ž (P.E s)) ∈ (placeOfEmb Ο†).asIdeal := by have h_n_mem : (n : π“ž (P.E s)) ∈ (placeOfEmb Ο†).asIdeal := by rw [← hΞ²_mul] exact Ideal.mul_mem_right _ _ (hΞ²_mem Ο„) have h_eq : (1 : π“ž (P.E s)) = t + P.betaKInE s - (n : π“ž (P.E s)) * (z : π“ž (P.E s)) := by dsimp only [t]; ring rw [h_eq] exact sub_mem (add_mem ht_mem (hΞ²_mem Ο„)) (Ideal.mul_mem_right _ _ h_n_mem) exact (placeOfEmb Ο†).isPrime.one_notMem h1_mem have hV_mem : V β„“ ∈ (placeOfEmb Ο†).asIdeal := by rcases (placeOfEmb Ο†).isPrime.mem_or_mem h_mem with ht | hV Β· exact absurd (neg_mem_iff.1 ht) h_t_notMem Β· exact hV have hM_mem : (M β„“ : π“ž (P.E s)) ∈ (placeOfEmb Ο†).asIdeal := Ideal.mem_of_dvd _ (hV_dvd β„“) hV_mem have hp_M : p ∣ M β„“ := (FinPlace.natCast_mem_iff_dvd (placeOfEmb Ο†) (natCast_mem_placeOfEmb Ο†)).1 hM_mem exact (hM_primes β„“ p β„“.property).1 hp_M rfl refine ⟨c, I, inferInstance, u, ⟨hu_mem, ?_⟩, hc_le, hc_coprime, h_unit⟩ simpa using h_frame_sum /-- Let `v` be a tight frame with multiplicities 1 of a length `h` prime to `q₁`. For every `m β‰₯ q₁ h + R (q₁ + h)`, the powers `ΞΆ ^ i`, `i < q₁`, and the members of `v` form a tight frame of length `m` with suitable multiplicities, all at least `R`. -/ lemma exists_isTightFrame_of_coprime {h : β„•} {I : Type} [Fintype I] {v : I β†’ P.E s} (hv : IsTightFrame v 1 h) (h_coprime : h.Coprime (P.q₁ s)) {m R : β„•} (h_large : P.q₁ s * h + R * (P.q₁ s + h) ≀ m) : βˆƒ c : Fin (P.q₁ s) βŠ• I β†’ β„•, IsTightFrame (Sum.elim (fun i : Fin (P.q₁ s) ↦ P.ΞΆ s ^ i.val) v) c m ∧ βˆ€ j : Fin (P.q₁ s) βŠ• I, R ≀ c j := by -- Every integer from `q₁ h` on is a sum of multiples of the coprime numbers `q₁` and `h`. obtain ⟨a, b, hab⟩ : βˆƒ a b : β„•, a * P.q₁ s + b * h = m - R * (P.q₁ s + h) := Nat.exists_add_mul_eq_of_gcd_dvd_of_mul_pred_le (P.q₁ s) h _ (by simp [h_coprime.symm.gcd_eq_one]) ((Nat.mul_le_mul (Nat.pred_le _) (Nat.pred_le _)).trans (Nat.le_sub_of_add_le h_large)) have h_sum : (a + R) * P.q₁ s + (b + R) * h = m := by lia -- Take the powers of `ΞΆ` `a + R` times and the frame `v` `b + R` times. have h_pow : IsTightFrame (fun i : Fin (P.q₁ s) ↦ P.ΞΆ s ^ i.val) (fun _ ↦ a + R) ((a + R) * P.q₁ s) := by simpa using (isTightFrame_pow isPrimitiveRoot_zeta).mul_left (a + R) have hv_mul : IsTightFrame v (fun _ ↦ b + R) ((b + R) * h) := by simpa using hv.mul_left (b + R) exact ⟨_, by simpa only [h_sum] using h_pow.sumElim hv_mul, by simp⟩ end Parameters namespace Data open Real variable {P : Parameters} (D : Data P) /-- Let `D` be data for the parameters `P` (a `Data P`), with field `E = D.E = P.E s` for the exponent `s = D.towerExp`, weight `b = D.b`, and `f = D.f` the number of infinite places of `E`. The principal level `M = D.M` is the product of the two distinct primes `D.levelPrime 0` and `D.levelPrime 1` of the data, which lie in `[b ^ 10, b ^ 11]`. There is a tight frame `v` of length `M` with multiplicities `c i β‰₯ 6 f b`. Moreover, for every prime `p` and embedding `ΞΉβ‚š : β„‚ β†’+* β„‚_[p]`, some `y = v i` makes `periodFactor * conj (Ο„(y))` a unit at `ΞΉβ‚š` for all `Ο„` in the CM type. -/ theorem exists_isTightFrame : βˆƒ (I : Type) (_ : Fintype I) (v : I β†’ D.E) (c : I β†’ β„•), IsTightFrame v c D.M ∧ (βˆ€ i : I, 6 * D.f * D.b ≀ c i) ∧ βˆ€ (p : β„•) [Fact p.Prime] [PadicPlace p], βˆƒ i : I, P.HasUnitLinearForm D.towerExp p (v i) := by obtain ⟨h, I, _, v, hv, h_le, h_coprime, h_unit⟩ := P.exists_isTightFrame_coprime D.towerExp -- Since `h ≀ (d q₁) ^ 6`, the threshold `q₁ h + ⌈6 f bβŒ‰ (q₁ + h)` is at most `D.M`. have h_large : D.q₁ * h + ⌈6 * D.f * D.bβŒ‰β‚Š * (D.q₁ + h) ≀ D.M := by have h_bound : (h : ℝ) ≀ D.b := by calc (h : ℝ) ≀ ((P.d * D.q₁) ^ 6 : β„•) := Nat.cast_le.2 h_le _ ≀ D.b := D.le_of_hasLogBound have h_log : D.HasLogUpper h D.logB := ⟨by rwa [ite_eq_left rfl, Nat.abs_cast]⟩ exact D.nat_le_of_hasLogBound let u : Fin D.q₁ βŠ• I β†’ D.E := Sum.elim (fun i : Fin D.q₁ ↦ P.ΞΆ D.towerExp ^ i.val) v obtain ⟨c, hu, hc⟩ : βˆƒ c : Fin D.q₁ βŠ• I β†’ β„•, IsTightFrame u c D.M ∧ βˆ€ j : Fin D.q₁ βŠ• I, ⌈6 * D.f * D.bβŒ‰β‚Š ≀ c j := Parameters.exists_isTightFrame_of_coprime hv h_coprime h_large refine ⟨Fin D.q₁ βŠ• I, inferInstance, u, c, hu, fun j ↦ Nat.ceil_le.1 (hc j), fun p _ _ ↦ ?_⟩ rcases h_unit p with h1 | ⟨i, hi⟩ Β· exact ⟨.inl ⟨0, NeZero.pos _⟩, by simpa [u] using h1⟩ Β· exact ⟨.inr i, hi⟩ end Data end New