l3lab/ntp-mathlib huggingface dataset:
theorem toMatrix_injective [DecidableEq n] [MonoidWithZero α] [Nontrivial α] :
    Function.Injective (@toMatrix m n α _ _ _) := by
  classical
    intro f g
    refine' not_imp_not.1 _
    simp only [Matrix.ext_iff.symm, toMatrix_apply, PEquiv.ext_iff, not_forall, exists_imp]
    intro i hi
    

Proof state:
k : Type u_1
l : Type u_2
m : Type u_3
n : Type u_4
α : Type v
inst✝² : DecidableEq n
inst✝¹ : MonoidWithZero α
inst✝ : Nontrivial α
f g : m ≃. n
i : m
hi : ¬f i = g i
⊢ ∃ x x_1, ¬(if x_1 ∈ f x then 1 else 0) = if x_1 ∈ g x then 1 else 0

Next tactic:
use i
theorem toMatrix_injective [DecidableEq n] [MonoidWithZero α] [Nontrivial α] :
    Function.Injective (@toMatrix m n α _ _ _) := by
  classical
    intro f g
    refine' not_imp_not.1 _
    simp only [Matrix.ext_iff.symm, toMatrix_apply, PEquiv.ext_iff, not_forall, exists_imp]
    intro i hi
    use i
    

Proof state:
case h
k : Type u_1
l : Type u_2
m : Type u_3
n : Type u_4
α : Type v
inst✝² : DecidableEq n
inst✝¹ : MonoidWithZero α
inst✝ : Nontrivial α
f g : m ≃. n
i : m
hi : ¬f i = g i
⊢ ∃ x, ¬(if x ∈ f i then 1 else 0) = if x ∈ g i then 1 else 0

Next tactic:
cases' hf : f i with fi
theorem toMatrix_injective [DecidableEq n] [MonoidWithZero α] [Nontrivial α] :
    Function.Injective (@toMatrix m n α _ _ _) := by
  classical
    intro f g
    refine' not_imp_not.1 _
    simp only [Matrix.ext_iff.symm, toMatrix_apply, PEquiv.ext_iff, not_forall, exists_imp]
    intro i hi
    use i
    cases' hf : f i with fi
    · 

Proof state:
case h.none
k : Type u_1
l : Type u_2
m : Type u_3
n : Type u_4
α : Type v
inst✝² : DecidableEq n
inst✝¹ : MonoidWithZero α
inst✝ : Nontrivial α
f g : m ≃. n
i : m
hi : ¬f i = g i
hf : f i = none
⊢ ∃ x, ¬(if x ∈ none then 1 else 0) = if x ∈ g i then 1 else 0

Next tactic:
cases' hg : g i with gi
theorem toMatrix_injective [DecidableEq n] [MonoidWithZero α] [Nontrivial α] :
    Function.Injective (@toMatrix m n α _ _ _) := by
  classical
    intro f g
    refine' not_imp_not.1 _
    simp only [Matrix.ext_iff.symm, toMatrix_apply, PEquiv.ext_iff, not_forall, exists_imp]
    intro i hi
    use i
    cases' hf : f i with fi
    · cases' hg : g i with gi
      -- Porting note: was `cc`
      · 

Proof state:
case h.none.none
k : Type u_1
l : Type u_2
m : Type u_3
n : Type u_4
α : Type v
inst✝² : DecidableEq n
inst✝¹ : MonoidWithZero α
inst✝ : Nontrivial α
f g : m ≃. n
i : m
hi : ¬f i = g i
hf : f i = none
hg : g i = none
⊢ ∃ x, ¬(if x ∈ none then 1 else 0) = if x ∈ none then 1 else 0

Next tactic:
rw [hf, hg] at hi
theorem toMatrix_injective [DecidableEq n] [MonoidWithZero α] [Nontrivial α] :
    Function.Injective (@toMatrix m n α _ _ _) := by
  classical
    intro f g
    refine' not_imp_not.1 _
    simp only [Matrix.ext_iff.symm, toMatrix_apply, PEquiv.ext_iff, not_forall, exists_imp]
    intro i hi
    use i
    cases' hf : f i with fi
    · cases' hg : g i with gi
      -- Porting note: was `cc`
      · rw [hf, hg] at hi
        

Proof state:
case h.none.none
k : Type u_1
l : Type u_2
m : Type u_3
n : Type u_4
α : Type v
inst✝² : DecidableEq n
inst✝¹ : MonoidWithZero α
inst✝ : Nontrivial α
f g : m ≃. n
i : m
hi : ¬none = none
hf : f i = none
hg : g i = none
⊢ ∃ x, ¬(if x ∈ none then 1 else 0) = if x ∈ none then 1 else 0

