import ModuleParameters import QL.Algebra.Negacyclic.Basic /-! Comparison of the integral coordinates and lengths used by the two projects. -/ namespace CyclotomicComparison open DyadicCyclotomic open scoped BigOperators theorem reductions_agree (k q : ℕ) : reduceCoefficients k q = QL.Negacyclic.reduceCoefficients (N := 2 ^ k) q := rfl private theorem finEquiv_val {n : ℕ} [NeZero n] (i : Fin n) : (ZMod.finEquiv n i).val = i.val := by cases n with | zero => exact Fin.elim0 i | succ n => rfl theorem fromCoefficients_agree (k : ℕ) (a : ZMod (2^k) → ℤ) : fromCoefficients k a = QL.ofCoefficients (fun i => a (ZMod.finEquiv (2^k) i)) := by let e := ZMod.finEquiv (2^k) rw [fromCoefficients, QL.Negacyclic.ofCoefficients_eq_sum, ← e.toEquiv.sum_comp (fun i => (a i : Level k) * zeta k ^ i.val)] simp only [e, RingEquiv.toEquiv_eq_coe, RingEquiv.coe_toEquiv, finEquiv_val, zsmul_eq_mul] rfl /-- The paper's squared coefficient norm, multiplied by the degree, is exactly the sum of squared absolute values over the local complex embeddings. -/ theorem embedding_energy (k : ℕ) (x : QL.Negacyclic ℤ (2^k)) : ∑ j, ‖complexEmbedding k j x‖ ^ 2 = (2^k : ℝ) * (x.squaredNorm : ℝ) := by let e := ZMod.finEquiv (2^k) let a := fun j => x.coefficients (e.symm j) have h := canonical_length_sq k a rw [fromCoefficients_agree] at h simp only [a, e, RingEquiv.symm_apply_apply, QL.Negacyclic.ofCoefficients_coefficients] at h rw [h, ← e.toEquiv.sum_comp (fun i => (a i : ℝ)^2)] simp [a, e, QL.Negacyclic.squaredNorm, sq_abs] theorem module_embedding_energy {ι : Type} [Fintype ι] (k : ℕ) (x : ι → QL.Negacyclic ℤ (2^k)) : ∑ t, ∑ j, ‖complexEmbedding k j (x t)‖ ^ 2 = (2^k : ℝ) * (QL.Negacyclic.vectorNorm x)^2 := by simp_rw [embedding_energy, ← Finset.mul_sum] unfold QL.Negacyclic.vectorNorm rw [Real.sq_sqrt (by positivity)] end CyclotomicComparison #print axioms CyclotomicComparison.reductions_agree #print axioms CyclotomicComparison.fromCoefficients_agree #print axioms CyclotomicComparison.embedding_energy #print axioms CyclotomicComparison.module_embedding_energy