import OAI.NumberTheory.SiegelZeros.LocalAlgebra.GaussMinimalPolynomial namespace OAI namespace SiegelZeros namespace SiegelZerosAwei.W09 open scoped NumberField variable {q : β„•} [NeZero q] theorem liftedAddChar_isIntegral (j : ZMod q) : IsIntegral β„€ (liftedAddChar j) := by apply IsIntegral.of_pow (n := q) (NeZero.pos q) have hp : liftedAddChar j ^ q = 1 := by apply Subtype.ext change ZMod.stdAddChar j ^ q = 1 rw [← AddChar.map_nsmul_eq_pow] simp only [nsmul_eq_mul, ZMod.natCast_self, zero_mul, AddChar.map_zero_eq_one] rw [hp] exact isIntegral_one noncomputable def integralAddChar : AddChar (ZMod q) (π“ž (complexCyclotomicField q)) where toFun j := ⟨liftedAddChar j, liftedAddChar_isIntegral j⟩ map_zero_eq_one' := by apply NumberField.RingOfIntegers.ext apply Subtype.ext exact ZMod.stdAddChar.map_zero_eq_one map_add_eq_mul' j k := by apply NumberField.RingOfIntegers.ext apply Subtype.ext exact ZMod.stdAddChar.map_add_eq_mul j k noncomputable def integralGaussSum (Ο‡ : DirichletCharacter β„‚ q) (hq : Ο‡.IsQuadratic) : π“ž (complexCyclotomicField q) := gaussSum (reducedIntegerCharacter Ο‡ hq (π“ž (complexCyclotomicField q))) integralAddChar theorem integralGaussSum_coe (Ο‡ : DirichletCharacter β„‚ q) (hq : Ο‡.IsQuadratic) : ((integralGaussSum Ο‡ hq : complexCyclotomicField q) : β„‚) = characterGaussSum Ο‡ := by simp [integralGaussSum, gaussSum, reducedIntegerCharacter, integralAddChar, liftedAddChar, characterGaussSum, integerCharacter_cast] rfl theorem integralGaussSum_sq (Ο‡ : DirichletCharacter β„‚ q) (hp : Ο‡.IsPrimitive) (hq : Ο‡.IsQuadratic) : integralGaussSum Ο‡ hq ^ 2 = (signedConductor Ο‡ : π“ž (complexCyclotomicField q)) := by apply NumberField.RingOfIntegers.ext apply Subtype.ext change ((integralGaussSum Ο‡ hq : complexCyclotomicField q) : β„‚) ^ 2 = (signedConductor Ο‡ : β„‚) rw [integralGaussSum_coe] exact characterGaussSum_sq_signedConductor Ο‡ hp hq noncomputable def residueAddChar {R : Type*} [CommRing R] (ρ : π“ž (complexCyclotomicField q) β†’+* R) : AddChar (ZMod q) R := ρ.toMonoidHom.compAddChar integralAddChar theorem map_integralGaussSum {R : Type*} [CommRing R] (ρ : π“ž (complexCyclotomicField q) β†’+* R) (Ο‡ : DirichletCharacter β„‚ q) (hq : Ο‡.IsQuadratic) : ρ (integralGaussSum Ο‡ hq) = gaussSum (reducedIntegerCharacter Ο‡ hq R) (residueAddChar ρ) := by simp [integralGaussSum, gaussSum, residueAddChar, reducedIntegerCharacter] theorem residueGaussSum_sq {R : Type*} [CommRing R] (ρ : π“ž (complexCyclotomicField q) β†’+* R) (Ο‡ : DirichletCharacter β„‚ q) (hp : Ο‡.IsPrimitive) (hq : Ο‡.IsQuadratic) : gaussSum (reducedIntegerCharacter Ο‡ hq R) (residueAddChar ρ) ^ 2 = (signedConductor Ο‡ : R) := by rw [← map_integralGaussSum ρ Ο‡ hq, ← map_pow, integralGaussSum_sq Ο‡ hp hq, map_intCast] end SiegelZerosAwei.W09 end SiegelZeros end OAI