File: Mathlib/NumberTheory/DirichletCharacter/Basic.lean

full_name: DirichletCharacter
code: /-- The type of Dirichlet characters of level `n`. -/
abbrev DirichletCharacter (R : Type*) [CommMonoidWithZero R] (n : ℕ) 
goal: Type u_1

full_name: DirichletCharacter.toUnitHom_eq_char'
code: lemma toUnitHom_eq_char' {a : ZMod n} (ha : IsUnit a) : χ a = χ.toUnitHom ha.unit 
goal: χ a = ↑((MulChar.toUnitHom χ) ha.unit)

full_name: DirichletCharacter.toUnitHom_eq_iff
code: lemma toUnitHom_eq_iff (ψ : DirichletCharacter R n) : toUnitHom χ = toUnitHom ψ ↔ χ = ψ 
goal: MulChar.toUnitHom χ = MulChar.toUnitHom ψ ↔ χ = ψ

full_name: DirichletCharacter.eval_modulus_sub
code: lemma eval_modulus_sub (x : ZMod n) : χ (n - x) = χ (-x) 
goal: χ (↑n - x) = χ (-x)

full_name: DirichletCharacter.changeLevel
code: /-- A function that modifies the level of a Dirichlet character to some multiple
  of its original level. -/
noncomputable def changeLevel {n m : ℕ} (hm : n ∣ m) :
    DirichletCharacter R n →* DirichletCharacter R m 
goal: DirichletCharacter R n →* DirichletCharacter R m

full_name: DirichletCharacter.changeLevel_def
code: lemma changeLevel_def {m : ℕ} (hm : n ∣ m) :
    changeLevel hm χ = MulChar.ofUnitHom (χ.toUnitHom.comp (ZMod.unitsMap hm)) 
goal: (DirichletCharacter.changeLevel hm) χ = MulChar.ofUnitHom ((MulChar.toUnitHom χ).comp (ZMod.unitsMap hm))

full_name: DirichletCharacter.changeLevel_toUnitHom
code: lemma changeLevel_toUnitHom {m : ℕ} (hm : n ∣ m) :
    (changeLevel hm χ).toUnitHom = χ.toUnitHom.comp (ZMod.unitsMap hm) 
goal: MulChar.toUnitHom ((DirichletCharacter.changeLevel hm) χ) = (MulChar.toUnitHom χ).comp (ZMod.unitsMap hm)

full_name: DirichletCharacter.changeLevel_injective
code: /-- The `changeLevel` map is injective (except in the degenerate case `m = 0`). -/
lemma changeLevel_injective {m : ℕ} [NeZero m] (hm : n ∣ m) :
    Function.Injective (changeLevel (R := R) hm) 
goal: Function.Injective ⇑(DirichletCharacter.changeLevel hm)

full_name: DirichletCharacter.changeLevel_eq_one_iff
code: @[simp]
lemma changeLevel_eq_one_iff {m : ℕ} {χ : DirichletCharacter R n} (hm : n ∣ m) [NeZero m] :
    changeLevel hm χ = 1 ↔ χ = 1 
goal: (DirichletCharacter.changeLevel hm) χ = 1 ↔ χ = 1

full_name: DirichletCharacter.changeLevel_self
code: @[simp]
lemma changeLevel_self : changeLevel (dvd_refl n) χ = χ 
goal: (DirichletCharacter.changeLevel ⋯) χ = χ

full_name: DirichletCharacter.changeLevel_self_toUnitHom
code: lemma changeLevel_self_toUnitHom : (changeLevel (dvd_refl n) χ).toUnitHom = χ.toUnitHom 
goal: MulChar.toUnitHom ((DirichletCharacter.changeLevel ⋯) χ) = MulChar.toUnitHom χ

full_name: DirichletCharacter.changeLevel_trans
code: lemma changeLevel_trans {m d : ℕ} (hm : n ∣ m) (hd : m ∣ d) :
    changeLevel (dvd_trans hm hd) χ = changeLevel hd (changeLevel hm χ) 
