Theorem: matPolyEquiv_eq_x_pow_sub_c
File: Mathlib/LinearAlgebra/Matrix/Charpoly/Coeff.lean

tactic: ext m i j
state_before: R : Type u
inst✝⁵ : CommRing R
n G : Type v
inst✝⁴ : DecidableEq n
inst✝³ : Fintype n
α β : Type v
inst✝² : DecidableEq α
M✝ : Matrix n n R
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
K : Type u_1
k : ℕ
inst✝ : Field K
M : Matrix n n K
⊢ ↑matPolyEquiv (↑(RingHom.mapMatrix ↑(expand K k)) (charmatrix (M ^ k))) = X ^ k - ↑C (M ^ k)

tactic: rw [coeff_sub, coeff_C, matPolyEquiv_coeff_apply, RingHom.mapMatrix_apply, Matrix.map_apply,
  AlgHom.coe_toRingHom, DMatrix.sub_apply, coeff_X_pow]
state_before: case a.a.h
R : Type u
inst✝⁵ : CommRing R
n G : Type v
inst✝⁴ : DecidableEq n
inst✝³ : Fintype n
α β : Type v
inst✝² : DecidableEq α
M✝ : Matrix n n R
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
K : Type u_1
k : ℕ
inst✝ : Field K
M : Matrix n n K
m : ℕ
i j : n
⊢ coeff (↑matPolyEquiv (↑(RingHom.mapMatrix ↑(expand K k)) (charmatrix (M ^ k)))) m i j =
    coeff (X ^ k - ↑C (M ^ k)) m i j

tactic: by_cases hij : i = j
state_before: case a.a.h
R : Type u
inst✝⁵ : CommRing R
n G : Type v
inst✝⁴ : DecidableEq n
inst✝³ : Fintype n
α β : Type v
inst✝² : DecidableEq α
M✝ : Matrix n n R
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
K : Type u_1
k : ℕ
inst✝ : Field K
M : Matrix n n K
m : ℕ
i j : n
⊢ coeff (↑(expand K k) (charmatrix (M ^ k) i j)) m = ite (m = k) 1 0 i j - ite (m = 0) (M ^ k) 0 i j

tactic: rw [hij, charmatrix_apply_eq, AlgHom.map_sub, expand_C, expand_X, coeff_sub, coeff_X_pow,
  coeff_C]
state_before: case pos
R : Type u
inst✝⁵ : CommRing R
n G : Type v
inst✝⁴ : DecidableEq n
inst✝³ : Fintype n
α β : Type v
inst✝² : DecidableEq α
M✝ : Matrix n n R
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
K : Type u_1
k : ℕ
inst✝ : Field K
M : Matrix n n K
m : ℕ
i j : n
hij : i = j
⊢ coeff (↑(expand K k) (charmatrix (M ^ k) i j)) m = ite (m = k) 1 0 i j - ite (m = 0) (M ^ k) 0 i j

tactic: split_ifs with mp m0 <;> simp only [Matrix.one_apply_eq, Matrix.zero_apply]
state_before: case pos
R : Type u
inst✝⁵ : CommRing R
n G : Type v
inst✝⁴ : DecidableEq n
inst✝³ : Fintype n
α β : Type v
inst✝² : DecidableEq α
M✝ : Matrix n n R
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
K : Type u_1
k : ℕ
inst✝ : Field K
M : Matrix n n K
m : ℕ
i j : n
hij : i = j
⊢ ((if m = k then 1 else 0) - if m = 0 then (M ^ k) j j else 0) = ite (m = k) 1 0 j j - ite (m = 0) (M ^ k) 0 j j

tactic: rw [charmatrix_apply_ne _ _ _ hij, AlgHom.map_neg, expand_C, coeff_neg, coeff_C]
state_before: case neg
R : Type u
inst✝⁵ : CommRing R
n G : Type v
inst✝⁴ : DecidableEq n
inst✝³ : Fintype n
α β : Type v
inst✝² : DecidableEq α
M✝ : Matrix n n R
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
K : Type u_1
k : ℕ
inst✝ : Field K
M : Matrix n n K
m : ℕ
i j : n
hij : ¬i = j
⊢ coeff (↑(expand K k) (charmatrix (M ^ k) i j)) m = ite (m = k) 1 0 i j - ite (m = 0) (M ^ k) 0 i j

tactic: split_ifs with m0 mp <;>
  simp only [hij, zero_sub, Matrix.zero_apply, sub_zero, neg_zero, Matrix.one_apply_ne, Ne.def,
    not_false_iff]
state_before: case neg
R : Type u
inst✝⁵ : CommRing R
n G : Type v
inst✝⁴ : DecidableEq n
inst✝³ : Fintype n
α β : Type v
inst✝² : DecidableEq α
M✝ : Matrix n n R
p : ℕ
inst✝¹ : Fact (Nat.Prime p)
K : Type u_1
k : ℕ
inst✝ : Field K
M : Matrix n n K
m : ℕ
i j : n
hij : ¬i = j
⊢ (-if m = 0 then (M ^ k) i j else 0) = ite (m = k) 1 0 i j - ite (m = 0) (M ^ k) 0 i j