l3lab/ntp-mathlib huggingface dataset:
theorem matrix_eq_sum_std_basis [Fintype m] [Fintype n] (x : Matrix m n α) :
    x = ∑ i : m, ∑ j : n, stdBasisMatrix i j (x i j) := by
  ext i j; symm
  iterate 2 rw [Finset.sum_apply]
  -- Porting note: was `convert`
  refine (Fintype.sum_eq_single i ?_).trans ?_; swap
  · -- Porting note: `simp` seems unwilling to apply `Fintype.sum_apply`
    simp (config := { unfoldPartialApp := true }) only [stdBasisMatrix]
    rw [Fintype.sum_apply, Fintype.sum_apply]
    

Proof state:
case a.h.refine_2
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝⁵ : DecidableEq l
inst✝⁴ : DecidableEq m
inst✝³ : DecidableEq n
inst✝² : Semiring α
inst✝¹ : Fintype m
inst✝ : Fintype n
x : Matrix m n α
i : m
j : n
⊢ (∑ c : n, if i = i ∧ c = j then x i c else 0) = x i j

Next tactic:
simp
theorem matrix_eq_sum_std_basis [Fintype m] [Fintype n] (x : Matrix m n α) :
    x = ∑ i : m, ∑ j : n, stdBasisMatrix i j (x i j) := by
  ext i j; symm
  iterate 2 rw [Finset.sum_apply]
  -- Porting note: was `convert`
  refine (Fintype.sum_eq_single i ?_).trans ?_; swap
  · -- Porting note: `simp` seems unwilling to apply `Fintype.sum_apply`
    simp (config := { unfoldPartialApp := true }) only [stdBasisMatrix]
    rw [Fintype.sum_apply, Fintype.sum_apply]
    simp
  · 

Proof state:
case a.h.refine_1
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝⁵ : DecidableEq l
inst✝⁴ : DecidableEq m
inst✝³ : DecidableEq n
inst✝² : Semiring α
inst✝¹ : Fintype m
inst✝ : Fintype n
x : Matrix m n α
i : m
j : n
⊢ ∀ (x_1 : m), x_1 ≠ i → Finset.sum Finset.univ (fun j => stdBasisMatrix x_1 j (x x_1 j)) i j = 0

Next tactic:
intro j' hj'
theorem matrix_eq_sum_std_basis [Fintype m] [Fintype n] (x : Matrix m n α) :
    x = ∑ i : m, ∑ j : n, stdBasisMatrix i j (x i j) := by
  ext i j; symm
  iterate 2 rw [Finset.sum_apply]
  -- Porting note: was `convert`
  refine (Fintype.sum_eq_single i ?_).trans ?_; swap
  · -- Porting note: `simp` seems unwilling to apply `Fintype.sum_apply`
    simp (config := { unfoldPartialApp := true }) only [stdBasisMatrix]
    rw [Fintype.sum_apply, Fintype.sum_apply]
    simp
  · intro j' hj'
    -- Porting note: `simp` seems unwilling to apply `Fintype.sum_apply`
    

Proof state:
case a.h.refine_1
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝⁵ : DecidableEq l
inst✝⁴ : DecidableEq m
inst✝³ : DecidableEq n
inst✝² : Semiring α
inst✝¹ : Fintype m
inst✝ : Fintype n
x : Matrix m n α
i : m
j : n
j' : m
hj' : j' ≠ i
⊢ Finset.sum Finset.univ (fun j => stdBasisMatrix j' j (x j' j)) i j = 0

Next tactic:
simp (config := { unfoldPartialApp := true }) only [stdBasisMatrix]
theorem matrix_eq_sum_std_basis [Fintype m] [Fintype n] (x : Matrix m n α) :
    x = ∑ i : m, ∑ j : n, stdBasisMatrix i j (x i j) := by
  ext i j; symm
  iterate 2 rw [Finset.sum_apply]
  -- Porting note: was `convert`
  refine (Fintype.sum_eq_single i ?_).trans ?_; swap
  · -- Porting note: `simp` seems unwilling to apply `Fintype.sum_apply`
    simp (config := { unfoldPartialApp := true }) only [stdBasisMatrix]
    rw [Fintype.sum_apply, Fintype.sum_apply]
    simp
  · intro j' hj'
    -- Porting note: `simp` seems unwilling to apply `Fintype.sum_apply`
    simp (config := { unfoldPartialApp := true }) only [stdBasisMatrix]
    