Next tactic:
exact (hi rfl).elim
theorem toMatrix_injective [DecidableEq n] [MonoidWithZero α] [Nontrivial α] :
    Function.Injective (@toMatrix m n α _ _ _) := by
  classical
    intro f g
    refine' not_imp_not.1 _
    simp only [Matrix.ext_iff.symm, toMatrix_apply, PEquiv.ext_iff, not_forall, exists_imp]
    intro i hi
    use i
    cases' hf : f i with fi
    · cases' hg : g i with gi
      -- Porting note: was `cc`
      · rw [hf, hg] at hi
        exact (hi rfl).elim
      · 

Proof state:
case h.none.some
k : Type u_1
l : Type u_2
m : Type u_3
n : Type u_4
α : Type v
inst✝² : DecidableEq n
inst✝¹ : MonoidWithZero α
inst✝ : Nontrivial α
f g : m ≃. n
i : m
hi : ¬f i = g i
hf : f i = none
gi : n
hg : g i = some gi
⊢ ∃ x, ¬(if x ∈ none then 1 else 0) = if x ∈ some gi then 1 else 0

Next tactic:
use gi
theorem toMatrix_injective [DecidableEq n] [MonoidWithZero α] [Nontrivial α] :
    Function.Injective (@toMatrix m n α _ _ _) := by
  classical
    intro f g
    refine' not_imp_not.1 _
    simp only [Matrix.ext_iff.symm, toMatrix_apply, PEquiv.ext_iff, not_forall, exists_imp]
    intro i hi
    use i
    cases' hf : f i with fi
    · cases' hg : g i with gi
      -- Porting note: was `cc`
      · rw [hf, hg] at hi
        exact (hi rfl).elim
      · use gi
        

Proof state:
case h
k : Type u_1
l : Type u_2
m : Type u_3
n : Type u_4
α : Type v
inst✝² : DecidableEq n
inst✝¹ : MonoidWithZero α
inst✝ : Nontrivial α
f g : m ≃. n
i : m
hi : ¬f i = g i
hf : f i = none
gi : n
hg : g i = some gi
⊢ ¬(if gi ∈ none then 1 else 0) = if gi ∈ some gi then 1 else 0

Next tactic:
simp
theorem toMatrix_injective [DecidableEq n] [MonoidWithZero α] [Nontrivial α] :
    Function.Injective (@toMatrix m n α _ _ _) := by
  classical
    intro f g
    refine' not_imp_not.1 _
    simp only [Matrix.ext_iff.symm, toMatrix_apply, PEquiv.ext_iff, not_forall, exists_imp]
    intro i hi
    use i
    cases' hf : f i with fi
    · cases' hg : g i with gi
      -- Porting note: was `cc`
      · rw [hf, hg] at hi
        exact (hi rfl).elim
      · use gi
        simp
    · 

Proof state:
case h.some
k : Type u_1
l : Type u_2
m : Type u_3
n : Type u_4
α : Type v
inst✝² : DecidableEq n
inst✝¹ : MonoidWithZero α
inst✝ : Nontrivial α
f g : m ≃. n
i : m
hi : ¬f i = g i
fi : n
hf : f i = some fi
⊢ ∃ x, ¬(if x ∈ some fi then 1 else 0) = if x ∈ g i then 1 else 0

Next tactic:
use fi
theorem toMatrix_injective [DecidableEq n] [MonoidWithZero α] [Nontrivial α] :
    Function.Injective (@toMatrix m n α _ _ _) := by
  classical
    intro f g
    refine' not_imp_not.1 _
    simp only [Matrix.ext_iff.symm, toMatrix_apply, PEquiv.ext_iff, not_forall, exists_imp]
    intro i hi
    use i
    cases' hf : f i with fi
    · cases' hg : g i with gi
      -- Porting note: was `cc`
      · rw [hf, hg] at hi
        exact (hi rfl).elim
      · use gi
        simp
    · use fi
      

Proof state:
case h
k : Type u_1
l : Type u_2
m : Type u_3
n : Type u_4
α : Type v
inst✝² : DecidableEq n
inst✝¹ : MonoidWithZero α
inst✝ : Nontrivial α
f g : m ≃. n
i : m
hi : ¬f i = g i
fi : n
hf : f i = some fi
⊢ ¬(if fi ∈ some fi then 1 else 0) = if fi ∈ g i then 1 else 0

Next tactic:
simp [hf.symm, Ne.symm hi]
theorem toMatrix_swap [DecidableEq n] [Ring α] (i j : n) :
    (Equiv.swap i j).toPEquiv.toMatrix =
      (1 : Matrix n n α) - (single i i).toMatrix - (single j j).toMatrix + (single i j).toMatrix +
        (single j i).toMatrix := by
  

