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

tactic: rw [charpoly, det_apply', ← insert_erase (mem_univ (Equiv.refl n)),
  sum_insert (not_mem_erase (Equiv.refl n) univ), add_comm]
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
⊢ degree (charpoly M - ∏ i : n, (X - ↑C (M i i))) < ↑(Fintype.card n - 1)

tactic: simp only [charmatrix_apply_eq, one_mul, Equiv.Perm.sign_refl, id.def, Int.cast_one,
  Units.val_one, add_sub_cancel, Equiv.coe_refl]
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
⊢ degree
      (∑ x in Finset.erase univ (Equiv.refl n), ↑↑(↑Equiv.Perm.sign x) * ∏ i : n, charmatrix M (↑x i) i +
          ↑↑(↑Equiv.Perm.sign (Equiv.refl n)) * ∏ i : n, charmatrix M (↑(Equiv.refl n) i) i -
        ∏ i : n, (X - ↑C (M i i))) <
    ↑(Fintype.card n - 1)

tactic: rw [← mem_degreeLT]
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
⊢ degree (∑ x in Finset.erase univ (Equiv.refl n), ↑↑(↑Equiv.Perm.sign x) * ∏ x_1 : n, charmatrix M (↑x x_1) x_1) <
    ↑(Fintype.card n - 1)

tactic: apply Submodule.sum_mem (degreeLT R (Fintype.card n - 1))
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
⊢ ∑ x in Finset.erase univ (Equiv.refl n), ↑↑(↑Equiv.Perm.sign x) * ∏ x_1 : n, charmatrix M (↑x x_1) x_1 ∈
    degreeLT R (Fintype.card n - 1)

tactic: intro c hc
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
⊢ ∀ (c : n ≃ n),
    c ∈ Finset.erase univ (Equiv.refl n) →
      ↑↑(↑Equiv.Perm.sign c) * ∏ x : n, charmatrix M (↑c x) x ∈ degreeLT R (Fintype.card n - 1)

tactic: rw [← C_eq_int_cast, C_mul']
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
c : n ≃ n
hc : c ∈ Finset.erase univ (Equiv.refl n)
⊢ ↑↑(↑Equiv.Perm.sign c) * ∏ x : n, charmatrix M (↑c x) x ∈ degreeLT R (Fintype.card n - 1)

tactic: apply Submodule.smul_mem (degreeLT R (Fintype.card n - 1)) ↑↑(Equiv.Perm.sign c)
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
c : n ≃ n
hc : c ∈ Finset.erase univ (Equiv.refl n)
⊢ ↑↑(↑Equiv.Perm.sign c) • ∏ x : n, charmatrix M (↑c x) x ∈ degreeLT R (Fintype.card n - 1)

tactic: rw [mem_degreeLT]
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
c : n ≃ n
hc : c ∈ Finset.erase univ (Equiv.refl n)
⊢ ∏ x : n, charmatrix M (↑c x) x ∈ degreeLT R (Fintype.card n - 1)

tactic: apply lt_of_le_of_lt degree_le_natDegree _
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
c : n ≃ n
hc : c ∈ Finset.erase univ (Equiv.refl n)
⊢ degree (∏ x : n, charmatrix M (↑c x) x) < ↑(Fintype.card n - 1)

tactic: rw [Nat.cast_withBot, Nat.cast_withBot]
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
c : n ≃ n
hc : c ∈ Finset.erase univ (Equiv.refl n)
⊢ ↑(natDegree (∏ x : n, charmatrix M (↑c x) x)) < ↑(Fintype.card n - 1)

tactic: rw [WithBot.coe_lt_coe]
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
c : n ≃ n
hc : c ∈ Finset.erase univ (Equiv.refl n)
⊢ ↑(natDegree (∏ x : n, charmatrix M (↑c x) x)) < ↑(Fintype.card n - 1)

tactic: apply lt_of_le_of_lt _ (Equiv.Perm.fixed_point_card_lt_of_ne_one (ne_of_mem_erase hc))
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
c : n ≃ n
hc : c ∈ Finset.erase univ (Equiv.refl n)
⊢ natDegree (∏ x : n, charmatrix M (↑c x) x) < Fintype.card n - 1

tactic: apply le_trans (Polynomial.natDegree_prod_le univ fun i : n => charmatrix M (c i) i) _
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
c : n ≃ n
hc : c ∈ Finset.erase univ (Equiv.refl n)
⊢ natDegree (∏ x : n, charmatrix M (↑c x) x) ≤ card (filter (fun x => ↑c x = x) univ)

tactic: rw [card_eq_sum_ones]
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
c : n ≃ n
hc : c ∈ Finset.erase univ (Equiv.refl n)
⊢ ∑ i : n, natDegree (charmatrix M (↑c i) i) ≤ card (filter (fun x => ↑c x = x) univ)

tactic: rw [sum_filter]
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
c : n ≃ n
hc : c ∈ Finset.erase univ (Equiv.refl n)
⊢ ∑ i : n, natDegree (charmatrix M (↑c i) i) ≤ ∑ x in filter (fun x => ↑c x = x) univ, 1

tactic: apply sum_le_sum
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
c : n ≃ n
hc : c ∈ Finset.erase univ (Equiv.refl n)
⊢ ∑ i : n, natDegree (charmatrix M (↑c i) i) ≤ ∑ a : n, if ↑c a = a then 1 else 0

tactic: intros
state_before: case 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
c : n ≃ n
hc : c ∈ Finset.erase univ (Equiv.refl n)
⊢ ∀ (i : n), i ∈ univ → natDegree (charmatrix M (↑c i) i) ≤ if ↑c i = i then 1 else 0

tactic: apply charmatrix_apply_natDegree_le
state_before: case 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
c : n ≃ n
hc : c ∈ Finset.erase univ (Equiv.refl n)
i✝ : n
a✝ : i✝ ∈ univ
⊢ natDegree (charmatrix M (↑c i✝) i✝) ≤ if ↑c i✝ = i✝ then 1 else 0