goal: (DirichletCharacter.changeLevel ⋯) χ = (DirichletCharacter.changeLevel hd) ((DirichletCharacter.changeLevel hm) χ)

full_name: DirichletCharacter.changeLevel_eq_cast_of_dvd
code: lemma changeLevel_eq_cast_of_dvd {m : ℕ} (hm : n ∣ m) (a : Units (ZMod m)) :
    (changeLevel hm χ) a = χ (ZMod.cast (a : ZMod m)) 
goal: ((DirichletCharacter.changeLevel hm) χ) ↑a = χ (↑a).cast

full_name: DirichletCharacter.FactorsThrough
code: /-- `χ` of level `n` factors through a Dirichlet character `χ₀` of level `d` if `d ∣ n` and
`χ₀ = χ ∘ (ZMod n → ZMod d)`. -/
def FactorsThrough (d : ℕ) : Prop 
goal: Prop

full_name: DirichletCharacter.changeLevel_factorsThrough
code: lemma changeLevel_factorsThrough {m : ℕ} (hm : n ∣ m) : FactorsThrough (changeLevel hm χ) n 
goal: ((DirichletCharacter.changeLevel hm) χ).FactorsThrough n

full_name: DirichletCharacter.FactorsThrough.dvd
code: /-- The fact that `d` divides `n` when `χ` factors through a Dirichlet character at level `d` -/
lemma dvd {d : ℕ} (h : FactorsThrough χ d) : d ∣ n 
goal: d ∣ n

full_name: DirichletCharacter.FactorsThrough.χ₀
code: /-- The Dirichlet character at level `d` through which `χ` factors -/
noncomputable
def χ₀ {d : ℕ} (h : FactorsThrough χ d) : DirichletCharacter R d 
goal: DirichletCharacter R d

full_name: DirichletCharacter.FactorsThrough.eq_changeLevel
code: /-- The fact that `χ` factors through `χ₀` of level `d` -/
lemma eq_changeLevel {d : ℕ} (h : FactorsThrough χ d) : χ = changeLevel h.dvd h.χ₀ 
goal: χ = (DirichletCharacter.changeLevel ⋯) h.χ₀

full_name: DirichletCharacter.FactorsThrough.existsUnique
code: /-- The character of level `d` through which `χ` factors is uniquely determined. -/
lemma existsUnique {d : ℕ} [NeZero n] (h : FactorsThrough χ d) :
    ∃! χ' : DirichletCharacter R d, χ = changeLevel h.dvd χ' 
goal: ∃! χ', χ = (DirichletCharacter.changeLevel ⋯) χ'

full_name: DirichletCharacter.FactorsThrough.same_level
code: lemma same_level : FactorsThrough χ n 
goal: χ.FactorsThrough n

full_name: DirichletCharacter.factorsThrough_iff_ker_unitsMap
code: /-- A Dirichlet character `χ` factors through `d | n` iff its associated unit-group hom is trivial
on the kernel of `ZMod.unitsMap`. -/
lemma factorsThrough_iff_ker_unitsMap {d : ℕ} [NeZero n] (hd : d ∣ n) :
    FactorsThrough χ d ↔ (ZMod.unitsMap hd).ker ≤ χ.toUnitHom.ker 
goal: χ.FactorsThrough d ↔ (ZMod.unitsMap hd).ker ≤ (MulChar.toUnitHom χ).ker

full_name: DirichletCharacter.level_one
code: lemma level_one (χ : DirichletCharacter R 1) : χ = 1 
goal: χ = 1

full_name: DirichletCharacter.level_one'
code: lemma level_one' (hn : n = 1) : χ = 1 
goal: χ = 1

full_name: DirichletCharacter.instSubsingletonOfNatNat
code: instance : Subsingleton (DirichletCharacter R 1) 
goal: Subsingleton (DirichletCharacter R 1)

full_name: DirichletCharacter.instUniqueOfNatNat
code: noncomputable instance : Unique (DirichletCharacter R 1) 
goal: Unique (DirichletCharacter R 1)

full_name: DirichletCharacter.changeLevel_one
code: lemma changeLevel_one {d : ℕ} (h : d ∣ n) :
    changeLevel h (1 : DirichletCharacter R d) = 1 