Proof state:
k : Type u_1
l : Type u_2
m : Type u_3
n : Type u_4
α : Type v
inst✝¹ : DecidableEq n
inst✝ : Ring α
i j : n
⊢ toMatrix (Equiv.toPEquiv (Equiv.swap i j)) =
    1 - toMatrix (single i i) - toMatrix (single j j) + toMatrix (single i j) + toMatrix (single j i)

Next tactic:
ext
theorem toMatrix_swap [DecidableEq n] [Ring α] (i j : n) :
    (Equiv.swap i j).toPEquiv.toMatrix =
      (1 : Matrix n n α) - (single i i).toMatrix - (single j j).toMatrix + (single i j).toMatrix +
        (single j i).toMatrix := by
  ext
  

Proof state:
case a.h
k : Type u_1
l : Type u_2
m : Type u_3
n : Type u_4
α : Type v
inst✝¹ : DecidableEq n
inst✝ : Ring α
i j i✝ x✝ : n
⊢ toMatrix (Equiv.toPEquiv (Equiv.swap i j)) i✝ x✝ =
    (1 - toMatrix (single i i) - toMatrix (single j j) + toMatrix (single i j) + toMatrix (single j i)) i✝ x✝

Next tactic:
dsimp [toMatrix, single, Equiv.swap_apply_def, Equiv.toPEquiv, one_apply]
theorem toMatrix_swap [DecidableEq n] [Ring α] (i j : n) :
    (Equiv.swap i j).toPEquiv.toMatrix =
      (1 : Matrix n n α) - (single i i).toMatrix - (single j j).toMatrix + (single i j).toMatrix +
        (single j i).toMatrix := by
  ext
  dsimp [toMatrix, single, Equiv.swap_apply_def, Equiv.toPEquiv, one_apply]
  

Proof state:
case a.h
k : Type u_1
l : Type u_2
m : Type u_3
n : Type u_4
α : Type v
inst✝¹ : DecidableEq n
inst✝ : Ring α
i j i✝ x✝ : n
⊢ (if x✝ ∈ some (if i✝ = i then j else if i✝ = j then i else i✝) then 1 else 0) =
    ((((if i✝ = x✝ then 1 else 0) - if x✝ ∈ if i✝ = i then some i else none then 1 else 0) -
          if x✝ ∈ if i✝ = j then some j else none then 1 else 0) +
        if x✝ ∈ if i✝ = i then some j else none then 1 else 0) +
      if x✝ ∈ if i✝ = j then some i else none then 1 else 0

Next tactic:
split_ifs
theorem toMatrix_swap [DecidableEq n] [Ring α] (i j : n) :
    (Equiv.swap i j).toPEquiv.toMatrix =
      (1 : Matrix n n α) - (single i i).toMatrix - (single j j).toMatrix + (single i j).toMatrix +
        (single j i).toMatrix := by
  ext
  dsimp [toMatrix, single, Equiv.swap_apply_def, Equiv.toPEquiv, one_apply]
  split_ifs <;> 

Proof state:
case pos
k : Type u_1
l : Type u_2
m : Type u_3
n : Type u_4
α : Type v
inst✝¹ : DecidableEq n
inst✝ : Ring α
i j i✝ x✝ : n
h✝⁴ : i✝ = i
h✝³ : x✝ ∈ some j
h✝² : i✝ = x✝
h✝¹ : x✝ ∈ some i
h✝ : i✝ = j
⊢ 1 = 1 - 1 - 1 + 1 + 1

Next tactic:
simp_all
theorem toMatrix_swap [DecidableEq n] [Ring α] (i j : n) :
    (Equiv.swap i j).toPEquiv.toMatrix =
      (1 : Matrix n n α) - (single i i).toMatrix - (single j j).toMatrix + (single i j).toMatrix +
        (single j i).toMatrix := by
  ext
  dsimp [toMatrix, single, Equiv.swap_apply_def, Equiv.toPEquiv, one_apply]
  split_ifs <;> 

Proof state:
case pos
k : Type u_1
l : Type u_2
m : Type u_3
n : Type u_4
α : Type v
inst✝¹ : DecidableEq n
inst✝ : Ring α
i j i✝ x✝ : n
h✝⁵ : i✝ = i
h✝⁴ : x✝ ∈ some j
h✝³ : i✝ = x✝
h✝² : x✝ ∈ some i
h✝¹ : ¬i✝ = j
h✝ : x✝ ∈ none
⊢ 1 = 1 - 1 - 1 + 1 + 1

Next tactic:
simp_all
theorem toMatrix_swap [DecidableEq n] [Ring α] (i j : n) :
    (Equiv.swap i j).toPEquiv.toMatrix =
      (1 : Matrix n n α) - (single i i).toMatrix - (single j j).toMatrix + (single i j).toMatrix +
        (single j i).toMatrix := by
  ext
  dsimp [toMatrix, single, Equiv.swap_apply_def, Equiv.toPEquiv, one_apply]
  split_ifs <;> 

