Theorem: MvPolynomial.sum_eval_eq_zero
File: Mathlib/FieldTheory/ChevalleyWarning.lean

tactic: haveI : DecidableEq K := Classical.decEq K
state_before: K : Type u_2
σ : Type u_1
ι : Type ?u.9599
inst✝³ : Fintype K
inst✝² : Field K
inst✝¹ : Fintype σ
inst✝ : DecidableEq σ
f : MvPolynomial σ K
h : totalDegree f < (q - 1) * Fintype.card σ
⊢ ∑ x : σ → K, ↑(eval x) f = 0

tactic: calc
  (∑ x, eval x f) = ∑ x : σ → K, ∑ d in f.support, f.coeff d * ∏ i, x i ^ d i := by
    simp only [eval_eq']
  _ = ∑ d in f.support, ∑ x : σ → K, f.coeff d * ∏ i, x i ^ d i := sum_comm
  _ = 0 := sum_eq_zero ?_
state_before: K : Type u_2
σ : Type u_1
ι : Type ?u.9599
inst✝³ : Fintype K
inst✝² : Field K
inst✝¹ : Fintype σ
inst✝ : DecidableEq σ
f : MvPolynomial σ K
h : totalDegree f < (q - 1) * Fintype.card σ
this : DecidableEq K
⊢ ∑ x : σ → K, ↑(eval x) f = 0

tactic: intro d hd
state_before: K : Type u_2
σ : Type u_1
ι : Type ?u.9599
inst✝³ : Fintype K
inst✝² : Field K
inst✝¹ : Fintype σ
inst✝ : DecidableEq σ
f : MvPolynomial σ K
h : totalDegree f < (q - 1) * Fintype.card σ
this : DecidableEq K
⊢ ∀ (x : σ →₀ ℕ), x ∈ support f → ∑ x_1 : σ → K, coeff x f * ∏ i : σ, x_1 i ^ ↑x i = 0

tactic: obtain ⟨i, hi⟩ : ∃ i, d i < q - 1
state_before: K : Type u_2
σ : Type u_1
ι : Type ?u.9599
inst✝³ : Fintype K
inst✝² : Field K
inst✝¹ : Fintype σ
inst✝ : DecidableEq σ
f : MvPolynomial σ K
h : totalDegree f < (q - 1) * Fintype.card σ
this : DecidableEq K
d : σ →₀ ℕ
hd : d ∈ support f
⊢ ∑ x : σ → K, coeff d f * ∏ i : σ, x i ^ ↑d i = 0

tactic: exact f.exists_degree_lt (q - 1) h hd
state_before: K : Type u_2
σ : Type u_1
ι : Type ?u.9599
inst✝³ : Fintype K
inst✝² : Field K
inst✝¹ : Fintype σ
inst✝ : DecidableEq σ
f : MvPolynomial σ K
h : totalDegree f < (q - 1) * Fintype.card σ
this : DecidableEq K
d : σ →₀ ℕ
hd : d ∈ support f
⊢ ∃ i, ↑d i < q - 1

case intro
K : Type u_2
σ : Type u_1
ι : Type ?u.9599
inst✝³ : Fintype K
inst✝² : Field K
inst✝¹ : Fintype σ
inst✝ : DecidableEq σ
f : MvPolynomial σ K
h : totalDegree f < (q - 1) * Fintype.card σ
this : DecidableEq K
d : σ →₀ ℕ
hd : d ∈ support f
i : σ
hi : ↑d i < q - 1
⊢ ∑ x : σ → K, coeff d f * ∏ i : σ, x i ^ ↑d i = 0

tactic: calc
  (∑ x : σ → K, f.coeff d * ∏ i, x i ^ d i) = f.coeff d * ∑ x : σ → K, ∏ i, x i ^ d i :=
    mul_sum.symm
  _ = 0 := (mul_eq_zero.mpr ∘ Or.inr) ?_
state_before: case intro
K : Type u_2
σ : Type u_1
ι : Type ?u.9599
inst✝³ : Fintype K
inst✝² : Field K
inst✝¹ : Fintype σ
inst✝ : DecidableEq σ
f : MvPolynomial σ K
h : totalDegree f < (q - 1) * Fintype.card σ
this : DecidableEq K
d : σ →₀ ℕ
hd : d ∈ support f
i : σ
hi : ↑d i < q - 1
⊢ ∑ x : σ → K, coeff d f * ∏ i : σ, x i ^ ↑d i = 0

tactic: calc
  (∑ x : σ → K, ∏ i, x i ^ d i) =
      ∑ x₀ : { j // j ≠ i } → K, ∑ x : { x : σ → K // x ∘ (↑) = x₀ }, ∏ j, (x : σ → K) j ^ d j :=
    (Fintype.sum_fiberwise _ _).symm
  _ = 0 := Fintype.sum_eq_zero _ ?_
state_before: case intro
K : Type u_2
σ : Type u_1
ι : Type ?u.9599
inst✝³ : Fintype K
inst✝² : Field K
inst✝¹ : Fintype σ
inst✝ : DecidableEq σ
f : MvPolynomial σ K
h : totalDegree f < (q - 1) * Fintype.card σ
this : DecidableEq K
d : σ →₀ ℕ
hd : d ∈ support f
i : σ
hi : ↑d i < q - 1
⊢ ∑ x : σ → K, ∏ i : σ, x i ^ ↑d i = 0

tactic: intro x₀
state_before: case intro
K : Type u_2
σ : Type u_1
ι : Type ?u.9599
inst✝³ : Fintype K
inst✝² : Field K
inst✝¹ : Fintype σ
inst✝ : DecidableEq σ
f : MvPolynomial σ K
h : totalDegree f < (q - 1) * Fintype.card σ
this : DecidableEq K
d : σ →₀ ℕ
hd : d ∈ support f
i : σ
hi : ↑d i < q - 1
⊢ ∀ (a : { j // j ≠ i } → K), ∑ x : { x // x ∘ Subtype.val = a }, ∏ j : σ, ↑x j ^ ↑d j = 0

tactic: let e : K ≃ { x // x ∘ ((↑) : _ → σ) = x₀ } := (Equiv.subtypeEquivCodomain _).symm
state_before: case intro
K : Type u_2
σ : Type u_1
ι : Type ?u.9599
inst✝³ : Fintype K
inst✝² : Field K
inst✝¹ : Fintype σ
inst✝ : DecidableEq σ
f : MvPolynomial σ K
h : totalDegree f < (q - 1) * Fintype.card σ
this : DecidableEq K
d : σ →₀ ℕ
hd : d ∈ support f
i : σ
hi : ↑d i < q - 1
x₀ : { j // j ≠ i } → K
⊢ ∑ x : { x // x ∘ Subtype.val = x₀ }, ∏ j : σ, ↑x j ^ ↑d j = 0

tactic: calc
  (∑ x : { x : σ → K // x ∘ (↑) = x₀ }, ∏ j, (x : σ → K) j ^ d j) =
      ∑ a : K, ∏ j : σ, (e a : σ → K) j ^ d j := (e.sum_comp _).symm
  _ = ∑ a : K, (∏ j, x₀ j ^ d j) * a ^ d i := (Fintype.sum_congr _ _ ?_)
  _ = (∏ j, x₀ j ^ d j) * ∑ a : K, a ^ d i := by rw [mul_sum]
  _ = 0 := by rw [sum_pow_lt_card_sub_one K _ hi, MulZeroClass.mul_zero]
state_before: case intro
K : Type u_2
σ : Type u_1
ι : Type ?u.9599
inst✝³ : Fintype K
inst✝² : Field K
inst✝¹ : Fintype σ
inst✝ : DecidableEq σ
f : MvPolynomial σ K
h : totalDegree f < (q - 1) * Fintype.card σ
this : DecidableEq K
d : σ →₀ ℕ
hd : d ∈ support f
i : σ
hi : ↑d i < q - 1
x₀ : { j // j ≠ i } → K
e : K ≃ { x // x ∘ Subtype.val = x₀ } := (Equiv.subtypeEquivCodomain x₀).symm
⊢ ∑ x : { x // x ∘ Subtype.val = x₀ }, ∏ j : σ, ↑x j ^ ↑d j = 0

tactic: intro a
state_before: case intro
K : Type u_2
σ : Type u_1
ι : Type ?u.9599
inst✝³ : Fintype K
inst✝² : Field K
inst✝¹ : Fintype σ
inst✝ : DecidableEq σ
f : MvPolynomial σ K
h : totalDegree f < (q - 1) * Fintype.card σ
this : DecidableEq K
d : σ →₀ ℕ
hd : d ∈ support f
i : σ
hi : ↑d i < q - 1
x₀ : { j // j ≠ i } → K
e : K ≃ { x // x ∘ Subtype.val = x₀ } := (Equiv.subtypeEquivCodomain x₀).symm
⊢ ∀ (a : K), ∏ j : σ, ↑(↑e a) j ^ ↑d j = (∏ j : { j // j ≠ i }, x₀ j ^ ↑d ↑j) * a ^ ↑d i

tactic: let e' : Sum { j // j = i } { j // j ≠ i } ≃ σ := Equiv.sumCompl _
state_before: case intro
K : Type u_2
σ : Type u_1
ι : Type ?u.9599
inst✝³ : Fintype K
inst✝² : Field K
inst✝¹ : Fintype σ
inst✝ : DecidableEq σ
f : MvPolynomial σ K
h : totalDegree f < (q - 1) * Fintype.card σ
this : DecidableEq K
d : σ →₀ ℕ
hd : d ∈ support f
i : σ
hi : ↑d i < q - 1
x₀ : { j // j ≠ i } → K
e : K ≃ { x // x ∘ Subtype.val = x₀ } := (Equiv.subtypeEquivCodomain x₀).symm
a : K
⊢ ∏ j : σ, ↑(↑e a) j ^ ↑d j = (∏ j : { j // j ≠ i }, x₀ j ^ ↑d ↑j) * a ^ ↑d i

tactic: letI : Unique { j // j = i } :=
  { default := ⟨i, rfl⟩
    uniq := fun ⟨j, h⟩ => Subtype.val_injective h }
state_before: case intro
K : Type u_2
σ : Type u_1
ι : Type ?u.9599
inst✝³ : Fintype K
inst✝² : Field K
inst✝¹ : Fintype σ
inst✝ : DecidableEq σ
f : MvPolynomial σ K
h : totalDegree f < (q - 1) * Fintype.card σ
this : DecidableEq K
d : σ →₀ ℕ
hd : d ∈ support f
i : σ
hi : ↑d i < q - 1
x₀ : { j // j ≠ i } → K
e : K ≃ { x // x ∘ Subtype.val = x₀ } := (Equiv.subtypeEquivCodomain x₀).symm
a : K
e' : { j // j = i } ⊕ { j // j ≠ i } ≃ σ := Equiv.sumCompl fun j => j = i
⊢ ∏ j : σ, ↑(↑e a) j ^ ↑d j = (∏ j : { j // j ≠ i }, x₀ j ^ ↑d ↑j) * a ^ ↑d i

tactic: calc
  (∏ j : σ, (e a : σ → K) j ^ d j) =
      (e a : σ → K) i ^ d i * ∏ j : { j // j ≠ i }, (e a : σ → K) j ^ d j :=
    by rw [← e'.prod_comp, Fintype.prod_sum_type, univ_unique, prod_singleton]; rfl
  _ = a ^ d i * ∏ j : { j // j ≠ i }, (e a : σ → K) j ^ d j := by
    rw [Equiv.subtypeEquivCodomain_symm_apply_eq]
  _ = a ^ d i * ∏ j, x₀ j ^ d j := (congr_arg _ (Fintype.prod_congr _ _ ?_))
  _ = (∏ j, x₀ j ^ d j) * a ^ d i := mul_comm _ _
state_before: case intro
K : Type u_2
σ : Type u_1
ι : Type ?u.9599
inst✝³ : Fintype K
inst✝² : Field K
inst✝¹ : Fintype σ
inst✝ : DecidableEq σ
f : MvPolynomial σ K
h : totalDegree f < (q - 1) * Fintype.card σ
this✝ : DecidableEq K
d : σ →₀ ℕ
hd : d ∈ support f
i : σ
hi : ↑d i < q - 1
x₀ : { j // j ≠ i } → K
e : K ≃ { x // x ∘ Subtype.val = x₀ } := (Equiv.subtypeEquivCodomain x₀).symm
a : K
e' : { j // j = i } ⊕ { j // j ≠ i } ≃ σ := Equiv.sumCompl fun j => j = i
this : Unique { j // j = i } :=
  { toInhabited := { default := { val := i, property := (_ : i = i) } },
    uniq := (_ : ∀ (x : { j // j = i }), x = default) }
⊢ ∏ j : σ, ↑(↑e a) j ^ ↑d j = (∏ j : { j // j ≠ i }, x₀ j ^ ↑d ↑j) * a ^ ↑d i

tactic: simp only [eval_eq']
state_before: K : Type u_2
σ : Type u_1
ι : Type ?u.9599
inst✝³ : Fintype K
inst✝² : Field K
inst✝¹ : Fintype σ
inst✝ : DecidableEq σ
f : MvPolynomial σ K
h : totalDegree f < (q - 1) * Fintype.card σ
this : DecidableEq K
⊢ ∑ x : σ → K, ↑(eval x) f = ∑ x : σ → K, ∑ d in support f, coeff d f * ∏ i : σ, x i ^ ↑d i

tactic: rw [mul_sum]
state_before: K : Type u_2
σ : Type u_1
ι : Type ?u.9599
inst✝³ : Fintype K
inst✝² : Field K
inst✝¹ : Fintype σ
inst✝ : DecidableEq σ
f : MvPolynomial σ K
h : totalDegree f < (q - 1) * Fintype.card σ
this : DecidableEq K
d : σ →₀ ℕ
hd : d ∈ support f
i : σ
hi : ↑d i < q - 1
x₀ : { j // j ≠ i } → K
e : K ≃ { x // x ∘ Subtype.val = x₀ } := (Equiv.subtypeEquivCodomain x₀).symm
⊢ ∑ a : K, (∏ j : { j // j ≠ i }, x₀ j ^ ↑d ↑j) * a ^ ↑d i = (∏ j : { j // j ≠ i }, x₀ j ^ ↑d ↑j) * ∑ a : K, a ^ ↑d i

tactic: rw [sum_pow_lt_card_sub_one K _ hi, MulZeroClass.mul_zero]
state_before: K : Type u_2
σ : Type u_1
ι : Type ?u.9599
inst✝³ : Fintype K
inst✝² : Field K
inst✝¹ : Fintype σ
inst✝ : DecidableEq σ
f : MvPolynomial σ K
h : totalDegree f < (q - 1) * Fintype.card σ
this : DecidableEq K
d : σ →₀ ℕ
hd : d ∈ support f
i : σ
hi : ↑d i < q - 1
x₀ : { j // j ≠ i } → K
e : K ≃ { x // x ∘ Subtype.val = x₀ } := (Equiv.subtypeEquivCodomain x₀).symm
⊢ (∏ j : { j // j ≠ i }, x₀ j ^ ↑d ↑j) * ∑ a : K, a ^ ↑d i = 0

tactic: rw [← e'.prod_comp, Fintype.prod_sum_type, univ_unique, prod_singleton]
state_before: K : Type u_2
σ : Type u_1
ι : Type ?u.9599
inst✝³ : Fintype K
inst✝² : Field K
inst✝¹ : Fintype σ
inst✝ : DecidableEq σ
f : MvPolynomial σ K
h : totalDegree f < (q - 1) * Fintype.card σ
this✝ : DecidableEq K
d : σ →₀ ℕ
hd : d ∈ support f
i : σ
hi : ↑d i < q - 1
x₀ : { j // j ≠ i } → K
e : K ≃ { x // x ∘ Subtype.val = x₀ } := (Equiv.subtypeEquivCodomain x₀).symm
a : K
e' : { j // j = i } ⊕ { j // j ≠ i } ≃ σ := Equiv.sumCompl fun j => j = i
this : Unique { j // j = i } :=
  { toInhabited := { default := { val := i, property := (_ : i = i) } },
    uniq := (_ : ∀ (x : { j // j = i }), x = default) }
⊢ ∏ j : σ, ↑(↑e a) j ^ ↑d j = ↑(↑e a) i ^ ↑d i * ∏ j : { j // j ≠ i }, ↑(↑e a) ↑j ^ ↑d ↑j

tactic: rfl
state_before: K : Type u_2
σ : Type u_1
ι : Type ?u.9599
inst✝³ : Fintype K
inst✝² : Field K
inst✝¹ : Fintype σ
inst✝ : DecidableEq σ
f : MvPolynomial σ K
h : totalDegree f < (q - 1) * Fintype.card σ
this✝ : DecidableEq K
d : σ →₀ ℕ
hd : d ∈ support f
i : σ
hi : ↑d i < q - 1
x₀ : { j // j ≠ i } → K
e : K ≃ { x // x ∘ Subtype.val = x₀ } := (Equiv.subtypeEquivCodomain x₀).symm
a : K
e' : { j // j = i } ⊕ { j // j ≠ i } ≃ σ := Equiv.sumCompl fun j => j = i
this : Unique { j // j = i } :=
  { toInhabited := { default := { val := i, property := (_ : i = i) } },
    uniq := (_ : ∀ (x : { j // j = i }), x = default) }
⊢ ↑(↑e a) (↑e' (Sum.inl default)) ^ ↑d (↑e' (Sum.inl default)) *
      ∏ a₂ : { j // j ≠ i }, ↑(↑e a) (↑e' (Sum.inr a₂)) ^ ↑d (↑e' (Sum.inr a₂)) =
    ↑(↑e a) i ^ ↑d i * ∏ j : { j // j ≠ i }, ↑(↑e a) ↑j ^ ↑d ↑j

tactic: rw [Equiv.subtypeEquivCodomain_symm_apply_eq]
state_before: K : Type u_2
σ : Type u_1
ι : Type ?u.9599
inst✝³ : Fintype K
inst✝² : Field K
inst✝¹ : Fintype σ
inst✝ : DecidableEq σ
f : MvPolynomial σ K
h : totalDegree f < (q - 1) * Fintype.card σ
this✝ : DecidableEq K
d : σ →₀ ℕ
hd : d ∈ support f
i : σ
hi : ↑d i < q - 1
x₀ : { j // j ≠ i } → K
e : K ≃ { x // x ∘ Subtype.val = x₀ } := (Equiv.subtypeEquivCodomain x₀).symm
a : K
e' : { j // j = i } ⊕ { j // j ≠ i } ≃ σ := Equiv.sumCompl fun j => j = i
this : Unique { j // j = i } :=
  { toInhabited := { default := { val := i, property := (_ : i = i) } },
    uniq := (_ : ∀ (x : { j // j = i }), x = default) }
⊢ ↑(↑e a) i ^ ↑d i * ∏ j : { j // j ≠ i }, ↑(↑e a) ↑j ^ ↑d ↑j = a ^ ↑d i * ∏ j : { j // j ≠ i }, ↑(↑e a) ↑j ^ ↑d ↑j

tactic: rintro ⟨j, hj⟩
state_before: case intro
K : Type u_2
σ : Type u_1
ι : Type ?u.9599
inst✝³ : Fintype K
inst✝² : Field K
inst✝¹ : Fintype σ
inst✝ : DecidableEq σ
f : MvPolynomial σ K
h : totalDegree f < (q - 1) * Fintype.card σ
this✝ : DecidableEq K
d : σ →₀ ℕ
hd : d ∈ support f
i : σ
hi : ↑d i < q - 1
x₀ : { j // j ≠ i } → K
e : K ≃ { x // x ∘ Subtype.val = x₀ } := (Equiv.subtypeEquivCodomain x₀).symm
a : K
e' : { j // j = i } ⊕ { j // j ≠ i } ≃ σ := Equiv.sumCompl fun j => j = i
this : Unique { j // j = i } :=
  { toInhabited := { default := { val := i, property := (_ : i = i) } },
    uniq := (_ : ∀ (x : { j // j = i }), x = default) }
⊢ ∀ (a_1 : { j // j ≠ i }), ↑(↑e a) ↑a_1 ^ ↑d ↑a_1 = x₀ a_1 ^ ↑d ↑a_1

tactic: show (e a : σ → K) j ^ d j = x₀ ⟨j, hj⟩ ^ d j
state_before: case intro.mk
K : Type u_2
σ : Type u_1
ι : Type ?u.9599
inst✝³ : Fintype K
inst✝² : Field K
inst✝¹ : Fintype σ
inst✝ : DecidableEq σ
f : MvPolynomial σ K
h : totalDegree f < (q - 1) * Fintype.card σ
this✝ : DecidableEq K
d : σ →₀ ℕ
hd : d ∈ support f
i : σ
hi : ↑d i < q - 1
x₀ : { j // j ≠ i } → K
e : K ≃ { x // x ∘ Subtype.val = x₀ } := (Equiv.subtypeEquivCodomain x₀).symm
a : K
e' : { j // j = i } ⊕ { j // j ≠ i } ≃ σ := Equiv.sumCompl fun j => j = i
this : Unique { j // j = i } :=
  { toInhabited := { default := { val := i, property := (_ : i = i) } },
    uniq := (_ : ∀ (x : { j // j = i }), x = default) }
j : σ
hj : j ≠ i
⊢ ↑(↑e a) ↑{ val := j, property := hj } ^ ↑d ↑{ val := j, property := hj } =
    x₀ { val := j, property := hj } ^ ↑d ↑{ val := j, property := hj }

tactic: rw [Equiv.subtypeEquivCodomain_symm_apply_ne]
state_before: case intro.mk
K : Type u_2
σ : Type u_1
ι : Type ?u.9599
inst✝³ : Fintype K
inst✝² : Field K
inst✝¹ : Fintype σ
inst✝ : DecidableEq σ
f : MvPolynomial σ K
h : totalDegree f < (q - 1) * Fintype.card σ
this✝ : DecidableEq K
d : σ →₀ ℕ
hd : d ∈ support f
i : σ
hi : ↑d i < q - 1
x₀ : { j // j ≠ i } → K
e : K ≃ { x // x ∘ Subtype.val = x₀ } := (Equiv.subtypeEquivCodomain x₀).symm
a : K
e' : { j // j = i } ⊕ { j // j ≠ i } ≃ σ := Equiv.sumCompl fun j => j = i
this : Unique { j // j = i } :=
  { toInhabited := { default := { val := i, property := (_ : i = i) } },
    uniq := (_ : ∀ (x : { j // j = i }), x = default) }
j : σ
hj : j ≠ i
⊢ ↑(↑e a) j ^ ↑d j = x₀ { val := j, property := hj } ^ ↑d j