Theorem: FiniteField.sum_pow_units
File: Mathlib/FieldTheory/Finite/Basic.lean

tactic: let φ : Kˣ →* K :=
  { toFun := fun x => x ^ i
    map_one' := by simp
    map_mul' := by intros ; simp [mul_pow] }
state_before: K : Type u_1
R : Type ?u.484011
inst✝² : Field K
inst✝¹ : Fintype K
inst✝ : Fintype Kˣ
i : ℕ
⊢ ∑ x : Kˣ, ↑(x ^ i) = if q - 1 ∣ i then -1 else 0

tactic: have : Decidable (φ = 1) := by classical infer_instance
state_before: K : Type u_1
R : Type ?u.484011
inst✝² : Field K
inst✝¹ : Fintype K
inst✝ : Fintype Kˣ
i : ℕ
φ : Kˣ →* K :=
  { toOneHom := { toFun := fun x => ↑(x ^ i), map_one' := (_ : ↑(1 ^ i) = 1) },
    map_mul' := (_ : ∀ (x y : Kˣ), ↑((x * y) ^ i) = ↑(x ^ i) * ↑(y ^ i)) }
⊢ ∑ x : Kˣ, ↑(x ^ i) = if q - 1 ∣ i then -1 else 0

tactic: simp
state_before: K : Type u_1
R : Type ?u.484011
inst✝² : Field K
inst✝¹ : Fintype K
inst✝ : Fintype Kˣ
i : ℕ
⊢ (fun x => ↑(x ^ i)) 1 = 1

tactic: intros
state_before: K : Type u_1
R : Type ?u.484011
inst✝² : Field K
inst✝¹ : Fintype K
inst✝ : Fintype Kˣ
i : ℕ
⊢ ∀ (x y : Kˣ),
    OneHom.toFun { toFun := fun x => ↑(x ^ i), map_one' := (_ : ↑(1 ^ i) = 1) } (x * y) =
      OneHom.toFun { toFun := fun x => ↑(x ^ i), map_one' := (_ : ↑(1 ^ i) = 1) } x *
        OneHom.toFun { toFun := fun x => ↑(x ^ i), map_one' := (_ : ↑(1 ^ i) = 1) } y

tactic: simp [mul_pow]
state_before: K : Type u_1
R : Type ?u.484011
inst✝² : Field K
inst✝¹ : Fintype K
inst✝ : Fintype Kˣ
i : ℕ
x✝ y✝ : Kˣ
⊢ OneHom.toFun { toFun := fun x => ↑(x ^ i), map_one' := (_ : ↑(1 ^ i) = 1) } (x✝ * y✝) =
    OneHom.toFun { toFun := fun x => ↑(x ^ i), map_one' := (_ : ↑(1 ^ i) = 1) } x✝ *
      OneHom.toFun { toFun := fun x => ↑(x ^ i), map_one' := (_ : ↑(1 ^ i) = 1) } y✝

tactic: classical infer_instance
state_before: K : Type u_1
R : Type ?u.484011
inst✝² : Field K
inst✝¹ : Fintype K
inst✝ : Fintype Kˣ
i : ℕ
φ : Kˣ →* K :=
  { toOneHom := { toFun := fun x => ↑(x ^ i), map_one' := (_ : ↑(1 ^ i) = 1) },
    map_mul' := (_ : ∀ (x y : Kˣ), ↑((x * y) ^ i) = ↑(x ^ i) * ↑(y ^ i)) }
⊢ Decidable (φ = 1)

tactic: infer_instance
state_before: K : Type u_1
R : Type ?u.484011
inst✝² : Field K
inst✝¹ : Fintype K
inst✝ : Fintype Kˣ
i : ℕ
φ : Kˣ →* K :=
  { toOneHom := { toFun := fun x => ↑(x ^ i), map_one' := (_ : ↑(1 ^ i) = 1) },
    map_mul' := (_ : ∀ (x y : Kˣ), ↑((x * y) ^ i) = ↑(x ^ i) * ↑(y ^ i)) }
⊢ Decidable (φ = 1)

tactic: rw [← forall_pow_eq_one_iff, FunLike.ext_iff]
state_before: K : Type u_1
R : Type ?u.484011
inst✝² : Field K
inst✝¹ : Fintype K
inst✝ : Fintype Kˣ
i : ℕ
φ : Kˣ →* K :=
  { toOneHom := { toFun := fun x => ↑(x ^ i), map_one' := (_ : ↑(1 ^ i) = 1) },
    map_mul' := (_ : ∀ (x y : Kˣ), ↑((x * y) ^ i) = ↑(x ^ i) * ↑(y ^ i)) }
this : Decidable (φ = 1)
⊢ q - 1 ∣ i ↔ φ = 1

tactic: apply forall_congr'
state_before: K : Type u_1
R : Type ?u.484011
inst✝² : Field K
inst✝¹ : Fintype K
inst✝ : Fintype Kˣ
i : ℕ
φ : Kˣ →* K :=
  { toOneHom := { toFun := fun x => ↑(x ^ i), map_one' := (_ : ↑(1 ^ i) = 1) },
    map_mul' := (_ : ∀ (x y : Kˣ), ↑((x * y) ^ i) = ↑(x ^ i) * ↑(y ^ i)) }
this : Decidable (φ = 1)
⊢ (∀ (x : Kˣ), x ^ i = 1) ↔ ∀ (x : Kˣ), ↑φ x = ↑1 x

tactic: intro x
state_before: case h
K : Type u_1
R : Type ?u.484011
inst✝² : Field K
inst✝¹ : Fintype K
inst✝ : Fintype Kˣ
i : ℕ
φ : Kˣ →* K :=
  { toOneHom := { toFun := fun x => ↑(x ^ i), map_one' := (_ : ↑(1 ^ i) = 1) },
    map_mul' := (_ : ∀ (x y : Kˣ), ↑((x * y) ^ i) = ↑(x ^ i) * ↑(y ^ i)) }
this : Decidable (φ = 1)
⊢ ∀ (a : Kˣ), a ^ i = 1 ↔ ↑φ a = ↑1 a

tactic: simp [Units.ext_iff]
state_before: case h
K : Type u_1
R : Type ?u.484011
inst✝² : Field K
inst✝¹ : Fintype K
inst✝ : Fintype Kˣ
i : ℕ
φ : Kˣ →* K :=
  { toOneHom := { toFun := fun x => ↑(x ^ i), map_one' := (_ : ↑(1 ^ i) = 1) },
    map_mul' := (_ : ∀ (x y : Kˣ), ↑((x * y) ^ i) = ↑(x ^ i) * ↑(y ^ i)) }
this : Decidable (φ = 1)
x : Kˣ
⊢ x ^ i = 1 ↔ ↑φ x = ↑1 x

tactic: simp only [this]
state_before: K : Type u_1
R : Type ?u.484011
inst✝² : Field K
inst✝¹ : Fintype K
inst✝ : Fintype Kˣ
i : ℕ
φ : Kˣ →* K :=
  { toOneHom := { toFun := fun x => ↑(x ^ i), map_one' := (_ : ↑(1 ^ i) = 1) },
    map_mul' := (_ : ∀ (x y : Kˣ), ↑((x * y) ^ i) = ↑(x ^ i) * ↑(y ^ i)) }
this✝ : Decidable (φ = 1)
this : q - 1 ∣ i ↔ φ = 1
⊢ ↑(if φ = 1 then Fintype.card Kˣ else 0) = if q - 1 ∣ i then -1 else 0

tactic: split_ifs
state_before: K : Type u_1
R : Type ?u.484011
inst✝² : Field K
inst✝¹ : Fintype K
inst✝ : Fintype Kˣ
i : ℕ
φ : Kˣ →* K :=
  { toOneHom := { toFun := fun x => ↑(x ^ i), map_one' := (_ : ↑(1 ^ i) = 1) },
    map_mul' := (_ : ∀ (x y : Kˣ), ↑((x * y) ^ i) = ↑(x ^ i) * ↑(y ^ i)) }
this✝ : Decidable (φ = 1)
this : q - 1 ∣ i ↔ φ = 1
⊢ ↑(if
          { toOneHom := { toFun := fun x => ↑(x ^ i), map_one' := (_ : ↑(1 ^ i) = 1) },
              map_mul' := (_ : ∀ (x y : Kˣ), ↑((x * y) ^ i) = ↑(x ^ i) * ↑(y ^ i)) } =
            1 then
        Fintype.card Kˣ
      else 0) =
    if
        { toOneHom := { toFun := fun x => ↑(x ^ i), map_one' := (_ : ↑(1 ^ i) = 1) },
            map_mul' := (_ : ∀ (x y : Kˣ), ↑((x * y) ^ i) = ↑(x ^ i) * ↑(y ^ i)) } =
          1 then
      -1
    else 0

tactic: swap
state_before: case inl
K : Type u_1
R : Type ?u.484011
inst✝² : Field K
inst✝¹ : Fintype K
inst✝ : Fintype Kˣ
i : ℕ
φ : Kˣ →* K :=
  { toOneHom := { toFun := fun x => ↑(x ^ i), map_one' := (_ : ↑(1 ^ i) = 1) },
    map_mul' := (_ : ∀ (x y : Kˣ), ↑((x * y) ^ i) = ↑(x ^ i) * ↑(y ^ i)) }
this✝ : Decidable (φ = 1)
this : q - 1 ∣ i ↔ φ = 1
h✝ :
  { toOneHom := { toFun := fun x => ↑(x ^ i), map_one' := (_ : ↑(1 ^ i) = 1) },
      map_mul' := (_ : ∀ (x y : Kˣ), ↑((x * y) ^ i) = ↑(x ^ i) * ↑(y ^ i)) } =
    1
⊢ ↑(Fintype.card Kˣ) = -1

case inr
K : Type u_1
R : Type ?u.484011
inst✝² : Field K
inst✝¹ : Fintype K
inst✝ : Fintype Kˣ
i : ℕ
φ : Kˣ →* K :=
  { toOneHom := { toFun := fun x => ↑(x ^ i), map_one' := (_ : ↑(1 ^ i) = 1) },
    map_mul' := (_ : ∀ (x y : Kˣ), ↑((x * y) ^ i) = ↑(x ^ i) * ↑(y ^ i)) }
this✝ : Decidable (φ = 1)
this : q - 1 ∣ i ↔ φ = 1
h✝ :
  ¬{ toOneHom := { toFun := fun x => ↑(x ^ i), map_one' := (_ : ↑(1 ^ i) = 1) },
        map_mul' := (_ : ∀ (x y : Kˣ), ↑((x * y) ^ i) = ↑(x ^ i) * ↑(y ^ i)) } =
      1
⊢ ↑0 = 0

tactic: exact Nat.cast_zero
state_before: case inr
K : Type u_1
R : Type ?u.484011
inst✝² : Field K
inst✝¹ : Fintype K
inst✝ : Fintype Kˣ
i : ℕ
φ : Kˣ →* K :=
  { toOneHom := { toFun := fun x => ↑(x ^ i), map_one' := (_ : ↑(1 ^ i) = 1) },
    map_mul' := (_ : ∀ (x y : Kˣ), ↑((x * y) ^ i) = ↑(x ^ i) * ↑(y ^ i)) }
this✝ : Decidable (φ = 1)
this : q - 1 ∣ i ↔ φ = 1
h✝ :
  ¬{ toOneHom := { toFun := fun x => ↑(x ^ i), map_one' := (_ : ↑(1 ^ i) = 1) },
        map_mul' := (_ : ∀ (x y : Kˣ), ↑((x * y) ^ i) = ↑(x ^ i) * ↑(y ^ i)) } =
      1
⊢ ↑0 = 0

tactic: rw [Fintype.card_units, Nat.cast_sub,
  cast_card_eq_zero, Nat.cast_one, zero_sub]
state_before: case inl
K : Type u_1
R : Type ?u.484011
inst✝² : Field K
inst✝¹ : Fintype K
inst✝ : Fintype Kˣ
i : ℕ
φ : Kˣ →* K :=
  { toOneHom := { toFun := fun x => ↑(x ^ i), map_one' := (_ : ↑(1 ^ i) = 1) },
    map_mul' := (_ : ∀ (x y : Kˣ), ↑((x * y) ^ i) = ↑(x ^ i) * ↑(y ^ i)) }
this✝ : Decidable (φ = 1)
this : q - 1 ∣ i ↔ φ = 1
h✝ :
  { toOneHom := { toFun := fun x => ↑(x ^ i), map_one' := (_ : ↑(1 ^ i) = 1) },
      map_mul' := (_ : ∀ (x y : Kˣ), ↑((x * y) ^ i) = ↑(x ^ i) * ↑(y ^ i)) } =
    1
⊢ ↑(Fintype.card Kˣ) = -1

tactic: show 1 ≤ q
state_before: case inl
K : Type u_1
R : Type ?u.484011
inst✝² : Field K
inst✝¹ : Fintype K
inst✝ : Fintype Kˣ
i : ℕ
φ : Kˣ →* K :=
  { toOneHom := { toFun := fun x => ↑(x ^ i), map_one' := (_ : ↑(1 ^ i) = 1) },
    map_mul' := (_ : ∀ (x y : Kˣ), ↑((x * y) ^ i) = ↑(x ^ i) * ↑(y ^ i)) }
this✝ : Decidable (φ = 1)
this : q - 1 ∣ i ↔ φ = 1
h✝ :
  { toOneHom := { toFun := fun x => ↑(x ^ i), map_one' := (_ : ↑(1 ^ i) = 1) },
      map_mul' := (_ : ∀ (x y : Kˣ), ↑((x * y) ^ i) = ↑(x ^ i) * ↑(y ^ i)) } =
    1
⊢ 1 ≤ q

tactic: exact Fintype.card_pos_iff.mpr ⟨0⟩
state_before: case inl
K : Type u_1
R : Type ?u.484011
inst✝² : Field K
inst✝¹ : Fintype K
inst✝ : Fintype Kˣ
i : ℕ
φ : Kˣ →* K :=
  { toOneHom := { toFun := fun x => ↑(x ^ i), map_one' := (_ : ↑(1 ^ i) = 1) },
    map_mul' := (_ : ∀ (x y : Kˣ), ↑((x * y) ^ i) = ↑(x ^ i) * ↑(y ^ i)) }
this✝ : Decidable (φ = 1)
this : q - 1 ∣ i ↔ φ = 1
h✝ :
  { toOneHom := { toFun := fun x => ↑(x ^ i), map_one' := (_ : ↑(1 ^ i) = 1) },
      map_mul' := (_ : ∀ (x y : Kˣ), ↑((x * y) ^ i) = ↑(x ^ i) * ↑(y ^ i)) } =
    1
⊢ 1 ≤ q