Proof state:
case neg
k : Type u_1
l : Type u_2
m : Type u_3
n : Type u_4
α : Type v
inst✝¹ : DecidableEq n
inst✝ : Ring α
i j i✝ x✝ : n
h✝⁵ : i✝ = i
h✝⁴ : x✝ ∈ some j
h✝³ : i✝ = x✝
h✝² : x✝ ∈ some i
h✝¹ : ¬i✝ = j
h✝ : x✝ ∉ none
⊢ 1 = 1 - 1 - 0 + 1 + 0

Next tactic:
simp_all
theorem toMatrix_swap [DecidableEq n] [Ring α] (i j : n) :
    (Equiv.swap i j).toPEquiv.toMatrix =
      (1 : Matrix n n α) - (single i i).toMatrix - (single j j).toMatrix + (single i j).toMatrix +
        (single j i).toMatrix := by
  ext
  dsimp [toMatrix, single, Equiv.swap_apply_def, Equiv.toPEquiv, one_apply]
  split_ifs <;> 

Proof state:
case pos
k : Type u_1
l : Type u_2
m : Type u_3
n : Type u_4
α : Type v
inst✝¹ : DecidableEq n
inst✝ : Ring α
i j i✝ x✝ : n
h✝⁴ : i✝ = i
h✝³ : x✝ ∈ some j
h✝² : i✝ = x✝
h✝¹ : x✝ ∉ some i
h✝ : i✝ = j
⊢ 1 = 1 - 0 - 1 + 1 + 0

Next tactic:
simp_all
theorem toMatrix_swap [DecidableEq n] [Ring α] (i j : n) :
    (Equiv.swap i j).toPEquiv.toMatrix =
      (1 : Matrix n n α) - (single i i).toMatrix - (single j j).toMatrix + (single i j).toMatrix +
        (single j i).toMatrix := by
  ext
  dsimp [toMatrix, single, Equiv.swap_apply_def, Equiv.toPEquiv, one_apply]
  split_ifs <;> 

Proof state:
case pos
k : Type u_1
l : Type u_2
m : Type u_3
n : Type u_4
α : Type v
inst✝¹ : DecidableEq n
inst✝ : Ring α
i j i✝ x✝ : n
h✝⁵ : i✝ = i
h✝⁴ : x✝ ∈ some j
h✝³ : i✝ = x✝
h✝² : x✝ ∉ some i
h✝¹ : ¬i✝ = j
h✝ : x✝ ∈ none
⊢ 1 = 1 - 0 - 1 + 1 + 1

Next tactic:
simp_all
theorem toMatrix_swap [DecidableEq n] [Ring α] (i j : n) :
    (Equiv.swap i j).toPEquiv.toMatrix =
      (1 : Matrix n n α) - (single i i).toMatrix - (single j j).toMatrix + (single i j).toMatrix +
        (single j i).toMatrix := by
  ext
  dsimp [toMatrix, single, Equiv.swap_apply_def, Equiv.toPEquiv, one_apply]
  split_ifs <;> 

Proof state:
case neg
k : Type u_1
l : Type u_2
m : Type u_3
n : Type u_4
α : Type v
inst✝¹ : DecidableEq n
inst✝ : Ring α
i j i✝ x✝ : n
h✝⁵ : i✝ = i
h✝⁴ : x✝ ∈ some j
h✝³ : i✝ = x✝
h✝² : x✝ ∉ some i
h✝¹ : ¬i✝ = j
h✝ : x✝ ∉ none
⊢ 1 = 1 - 0 - 0 + 1 + 0

Next tactic:
simp_all
theorem toMatrix_swap [DecidableEq n] [Ring α] (i j : n) :
    (Equiv.swap i j).toPEquiv.toMatrix =
      (1 : Matrix n n α) - (single i i).toMatrix - (single j j).toMatrix + (single i j).toMatrix +
        (single j i).toMatrix := by
  ext
  dsimp [toMatrix, single, Equiv.swap_apply_def, Equiv.toPEquiv, one_apply]
  split_ifs <;> 

Proof state:
case pos
k : Type u_1
l : Type u_2
m : Type u_3
n : Type u_4
α : Type v
inst✝¹ : DecidableEq n
inst✝ : Ring α
i j i✝ x✝ : n
h✝⁴ : i✝ = i
h✝³ : x✝ ∈ some j
h✝² : ¬i✝ = x✝
h✝¹ : x✝ ∈ some i
h✝ : i✝ = j
⊢ 1 = 0 - 1 - 1 + 1 + 1

