# mathlib3documentation

number_theory.legendre_symbol.zmod_char

# Quadratic characters on ℤ/nℤ #

THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.

This file defines some quadratic characters on the rings ℤ/4ℤ and ℤ/8ℤ.

We set them up to be of type mul_char (zmod n) ℤ, where n is 4 or 8.

## Tags #

### Quadratic characters mod 4 and 8 #

We define the primitive quadratic characters χ₄on zmod 4 and χ₈, χ₈' on zmod 8.

def zmod.χ₄  :

Define the nontrivial quadratic character on zmod 4, χ₄. It corresponds to the extension ℚ(√-1)/ℚ.

Equations
@[simp]
= ![0, 1, 0, -1]

χ₄ takes values in {0, 1, -1}

The value of χ₄ n, for n : ℕ, depends only on n % 4.

The value of χ₄ n, for n : ℤ, depends only on n % 4.

theorem zmod.χ₄_int_eq_if_mod_four (n : ) :
= ite (n % 2 = 0) 0 (ite (n % 4 = 1) 1 (-1))

An explicit description of χ₄ on integers / naturals

theorem zmod.χ₄_nat_eq_if_mod_four (n : ) :
= ite (n % 2 = 0) 0 (ite (n % 4 = 1) 1 (-1))
theorem zmod.χ₄_eq_neg_one_pow {n : } (hn : n % 2 = 1) :
= (-1) ^ (n / 2)

Alternative description of χ₄ n for odd n : ℕ in terms of powers of -1

theorem zmod.χ₄_nat_one_mod_four {n : } (hn : n % 4 = 1) :
= 1

If n % 4 = 1, then χ₄ n = 1.

theorem zmod.χ₄_nat_three_mod_four {n : } (hn : n % 4 = 3) :
= -1

If n % 4 = 3, then χ₄ n = -1.

theorem zmod.χ₄_int_one_mod_four {n : } (hn : n % 4 = 1) :
= 1

If n % 4 = 1, then χ₄ n = 1.

theorem zmod.χ₄_int_three_mod_four {n : } (hn : n % 4 = 3) :
= -1

If n % 4 = 3, then χ₄ n = -1.

theorem neg_one_pow_div_two_of_one_mod_four {n : } (hn : n % 4 = 1) :
(-1) ^ (n / 2) = 1

If n % 4 = 1, then (-1)^(n/2) = 1.

theorem neg_one_pow_div_two_of_three_mod_four {n : } (hn : n % 4 = 3) :
(-1) ^ (n / 2) = -1

If n % 4 = 3, then (-1)^(n/2) = -1.

def zmod.χ₈  :

Define the first primitive quadratic character on zmod 8, χ₈. It corresponds to the extension ℚ(√2)/ℚ.

Equations
@[simp]
= ![0, 1, 0, -1, 0, -1, 0, 1]

χ₈ takes values in {0, 1, -1}

The value of χ₈ n, for n : ℕ, depends only on n % 8.

The value of χ₈ n, for n : ℤ, depends only on n % 8.

theorem zmod.χ₈_int_eq_if_mod_eight (n : ) :
= ite (n % 2 = 0) 0 (ite (n % 8 = 1 n % 8 = 7) 1 (-1))

An explicit description of χ₈ on integers / naturals

theorem zmod.χ₈_nat_eq_if_mod_eight (n : ) :
= ite (n % 2 = 0) 0 (ite (n % 8 = 1 n % 8 = 7) 1 (-1))
@[simp]
= ![0, 1, 0, 1, 0, -1, 0, -1]

Define the second primitive quadratic character on zmod 8, χ₈'. It corresponds to the extension ℚ(√-2)/ℚ.

Equations

χ₈' takes values in {0, 1, -1}

theorem zmod.χ₈'_int_eq_if_mod_eight (n : ) :
= ite (n % 2 = 0) 0 (ite (n % 8 = 1 n % 8 = 3) 1 (-1))

An explicit description of χ₈' on integers / naturals

theorem zmod.χ₈'_nat_eq_if_mod_eight (n : ) :
= ite (n % 2 = 0) 0 (ite (n % 8 = 1 n % 8 = 3) 1 (-1))

The relation between χ₄, χ₈ and χ₈'