Proof state:
case a.h.refine_1
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝⁵ : DecidableEq l
inst✝⁴ : DecidableEq m
inst✝³ : DecidableEq n
inst✝² : Semiring α
inst✝¹ : Fintype m
inst✝ : Fintype n
x : Matrix m n α
i : m
j : n
j' : m
hj' : j' ≠ i
⊢ Finset.sum Finset.univ (fun x_1 i' j'_1 => if j' = i' ∧ x_1 = j'_1 then x j' x_1 else 0) i j = 0

Next tactic:
rw [Fintype.sum_apply, Fintype.sum_apply]
theorem matrix_eq_sum_std_basis [Fintype m] [Fintype n] (x : Matrix m n α) :
    x = ∑ i : m, ∑ j : n, stdBasisMatrix i j (x i j) := by
  ext i j; symm
  iterate 2 rw [Finset.sum_apply]
  -- Porting note: was `convert`
  refine (Fintype.sum_eq_single i ?_).trans ?_; swap
  · -- Porting note: `simp` seems unwilling to apply `Fintype.sum_apply`
    simp (config := { unfoldPartialApp := true }) only [stdBasisMatrix]
    rw [Fintype.sum_apply, Fintype.sum_apply]
    simp
  · intro j' hj'
    -- Porting note: `simp` seems unwilling to apply `Fintype.sum_apply`
    simp (config := { unfoldPartialApp := true }) only [stdBasisMatrix]
    rw [Fintype.sum_apply, Fintype.sum_apply]
    

Proof state:
case a.h.refine_1
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝⁵ : DecidableEq l
inst✝⁴ : DecidableEq m
inst✝³ : DecidableEq n
inst✝² : Semiring α
inst✝¹ : Fintype m
inst✝ : Fintype n
x : Matrix m n α
i : m
j : n
j' : m
hj' : j' ≠ i
⊢ (∑ c : n, if j' = i ∧ c = j then x j' c else 0) = 0

Next tactic:
simp [hj']
theorem std_basis_eq_basis_mul_basis (i : m) (j : n) :
    stdBasisMatrix i j 1 = vecMulVec (fun i' => ite (i = i') 1 0) fun j' => ite (j = j') 1 0 := by
  

Proof state:
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝³ : DecidableEq l
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : Semiring α
i : m
j : n
⊢ stdBasisMatrix i j 1 = vecMulVec (fun i' => if i = i' then 1 else 0) fun j' => if j = j' then 1 else 0

Next tactic:
ext i' j'
theorem std_basis_eq_basis_mul_basis (i : m) (j : n) :
    stdBasisMatrix i j 1 = vecMulVec (fun i' => ite (i = i') 1 0) fun j' => ite (j = j') 1 0 := by
  ext i' j'
  -- Porting note: was `norm_num [std_basis_matrix, vec_mul_vec]` though there are no numerals
  -- involved.
  

Proof state:
case a.h
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝³ : DecidableEq l
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : Semiring α
i : m
j : n
i' : m
j' : n
⊢ stdBasisMatrix i j 1 i' j' = vecMulVec (fun i' => if i = i' then 1 else 0) (fun j' => if j = j' then 1 else 0) i' j'

Next tactic:
simp only [stdBasisMatrix, vecMulVec, mul_ite, mul_one, mul_zero, of_apply]
theorem std_basis_eq_basis_mul_basis (i : m) (j : n) :
    stdBasisMatrix i j 1 = vecMulVec (fun i' => ite (i = i') 1 0) fun j' => ite (j = j') 1 0 := by
  ext i' j'
  -- Porting note: was `norm_num [std_basis_matrix, vec_mul_vec]` though there are no numerals
  -- involved.
  simp only [stdBasisMatrix, vecMulVec, mul_ite, mul_one, mul_zero, of_apply]
  -- Porting note: added next line
  

Proof state:
case a.h
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝³ : DecidableEq l
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : Semiring α
i : m
j : n
i' : m
j' : n
⊢ (if i = i' ∧ j = j' then 1 else 0) = if j = j' then if i = i' then 1 else 0 else 0