Next tactic:
simp_all
theorem toMatrix_swap [DecidableEq n] [Ring α] (i j : n) :
    (Equiv.swap i j).toPEquiv.toMatrix =
      (1 : Matrix n n α) - (single i i).toMatrix - (single j j).toMatrix + (single i j).toMatrix +
        (single j i).toMatrix := by
  ext
  dsimp [toMatrix, single, Equiv.swap_apply_def, Equiv.toPEquiv, one_apply]
  split_ifs <;> 

Proof state:
case pos
k : Type u_1
l : Type u_2
m : Type u_3
n : Type u_4
α : Type v
inst✝¹ : DecidableEq n
inst✝ : Ring α
i j i✝ x✝ : n
h✝⁵ : i✝ = i
h✝⁴ : x✝ ∈ some j
h✝³ : ¬i✝ = x✝
h✝² : x✝ ∈ some i
h✝¹ : ¬i✝ = j
h✝ : x✝ ∈ none
⊢ 1 = 0 - 1 - 1 + 1 + 1

Next tactic:
simp_all
theorem toMatrix_swap [DecidableEq n] [Ring α] (i j : n) :
    (Equiv.swap i j).toPEquiv.toMatrix =
      (1 : Matrix n n α) - (single i i).toMatrix - (single j j).toMatrix + (single i j).toMatrix +
        (single j i).toMatrix := by
  ext
  dsimp [toMatrix, single, Equiv.swap_apply_def, Equiv.toPEquiv, one_apply]
  split_ifs <;> 

Proof state:
case neg
k : Type u_1
l : Type u_2
m : Type u_3
n : Type u_4
α : Type v
inst✝¹ : DecidableEq n
inst✝ : Ring α
i j i✝ x✝ : n
h✝⁵ : i✝ = i
h✝⁴ : x✝ ∈ some j
h✝³ : ¬i✝ = x✝
h✝² : x✝ ∈ some i
h✝¹ : ¬i✝ = j
h✝ : x✝ ∉ none
⊢ 1 = 0 - 1 - 0 + 1 + 0

Next tactic:
simp_all
theorem toMatrix_swap [DecidableEq n] [Ring α] (i j : n) :
    (Equiv.swap i j).toPEquiv.toMatrix =
      (1 : Matrix n n α) - (single i i).toMatrix - (single j j).toMatrix + (single i j).toMatrix +
        (single j i).toMatrix := by
  ext
  dsimp [toMatrix, single, Equiv.swap_apply_def, Equiv.toPEquiv, one_apply]
  split_ifs <;> 

Proof state:
case pos
k : Type u_1
l : Type u_2
m : Type u_3
n : Type u_4
α : Type v
inst✝¹ : DecidableEq n
inst✝ : Ring α
i j i✝ x✝ : n
h✝⁴ : i✝ = i
h✝³ : x✝ ∈ some j
h✝² : ¬i✝ = x✝
h✝¹ : x✝ ∉ some i
h✝ : i✝ = j
⊢ 1 = 0 - 0 - 1 + 1 + 0

Next tactic:
simp_all
theorem toMatrix_swap [DecidableEq n] [Ring α] (i j : n) :
    (Equiv.swap i j).toPEquiv.toMatrix =
      (1 : Matrix n n α) - (single i i).toMatrix - (single j j).toMatrix + (single i j).toMatrix +
        (single j i).toMatrix := by
  ext
  dsimp [toMatrix, single, Equiv.swap_apply_def, Equiv.toPEquiv, one_apply]
  split_ifs <;> 

Proof state:
case pos
k : Type u_1
l : Type u_2
m : Type u_3
n : Type u_4
α : Type v
inst✝¹ : DecidableEq n
inst✝ : Ring α
i j i✝ x✝ : n
h✝⁵ : i✝ = i
h✝⁴ : x✝ ∈ some j
h✝³ : ¬i✝ = x✝
h✝² : x✝ ∉ some i
h✝¹ : ¬i✝ = j
h✝ : x✝ ∈ none
⊢ 1 = 0 - 0 - 1 + 1 + 1

Next tactic:
simp_all
theorem toMatrix_swap [DecidableEq n] [Ring α] (i j : n) :
    (Equiv.swap i j).toPEquiv.toMatrix =
      (1 : Matrix n n α) - (single i i).toMatrix - (single j j).toMatrix + (single i j).toMatrix +
        (single j i).toMatrix := by
  ext
  dsimp [toMatrix, single, Equiv.swap_apply_def, Equiv.toPEquiv, one_apply]
  split_ifs <;> 

Proof state:
case neg
k : Type u_1
l : Type u_2
m : Type u_3
n : Type u_4
α : Type v
inst✝¹ : DecidableEq n
inst✝ : Ring α
i j i✝ x✝ : n
h✝⁵ : i✝ = i
h✝⁴ : x✝ ∈ some j
h✝³ : ¬i✝ = x✝
h✝² : x✝ ∉ some i
h✝¹ : ¬i✝ = j
h✝ : x✝ ∉ none
⊢ 1 = 0 - 0 - 0 + 1 + 0