goal: (DirichletCharacter.changeLevel h) 1 = 1

full_name: DirichletCharacter.factorsThrough_one_iff
code: lemma factorsThrough_one_iff : FactorsThrough χ 1 ↔ χ = 1 
goal: χ.FactorsThrough 1 ↔ χ = 1

full_name: DirichletCharacter.conductorSet
code: /-- The set of natural numbers `d` such that `χ` factors through a character of level `d`. -/
def conductorSet : Set ℕ 
goal: Set ℕ

full_name: DirichletCharacter.mem_conductorSet_iff
code: lemma mem_conductorSet_iff {x : ℕ} : x ∈ conductorSet χ ↔ FactorsThrough χ x 
goal: x ∈ χ.conductorSet ↔ χ.FactorsThrough x

full_name: DirichletCharacter.level_mem_conductorSet
code: lemma level_mem_conductorSet : n ∈ conductorSet χ 
goal: n ∈ χ.conductorSet

full_name: DirichletCharacter.mem_conductorSet_dvd
code: lemma mem_conductorSet_dvd {x : ℕ} (hx : x ∈ conductorSet χ) : x ∣ n 
goal: x ∣ n

full_name: DirichletCharacter.conductor
code: /-- The minimum natural number level `n` through which `χ` factors. -/
noncomputable def conductor : ℕ 
goal: ℕ

full_name: DirichletCharacter.conductor_mem_conductorSet
code: lemma conductor_mem_conductorSet : conductor χ ∈ conductorSet χ 
goal: χ.conductor ∈ χ.conductorSet

full_name: DirichletCharacter.conductor_dvd_level
code: lemma conductor_dvd_level : conductor χ ∣ n 
goal: χ.conductor ∣ n

full_name: DirichletCharacter.factorsThrough_conductor
code: lemma factorsThrough_conductor : FactorsThrough χ (conductor χ) 
goal: χ.FactorsThrough χ.conductor

full_name: DirichletCharacter.conductor_ne_zero
code: lemma conductor_ne_zero (hn : n ≠ 0) : conductor χ ≠ 0 
goal: χ.conductor ≠ 0

full_name: DirichletCharacter.conductor_one
code: /-- The conductor of the trivial character is 1. -/
lemma conductor_one (hn : n ≠ 0) : conductor (1 : DirichletCharacter R n) = 1 
goal: DirichletCharacter.conductor 1 = 1

full_name: DirichletCharacter.eq_one_iff_conductor_eq_one
code: lemma eq_one_iff_conductor_eq_one (hn : n ≠ 0) : χ = 1 ↔ conductor χ = 1 
goal: χ = 1 ↔ χ.conductor = 1

full_name: DirichletCharacter.conductor_eq_zero_iff_level_eq_zero
code: lemma conductor_eq_zero_iff_level_eq_zero : conductor χ = 0 ↔ n = 0 
goal: χ.conductor = 0 ↔ n = 0

full_name: DirichletCharacter.conductor_le_conductor_mem_conductorSet
code: lemma conductor_le_conductor_mem_conductorSet {d : ℕ} (hd : d ∈ conductorSet χ) :
    χ.conductor ≤ (Classical.choose hd.2).conductor 
goal: χ.conductor ≤ (Classical.choose ⋯).conductor

full_name: DirichletCharacter.IsPrimitive
code: /-- A character is primitive if its level is equal to its conductor. -/
def IsPrimitive : Prop 
goal: Prop

full_name: DirichletCharacter.isPrimitive_def
code: lemma isPrimitive_def : IsPrimitive χ ↔ conductor χ = n 
goal: χ.IsPrimitive ↔ χ.conductor = n

full_name: DirichletCharacter.isPrimitive_one_level_one
code: lemma isPrimitive_one_level_one : IsPrimitive (1 : DirichletCharacter R 1) 
goal: DirichletCharacter.IsPrimitive 1

full_name: DirichletCharacter.isPritive_one_level_zero
code: lemma isPritive_one_level_zero : IsPrimitive (1 : DirichletCharacter R 0) 
goal: DirichletCharacter.IsPrimitive 1