Next tactic:
simp_rw [@and_comm (i = i')]
theorem std_basis_eq_basis_mul_basis (i : m) (j : n) :
    stdBasisMatrix i j 1 = vecMulVec (fun i' => ite (i = i') 1 0) fun j' => ite (j = j') 1 0 := by
  ext i' j'
  -- Porting note: was `norm_num [std_basis_matrix, vec_mul_vec]` though there are no numerals
  -- involved.
  simp only [stdBasisMatrix, vecMulVec, mul_ite, mul_one, mul_zero, of_apply]
  -- Porting note: added next line
  simp_rw [@and_comm (i = i')]
  

Proof state:
case a.h
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝³ : DecidableEq l
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : Semiring α
i : m
j : n
i' : m
j' : n
⊢ (if j = j' ∧ i = i' then 1 else 0) = if j = j' then if i = i' then 1 else 0 else 0

Next tactic:
exact ite_and _ _ _ _
@[elab_as_elim]
protected theorem induction_on' [Fintype m] [Fintype n] {P : Matrix m n α → Prop} (M : Matrix m n α)
    (h_zero : P 0) (h_add : ∀ p q, P p → P q → P (p + q))
    (h_std_basis : ∀ (i : m) (j : n) (x : α), P (stdBasisMatrix i j x)) : P M := by
  

Proof state:
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝⁵ : DecidableEq l
inst✝⁴ : DecidableEq m
inst✝³ : DecidableEq n
inst✝² : Semiring α
inst✝¹ : Fintype m
inst✝ : Fintype n
P : Matrix m n α → Prop
M : Matrix m n α
h_zero : P 0
h_add : ∀ (p q : Matrix m n α), P p → P q → P (p + q)
h_std_basis : ∀ (i : m) (j : n) (x : α), P (stdBasisMatrix i j x)
⊢ P M

Next tactic:
rw [matrix_eq_sum_std_basis M, ← Finset.sum_product']
@[elab_as_elim]
protected theorem induction_on' [Fintype m] [Fintype n] {P : Matrix m n α → Prop} (M : Matrix m n α)
    (h_zero : P 0) (h_add : ∀ p q, P p → P q → P (p + q))
    (h_std_basis : ∀ (i : m) (j : n) (x : α), P (stdBasisMatrix i j x)) : P M := by
  rw [matrix_eq_sum_std_basis M, ← Finset.sum_product']
  

Proof state:
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝⁵ : DecidableEq l
inst✝⁴ : DecidableEq m
inst✝³ : DecidableEq n
inst✝² : Semiring α
inst✝¹ : Fintype m
inst✝ : Fintype n
P : Matrix m n α → Prop
M : Matrix m n α
h_zero : P 0
h_add : ∀ (p q : Matrix m n α), P p → P q → P (p + q)
h_std_basis : ∀ (i : m) (j : n) (x : α), P (stdBasisMatrix i j x)
⊢ P (∑ x in Finset.univ ×ˢ Finset.univ, stdBasisMatrix x.1 x.2 (M x.1 x.2))

Next tactic:
apply Finset.sum_induction _ _ h_add h_zero
@[elab_as_elim]
protected theorem induction_on' [Fintype m] [Fintype n] {P : Matrix m n α → Prop} (M : Matrix m n α)
    (h_zero : P 0) (h_add : ∀ p q, P p → P q → P (p + q))
    (h_std_basis : ∀ (i : m) (j : n) (x : α), P (stdBasisMatrix i j x)) : P M := by
  rw [matrix_eq_sum_std_basis M, ← Finset.sum_product']
  apply Finset.sum_induction _ _ h_add h_zero
  · 

Proof state:
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝⁵ : DecidableEq l
inst✝⁴ : DecidableEq m
inst✝³ : DecidableEq n
inst✝² : Semiring α
inst✝¹ : Fintype m
inst✝ : Fintype n
P : Matrix m n α → Prop
M : Matrix m n α
h_zero : P 0
h_add : ∀ (p q : Matrix m n α), P p → P q → P (p + q)
h_std_basis : ∀ (i : m) (j : n) (x : α), P (stdBasisMatrix i j x)
⊢ ∀ x ∈ Finset.univ ×ˢ Finset.univ, P (stdBasisMatrix x.1 x.2 (M x.1 x.2))

Next tactic:
intros
@[elab_as_elim]
protected theorem induction_on' [Fintype m] [Fintype n] {P : Matrix m n α → Prop} (M : Matrix m n α)
    (h_zero : P 0) (h_add : ∀ p q, P p → P q → P (p + q))
    (h_std_basis : ∀ (i : m) (j : n) (x : α), P (stdBasisMatrix i j x)) : P M := by
  rw [matrix_eq_sum_std_basis M, ← Finset.sum_product']
  apply Finset.sum_induction _ _ h_add h_zero
  · intros
    

Proof state:
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝⁵ : DecidableEq l
inst✝⁴ : DecidableEq m
inst✝³ : DecidableEq n
inst✝² : Semiring α
inst✝¹ : Fintype m
inst✝ : Fintype n
P : Matrix m n α → Prop
M : Matrix m n α
h_zero : P 0
h_add : ∀ (p q : Matrix m n α), P p → P q → P (p + q)
h_std_basis : ∀ (i : m) (j : n) (x : α), P (stdBasisMatrix i j x)
x✝ : m × n
a✝ : x✝ ∈ Finset.univ ×ˢ Finset.univ
⊢ P (stdBasisMatrix x✝.1 x✝.2 (M x✝.1 x✝.2))

Next tactic:
apply h_std_basis
@[elab_as_elim]
protected theorem induction_on [Fintype m] [Fintype n] [Nonempty m] [Nonempty n]
    {P : Matrix m n α → Prop} (M : Matrix m n α) (h_add : ∀ p q, P p → P q → P (p + q))
    (h_std_basis : ∀ i j x, P (stdBasisMatrix i j x)) : P M :=
  Matrix.induction_on' M
    (by
      

Proof state:
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝⁷ : DecidableEq l
inst✝⁶ : DecidableEq m
inst✝⁵ : DecidableEq n
inst✝⁴ : Semiring α
inst✝³ : Fintype m
inst✝² : Fintype n
inst✝¹ : Nonempty m
inst✝ : Nonempty n
P : Matrix m n α → Prop
M : Matrix m n α
h_add : ∀ (p q : Matrix m n α), P p → P q → P (p + q)
h_std_basis : ∀ (i : m) (j : n) (x : α), P (stdBasisMatrix i j x)
⊢ P 0

Next tactic:
inhabit m
@[elab_as_elim]
protected theorem induction_on [Fintype m] [Fintype n] [Nonempty m] [Nonempty n]
    {P : Matrix m n α → Prop} (M : Matrix m n α) (h_add : ∀ p q, P p → P q → P (p + q))
    (h_std_basis : ∀ i j x, P (stdBasisMatrix i j x)) : P M :=
  Matrix.induction_on' M
    (by
      inhabit m
      

Proof state:
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝⁷ : DecidableEq l
inst✝⁶ : DecidableEq m
inst✝⁵ : DecidableEq n
inst✝⁴ : Semiring α
inst✝³ : Fintype m
inst✝² : Fintype n
inst✝¹ : Nonempty m
inst✝ : Nonempty n
P : Matrix m n α → Prop
M : Matrix m n α
h_add : ∀ (p q : Matrix m n α), P p → P q → P (p + q)
h_std_basis : ∀ (i : m) (j : n) (x : α), P (stdBasisMatrix i j x)
inhabited_h : Inhabited m
⊢ P 0

Next tactic:
inhabit n
@[elab_as_elim]
protected theorem induction_on [Fintype m] [Fintype n] [Nonempty m] [Nonempty n]
    {P : Matrix m n α → Prop} (M : Matrix m n α) (h_add : ∀ p q, P p → P q → P (p + q))
    (h_std_basis : ∀ i j x, P (stdBasisMatrix i j x)) : P M :=
  Matrix.induction_on' M
    (by
      inhabit m
      inhabit n
      

Proof state:
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝⁷ : DecidableEq l
inst✝⁶ : DecidableEq m
inst✝⁵ : DecidableEq n
inst✝⁴ : Semiring α
inst✝³ : Fintype m
inst✝² : Fintype n
inst✝¹ : Nonempty m
inst✝ : Nonempty n
P : Matrix m n α → Prop
M : Matrix m n α
h_add : ∀ (p q : Matrix m n α), P p → P q → P (p + q)
h_std_basis : ∀ (i : m) (j : n) (x : α), P (stdBasisMatrix i j x)
inhabited_h✝ : Inhabited m
inhabited_h : Inhabited n
⊢ P 0

Next tactic:
simpa using h_std_basis default default 0
@[simp]
theorem apply_of_ne (h : ¬(i = i' ∧ j = j')) : stdBasisMatrix i j c i' j' = 0 := by
  

Proof state:
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝³ : DecidableEq l
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : Semiring α
i : m
j : n
c : α
i' : m
j' : n
h : ¬(i = i' ∧ j = j')
⊢ stdBasisMatrix i j c i' j' = 0

Next tactic:
simp only [stdBasisMatrix, and_imp, ite_eq_right_iff]
@[simp]
theorem apply_of_ne (h : ¬(i = i' ∧ j = j')) : stdBasisMatrix i j c i' j' = 0 := by
  simp only [stdBasisMatrix, and_imp, ite_eq_right_iff]
  

Proof state:
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝³ : DecidableEq l
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : Semiring α
i : m
j : n
c : α
i' : m
j' : n
h : ¬(i = i' ∧ j = j')
⊢ i = i' → j = j' → c = 0

Next tactic:
tauto
@[simp]
theorem apply_of_row_ne {i i' : m} (hi : i ≠ i') (j j' : n) (a : α) :
    stdBasisMatrix i j a i' j' = 0 := by 

Proof state:
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝³ : DecidableEq l
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : Semiring α
i✝ : m
j✝ : n
c : α
i'✝ : m
j'✝ : n
i i' : m
hi : i ≠ i'
j j' : n
a : α
⊢ stdBasisMatrix i j a i' j' = 0

Next tactic:
simp [hi]
@[simp]
theorem apply_of_col_ne (i i' : m) {j j' : n} (hj : j ≠ j') (a : α) :
    stdBasisMatrix i j a i' j' = 0 := by 

Proof state:
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝³ : DecidableEq l
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : Semiring α
i✝ : m
j✝ : n
c : α
i'✝ : m
j'✝ : n
i i' : m
j j' : n
hj : j ≠ j'
a : α
⊢ stdBasisMatrix i j a i' j' = 0

Next tactic:
simp [hj]
@[simp]
theorem diag_same : diag (stdBasisMatrix i i c) = Pi.single i c := by
  

Proof state:
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝³ : DecidableEq l
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : Semiring α
i j : n
c : α
i' j' : n
⊢ diag (stdBasisMatrix i i c) = Pi.single i c

Next tactic:
ext j
@[simp]
theorem diag_same : diag (stdBasisMatrix i i c) = Pi.single i c := by
  ext j
  

Proof state:
case h
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝³ : DecidableEq l
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : Semiring α
i j✝ : n
c : α
i' j' j : n
⊢ diag (stdBasisMatrix i i c) j = Pi.single i c j

Next tactic:
by_cases hij : i = j
@[simp]
theorem diag_same : diag (stdBasisMatrix i i c) = Pi.single i c := by
  ext j
  by_cases hij : i = j <;> (

Proof state:
case pos
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝³ : DecidableEq l
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : Semiring α
i j✝ : n
c : α
i' j' j : n
hij : i = j
⊢ diag (stdBasisMatrix i i c) j = Pi.single i c j

Next tactic:
try rw [hij]
@[simp]
theorem diag_same : diag (stdBasisMatrix i i c) = Pi.single i c := by
  ext j
  by_cases hij : i = j <;> (try 

Proof state:
case pos
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝³ : DecidableEq l
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : Semiring α
i j✝ : n
c : α
i' j' j : n
hij : i = j
⊢ diag (stdBasisMatrix i i c) j = Pi.single i c j

Next tactic:
rw [hij]
@[simp]
theorem diag_same : diag (stdBasisMatrix i i c) = Pi.single i c := by
  ext j
  by_cases hij : i = j <;> (

Proof state:
case neg
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝³ : DecidableEq l
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : Semiring α
i j✝ : n
c : α
i' j' j : n
hij : ¬i = j
⊢ diag (stdBasisMatrix i i c) j = Pi.single i c j

Next tactic:
try rw [hij]
@[simp]
theorem diag_same : diag (stdBasisMatrix i i c) = Pi.single i c := by
  ext j
  by_cases hij : i = j <;> (try 

Proof state:
case neg
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝³ : DecidableEq l
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : Semiring α
i j✝ : n
c : α
i' j' j : n
hij : ¬i = j
⊢ diag (stdBasisMatrix i i c) j = Pi.single i c j

Next tactic:
rw [hij]
@[simp]
theorem diag_same : diag (stdBasisMatrix i i c) = Pi.single i c := by
  ext j
  by_cases hij : i = j <;> (try rw [hij]) <;> 

Proof state:
case pos
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝³ : DecidableEq l
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : Semiring α
i j✝ : n
c : α
i' j' j : n
hij : i = j
⊢ diag (stdBasisMatrix j j c) j = Pi.single j c j

Next tactic:
simp [hij]
@[simp]
theorem diag_same : diag (stdBasisMatrix i i c) = Pi.single i c := by
  ext j
  by_cases hij : i = j <;> (try rw [hij]) <;> 

Proof state:
case neg
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝³ : DecidableEq l
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : Semiring α
i j✝ : n
c : α
i' j' j : n
hij : ¬i = j
⊢ diag (stdBasisMatrix i i c) j = Pi.single i c j

Next tactic:
simp [hij]
@[simp]
theorem trace_zero (h : j ≠ i) : trace (stdBasisMatrix i j c) = 0 := by
  -- Porting note: added `-diag_apply`
  

Proof state:
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝⁴ : DecidableEq l
inst✝³ : DecidableEq m
inst✝² : DecidableEq n
inst✝¹ : Semiring α
i j : n
c : α
i' j' : n
inst✝ : Fintype n
h : j ≠ i
⊢ trace (stdBasisMatrix i j c) = 0

Next tactic:
simp [trace, -diag_apply, h]
@[simp]
theorem trace_eq : trace (stdBasisMatrix i i c) = c := by
  -- Porting note: added `-diag_apply`
  

Proof state:
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝⁴ : DecidableEq l
inst✝³ : DecidableEq m
inst✝² : DecidableEq n
inst✝¹ : Semiring α
i j : n
c : α
i' j' : n
inst✝ : Fintype n
⊢ trace (stdBasisMatrix i i c) = c

Next tactic:
simp [trace, -diag_apply]
@[simp]
theorem mul_left_apply_same (b : n) (M : Matrix n n α) :
    (stdBasisMatrix i j c * M) i b = c * M j b := by 

Proof state:
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝⁴ : DecidableEq l
inst✝³ : DecidableEq m
inst✝² : DecidableEq n
inst✝¹ : Semiring α
i j : n
c : α
i' j' : n
inst✝ : Fintype n
b : n
M : Matrix n n α
⊢ (stdBasisMatrix i j c * M) i b = c * M j b

Next tactic:
simp [mul_apply, stdBasisMatrix]
@[simp]
theorem mul_right_apply_same (a : n) (M : Matrix n n α) :
    (M * stdBasisMatrix i j c) a j = M a i * c := by 

Proof state:
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝⁴ : DecidableEq l
inst✝³ : DecidableEq m
inst✝² : DecidableEq n
inst✝¹ : Semiring α
i j : n
c : α
i' j' : n
inst✝ : Fintype n
a : n
M : Matrix n n α
⊢ (M * stdBasisMatrix i j c) a j = M a i * c

Next tactic:
simp [mul_apply, stdBasisMatrix, mul_comm]
@[simp]
theorem mul_left_apply_of_ne (a b : n) (h : a ≠ i) (M : Matrix n n α) :
    (stdBasisMatrix i j c * M) a b = 0 := by 

Proof state:
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝⁴ : DecidableEq l
inst✝³ : DecidableEq m
inst✝² : DecidableEq n
inst✝¹ : Semiring α
i j : n
c : α
i' j' : n
inst✝ : Fintype n
a b : n
h : a ≠ i
M : Matrix n n α
⊢ (stdBasisMatrix i j c * M) a b = 0

Next tactic:
simp [mul_apply, h.symm]
@[simp]
theorem mul_right_apply_of_ne (a b : n) (hbj : b ≠ j) (M : Matrix n n α) :
    (M * stdBasisMatrix i j c) a b = 0 := by 

Proof state:
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝⁴ : DecidableEq l
inst✝³ : DecidableEq m
inst✝² : DecidableEq n
inst✝¹ : Semiring α
i j : n
c : α
i' j' : n
inst✝ : Fintype n
a b : n
hbj : b ≠ j
M : Matrix n n α
⊢ (M * stdBasisMatrix i j c) a b = 0

Next tactic:
simp [mul_apply, hbj.symm]
@[simp]
theorem mul_same (k : n) (d : α) :
    stdBasisMatrix i j c * stdBasisMatrix j k d = stdBasisMatrix i k (c * d) := by
  

Proof state:
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝⁴ : DecidableEq l
inst✝³ : DecidableEq m
inst✝² : DecidableEq n
inst✝¹ : Semiring α
i j : n
c : α
i' j' : n
inst✝ : Fintype n
k : n
d : α
⊢ stdBasisMatrix i j c * stdBasisMatrix j k d = stdBasisMatrix i k (c * d)

Next tactic:
ext a b
@[simp]
theorem mul_same (k : n) (d : α) :
    stdBasisMatrix i j c * stdBasisMatrix j k d = stdBasisMatrix i k (c * d) := by
  ext a b
  

Proof state:
case a.h
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝⁴ : DecidableEq l
inst✝³ : DecidableEq m
inst✝² : DecidableEq n
inst✝¹ : Semiring α
i j : n
c : α
i' j' : n
inst✝ : Fintype n
k : n
d : α
a b : n
⊢ (stdBasisMatrix i j c * stdBasisMatrix j k d) a b = stdBasisMatrix i k (c * d) a b

Next tactic:
simp only [mul_apply, stdBasisMatrix, boole_mul]
@[simp]
theorem mul_same (k : n) (d : α) :
    stdBasisMatrix i j c * stdBasisMatrix j k d = stdBasisMatrix i k (c * d) := by
  ext a b
  simp only [mul_apply, stdBasisMatrix, boole_mul]
  

Proof state:
case a.h
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝⁴ : DecidableEq l
inst✝³ : DecidableEq m
inst✝² : DecidableEq n
inst✝¹ : Semiring α
i j : n
c : α
i' j' : n
inst✝ : Fintype n
k : n
d : α
a b : n
⊢ (∑ x : n, (if i = a ∧ j = x then c else 0) * if j = x ∧ k = b then d else 0) = if i = a ∧ k = b then c * d else 0

Next tactic:
by_cases h₁ : i = a
@[simp]
theorem mul_same (k : n) (d : α) :
    stdBasisMatrix i j c * stdBasisMatrix j k d = stdBasisMatrix i k (c * d) := by
  ext a b
  simp only [mul_apply, stdBasisMatrix, boole_mul]
  by_cases h₁ : i = a <;> 

Proof state:
case pos
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝⁴ : DecidableEq l
inst✝³ : DecidableEq m
inst✝² : DecidableEq n
inst✝¹ : Semiring α
i j : n
c : α
i' j' : n
inst✝ : Fintype n
k : n
d : α
a b : n
h₁ : i = a
⊢ (∑ x : n, (if i = a ∧ j = x then c else 0) * if j = x ∧ k = b then d else 0) = if i = a ∧ k = b then c * d else 0

Next tactic:
by_cases h₂ : k = b
@[simp]
theorem mul_same (k : n) (d : α) :
    stdBasisMatrix i j c * stdBasisMatrix j k d = stdBasisMatrix i k (c * d) := by
  ext a b
  simp only [mul_apply, stdBasisMatrix, boole_mul]
  by_cases h₁ : i = a <;> 

Proof state:
case neg
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝⁴ : DecidableEq l
inst✝³ : DecidableEq m
inst✝² : DecidableEq n
inst✝¹ : Semiring α
i j : n
c : α
i' j' : n
inst✝ : Fintype n
k : n
d : α
a b : n
h₁ : ¬i = a
⊢ (∑ x : n, (if i = a ∧ j = x then c else 0) * if j = x ∧ k = b then d else 0) = if i = a ∧ k = b then c * d else 0

Next tactic:
by_cases h₂ : k = b
@[simp]
theorem mul_same (k : n) (d : α) :
    stdBasisMatrix i j c * stdBasisMatrix j k d = stdBasisMatrix i k (c * d) := by
  ext a b
  simp only [mul_apply, stdBasisMatrix, boole_mul]
  by_cases h₁ : i = a <;> by_cases h₂ : k = b <;> 

Proof state:
case pos
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝⁴ : DecidableEq l
inst✝³ : DecidableEq m
inst✝² : DecidableEq n
inst✝¹ : Semiring α
i j : n
c : α
i' j' : n
inst✝ : Fintype n
k : n
d : α
a b : n
h₁ : i = a
h₂ : k = b
⊢ (∑ x : n, (if i = a ∧ j = x then c else 0) * if j = x ∧ k = b then d else 0) = if i = a ∧ k = b then c * d else 0

Next tactic:
simp [h₁, h₂]