Next tactic:
simp_all
theorem toMatrix_swap [DecidableEq n] [Ring α] (i j : n) :
    (Equiv.swap i j).toPEquiv.toMatrix =
      (1 : Matrix n n α) - (single i i).toMatrix - (single j j).toMatrix + (single i j).toMatrix +
        (single j i).toMatrix := by
  ext
  dsimp [toMatrix, single, Equiv.swap_apply_def, Equiv.toPEquiv, one_apply]
  split_ifs <;> 

Proof state:
case pos
k : Type u_1
l : Type u_2
m : Type u_3
n : Type u_4
α : Type v
inst✝¹ : DecidableEq n
inst✝ : Ring α
i j i✝ x✝ : n
h✝⁴ : i✝ = i
h✝³ : x✝ ∉ some j
h✝² : i✝ = x✝
h✝¹ : x✝ ∈ some i
h✝ : i✝ = j
⊢ 0 = 1 - 1 - 0 + 0 + 1

Next tactic:
simp_all
theorem toMatrix_swap [DecidableEq n] [Ring α] (i j : n) :
    (Equiv.swap i j).toPEquiv.toMatrix =
      (1 : Matrix n n α) - (single i i).toMatrix - (single j j).toMatrix + (single i j).toMatrix +
        (single j i).toMatrix := by
  ext
  dsimp [toMatrix, single, Equiv.swap_apply_def, Equiv.toPEquiv, one_apply]
  split_ifs <;> 

Proof state:
case pos
k : Type u_1
l : Type u_2
m : Type u_3
n : Type u_4
α : Type v
inst✝¹ : DecidableEq n
inst✝ : Ring α
i j i✝ x✝ : n
h✝⁵ : i✝ = i
h✝⁴ : x✝ ∉ some j
h✝³ : i✝ = x✝
h✝² : x✝ ∈ some i
h✝¹ : ¬i✝ = j
h✝ : x✝ ∈ none
⊢ 0 = 1 - 1 - 1 + 0 + 1

Next tactic:
simp_all
theorem toMatrix_swap [DecidableEq n] [Ring α] (i j : n) :
    (Equiv.swap i j).toPEquiv.toMatrix =
      (1 : Matrix n n α) - (single i i).toMatrix - (single j j).toMatrix + (single i j).toMatrix +
        (single j i).toMatrix := by
  ext
  dsimp [toMatrix, single, Equiv.swap_apply_def, Equiv.toPEquiv, one_apply]
  split_ifs <;> 

Proof state:
case neg
k : Type u_1
l : Type u_2
m : Type u_3
n : Type u_4
α : Type v
inst✝¹ : DecidableEq n
inst✝ : Ring α
i j i✝ x✝ : n
h✝⁵ : i✝ = i
h✝⁴ : x✝ ∉ some j
h✝³ : i✝ = x✝
h✝² : x✝ ∈ some i
h✝¹ : ¬i✝ = j
h✝ : x✝ ∉ none
⊢ 0 = 1 - 1 - 0 + 0 + 0

Next tactic:
simp_all
theorem toMatrix_swap [DecidableEq n] [Ring α] (i j : n) :
    (Equiv.swap i j).toPEquiv.toMatrix =
      (1 : Matrix n n α) - (single i i).toMatrix - (single j j).toMatrix + (single i j).toMatrix +
        (single j i).toMatrix := by
  ext
  dsimp [toMatrix, single, Equiv.swap_apply_def, Equiv.toPEquiv, one_apply]
  split_ifs <;> 

Proof state:
case pos
k : Type u_1
l : Type u_2
m : Type u_3
n : Type u_4
α : Type v
inst✝¹ : DecidableEq n
inst✝ : Ring α
i j i✝ x✝ : n
h✝⁴ : i✝ = i
h✝³ : x✝ ∉ some j
h✝² : i✝ = x✝
h✝¹ : x✝ ∉ some i
h✝ : i✝ = j
⊢ 0 = 1 - 0 - 0 + 0 + 0

Next tactic:
simp_all
theorem toMatrix_swap [DecidableEq n] [Ring α] (i j : n) :
    (Equiv.swap i j).toPEquiv.toMatrix =
      (1 : Matrix n n α) - (single i i).toMatrix - (single j j).toMatrix + (single i j).toMatrix +
        (single j i).toMatrix := by
  ext
  dsimp [toMatrix, single, Equiv.swap_apply_def, Equiv.toPEquiv, one_apply]
  split_ifs <;> 