full_name: DirichletCharacter.conductor_one_dvd
code: lemma conductor_one_dvd (n : ℕ) : conductor (1 : DirichletCharacter R 1) ∣ n 
goal: DirichletCharacter.conductor 1 ∣ n

full_name: DirichletCharacter.primitiveCharacter
code: /-- The primitive character associated to a Dirichlet character. -/
noncomputable def primitiveCharacter : DirichletCharacter R χ.conductor 
goal: DirichletCharacter R χ.conductor

full_name: DirichletCharacter.primitiveCharacter_isPrimitive
code: lemma primitiveCharacter_isPrimitive : IsPrimitive (χ.primitiveCharacter) 
goal: χ.primitiveCharacter.IsPrimitive

full_name: DirichletCharacter.primitiveCharacter_one
code: lemma primitiveCharacter_one (hn : n ≠ 0) :
    (1 : DirichletCharacter R n).primitiveCharacter = 1 
goal: DirichletCharacter.primitiveCharacter 1 = 1

full_name: DirichletCharacter.mul
code: /-- Dirichlet character associated to multiplication of Dirichlet characters,
after changing both levels to the same -/
noncomputable def mul {m : ℕ} (χ₁ : DirichletCharacter R n) (χ₂ : DirichletCharacter R m) :
    DirichletCharacter R (Nat.lcm n m) 
goal: DirichletCharacter R (n.lcm m)

full_name: DirichletCharacter.primitive_mul
code: /-- Primitive character associated to multiplication of Dirichlet characters,
after changing both levels to the same -/
noncomputable def primitive_mul {m : ℕ} (χ₁ : DirichletCharacter R n)
    (χ₂ : DirichletCharacter R m) : DirichletCharacter R (mul χ₁ χ₂).conductor 
goal: DirichletCharacter R (χ₁.mul χ₂).conductor

full_name: DirichletCharacter.mul_def
code: lemma mul_def {n m : ℕ} {χ : DirichletCharacter R n} {ψ : DirichletCharacter R m} :
    χ.primitive_mul ψ = primitiveCharacter (mul χ ψ) 
goal: χ.primitive_mul ψ = (χ.mul ψ).primitiveCharacter

full_name: DirichletCharacter.primitive_mul_isPrimitive
code: lemma primitive_mul_isPrimitive {m : ℕ} (ψ : DirichletCharacter R m) :
    IsPrimitive (primitive_mul χ ψ) 
goal: (χ.primitive_mul ψ).IsPrimitive

full_name: DirichletCharacter.Odd
code: /-- A Dirichlet character is odd if its value at -1 is -1. -/
def Odd : Prop 
goal: Prop

full_name: DirichletCharacter.Even
code: /-- A Dirichlet character is even if its value at -1 is 1. -/
def Even : Prop 
goal: Prop

full_name: DirichletCharacter.even_or_odd
code: lemma even_or_odd [NoZeroDivisors S] : ψ.Even ∨ ψ.Odd 
goal: ψ.Even ∨ ψ.Odd

full_name: DirichletCharacter.Odd.toUnitHom_eval_neg_one
code: lemma Odd.toUnitHom_eval_neg_one (hψ : ψ.Odd) : ψ.toUnitHom (-1) = -1 
goal: (MulChar.toUnitHom ψ) (-1) = -1

full_name: DirichletCharacter.Even.toUnitHom_eval_neg_one
code: lemma Even.toUnitHom_eval_neg_one (hψ : ψ.Even) : ψ.toUnitHom (-1) = 1 
goal: (MulChar.toUnitHom ψ) (-1) = 1

full_name: DirichletCharacter.Odd.eval_neg
code: lemma Odd.eval_neg (x : ZMod m) (hψ : ψ.Odd) : ψ (- x) = - ψ x 
goal: ψ (-x) = -ψ x

full_name: DirichletCharacter.Even.eval_neg
code: lemma Even.eval_neg (x : ZMod m) (hψ : ψ.Even) : ψ (- x) = ψ x 
goal: ψ (-x) = ψ x