Proof state:
case pos
k : Type u_1
l : Type u_2
m : Type u_3
n : Type u_4
α : Type v
inst✝¹ : DecidableEq n
inst✝ : Ring α
i j i✝ x✝ : n
h✝⁵ : i✝ = i
h✝⁴ : x✝ ∉ some j
h✝³ : i✝ = x✝
h✝² : x✝ ∉ some i
h✝¹ : ¬i✝ = j
h✝ : x✝ ∈ none
⊢ 0 = 1 - 0 - 1 + 0 + 1

Next tactic:
simp_all
theorem toMatrix_swap [DecidableEq n] [Ring α] (i j : n) :
    (Equiv.swap i j).toPEquiv.toMatrix =
      (1 : Matrix n n α) - (single i i).toMatrix - (single j j).toMatrix + (single i j).toMatrix +
        (single j i).toMatrix := by
  ext
  dsimp [toMatrix, single, Equiv.swap_apply_def, Equiv.toPEquiv, one_apply]
  split_ifs <;> 

Proof state:
case neg
k : Type u_1
l : Type u_2
m : Type u_3
n : Type u_4
α : Type v
inst✝¹ : DecidableEq n
inst✝ : Ring α
i j i✝ x✝ : n
h✝⁵ : i✝ = i
h✝⁴ : x✝ ∉ some j
h✝³ : i✝ = x✝
h✝² : x✝ ∉ some i
h✝¹ : ¬i✝ = j
h✝ : x✝ ∉ none
⊢ 0 = 1 - 0 - 0 + 0 + 0

Next tactic:
simp_all
theorem toMatrix_swap [DecidableEq n] [Ring α] (i j : n) :
    (Equiv.swap i j).toPEquiv.toMatrix =
      (1 : Matrix n n α) - (single i i).toMatrix - (single j j).toMatrix + (single i j).toMatrix +
        (single j i).toMatrix := by
  ext
  dsimp [toMatrix, single, Equiv.swap_apply_def, Equiv.toPEquiv, one_apply]
  split_ifs <;> 

Proof state:
case pos
k : Type u_1
l : Type u_2
m : Type u_3
n : Type u_4
α : Type v
inst✝¹ : DecidableEq n
inst✝ : Ring α
i j i✝ x✝ : n
h✝⁴ : i✝ = i
h✝³ : x✝ ∉ some j
h✝² : ¬i✝ = x✝
h✝¹ : x✝ ∈ some i
h✝ : i✝ = j
⊢ 0 = 0 - 1 - 0 + 0 + 1

Next tactic:
simp_all
theorem toMatrix_swap [DecidableEq n] [Ring α] (i j : n) :
    (Equiv.swap i j).toPEquiv.toMatrix =
      (1 : Matrix n n α) - (single i i).toMatrix - (single j j).toMatrix + (single i j).toMatrix +
        (single j i).toMatrix := by
  ext
  dsimp [toMatrix, single, Equiv.swap_apply_def, Equiv.toPEquiv, one_apply]
  split_ifs <;> 

Proof state:
case pos
k : Type u_1
l : Type u_2
m : Type u_3
n : Type u_4
α : Type v
inst✝¹ : DecidableEq n
inst✝ : Ring α
i j i✝ x✝ : n
h✝⁵ : i✝ = i
h✝⁴ : x✝ ∉ some j
h✝³ : ¬i✝ = x✝
h✝² : x✝ ∈ some i
h✝¹ : ¬i✝ = j
h✝ : x✝ ∈ none
⊢ 0 = 0 - 1 - 1 + 0 + 1

Next tactic:
simp_all
theorem toMatrix_swap [DecidableEq n] [Ring α] (i j : n) :
    (Equiv.swap i j).toPEquiv.toMatrix =
      (1 : Matrix n n α) - (single i i).toMatrix - (single j j).toMatrix + (single i j).toMatrix +
        (single j i).toMatrix := by
  ext
  dsimp [toMatrix, single, Equiv.swap_apply_def, Equiv.toPEquiv, one_apply]
  split_ifs <;> 

Proof state:
case neg
k : Type u_1
l : Type u_2
m : Type u_3
n : Type u_4
α : Type v
inst✝¹ : DecidableEq n
inst✝ : Ring α
i j i✝ x✝ : n
h✝⁵ : i✝ = i
h✝⁴ : x✝ ∉ some j
h✝³ : ¬i✝ = x✝
h✝² : x✝ ∈ some i
h✝¹ : ¬i✝ = j
h✝ : x✝ ∉ none
⊢ 0 = 0 - 1 - 0 + 0 + 0

Next tactic:
simp_all
theorem toMatrix_swap [DecidableEq n] [Ring α] (i j : n) :
    (Equiv.swap i j).toPEquiv.toMatrix =
      (1 : Matrix n n α) - (single i i).toMatrix - (single j j).toMatrix + (single i j).toMatrix +
        (single j i).toMatrix := by
  ext
  dsimp [toMatrix, single, Equiv.swap_apply_def, Equiv.toPEquiv, one_apply]
  split_ifs <;> 

Proof state:
case pos
k : Type u_1
l : Type u_2
m : Type u_3
n : Type u_4
α : Type v
inst✝¹ : DecidableEq n
inst✝ : Ring α
i j i✝ x✝ : n
h✝⁴ : i✝ = i
h✝³ : x✝ ∉ some j
h✝² : ¬i✝ = x✝
h✝¹ : x✝ ∉ some i
h✝ : i✝ = j
⊢ 0 = 0 - 0 - 0 + 0 + 0

Next tactic:
simp_all
theorem toMatrix_swap [DecidableEq n] [Ring α] (i j : n) :
    (Equiv.swap i j).toPEquiv.toMatrix =
      (1 : Matrix n n α) - (single i i).toMatrix - (single j j).toMatrix + (single i j).toMatrix +
        (single j i).toMatrix := by
  ext
  dsimp [toMatrix, single, Equiv.swap_apply_def, Equiv.toPEquiv, one_apply]
  split_ifs <;> 

Proof state:
case pos
k : Type u_1
l : Type u_2
m : Type u_3
n : Type u_4
α : Type v
inst✝¹ : DecidableEq n
inst✝ : Ring α
i j i✝ x✝ : n
h✝⁵ : i✝ = i
h✝⁴ : x✝ ∉ some j
h✝³ : ¬i✝ = x✝
h✝² : x✝ ∉ some i
h✝¹ : ¬i✝ = j
h✝ : x✝ ∈ none
⊢ 0 = 0 - 0 - 1 + 0 + 1

Next tactic:
simp_all
theorem toMatrix_swap [DecidableEq n] [Ring α] (i j : n) :
    (Equiv.swap i j).toPEquiv.toMatrix =
      (1 : Matrix n n α) - (single i i).toMatrix - (single j j).toMatrix + (single i j).toMatrix +
        (single j i).toMatrix := by
  ext
  dsimp [toMatrix, single, Equiv.swap_apply_def, Equiv.toPEquiv, one_apply]
  split_ifs <;> 

Proof state:
case neg
k : Type u_1
l : Type u_2
m : Type u_3
n : Type u_4
α : Type v
inst✝¹ : DecidableEq n
inst✝ : Ring α
i j i✝ x✝ : n
h✝⁵ : i✝ = i
h✝⁴ : x✝ ∉ some j
h✝³ : ¬i✝ = x✝
h✝² : x✝ ∉ some i
h✝¹ : ¬i✝ = j
h✝ : x✝ ∉ none
⊢ 0 = 0 - 0 - 0 + 0 + 0

Next tactic:
simp_all
theorem toMatrix_swap [DecidableEq n] [Ring α] (i j : n) :
    (Equiv.swap i j).toPEquiv.toMatrix =
      (1 : Matrix n n α) - (single i i).toMatrix - (single j j).toMatrix + (single i j).toMatrix +
        (single j i).toMatrix := by
  ext
  dsimp [toMatrix, single, Equiv.swap_apply_def, Equiv.toPEquiv, one_apply]
  split_ifs <;> 

Proof state:
case pos
k : Type u_1
l : Type u_2
m : Type u_3
n : Type u_4
α : Type v
inst✝¹ : DecidableEq n
inst✝ : Ring α
i j i✝ x✝ : n
h✝⁵ : ¬i✝ = i
h✝⁴ : i✝ = j
h✝³ : x✝ ∈ some i
h✝² : i✝ = x✝
h✝¹ : x✝ ∈ none
h✝ : x✝ ∈ some j
⊢ 1 = 1 - 1 - 1 + 1 + 1

Next tactic:
simp_all
theorem toMatrix_swap [DecidableEq n] [Ring α] (i j : n) :
    (Equiv.swap i j).toPEquiv.toMatrix =
      (1 : Matrix n n α) - (single i i).toMatrix - (single j j).toMatrix + (single i j).toMatrix +
        (single j i).toMatrix := by
  ext
  dsimp [toMatrix, single, Equiv.swap_apply_def, Equiv.toPEquiv, one_apply]
  split_ifs <;> 

Proof state:
case neg
k : Type u_1
l : Type u_2
m : Type u_3
n : Type u_4
α : Type v
inst✝¹ : DecidableEq n
inst✝ : Ring α
i j i✝ x✝ : n
h✝⁵ : ¬i✝ = i
h✝⁴ : i✝ = j
h✝³ : x✝ ∈ some i
h✝² : i✝ = x✝
h✝¹ : x✝ ∈ none
h✝ : x✝ ∉ some j
⊢ 1 = 1 - 1 - 0 + 1 + 1

Next tactic:
simp_all