File: Mathlib/Data/Matrix/PEquiv.lean

full_name: PEquiv.toMatrix
code: /-- `toMatrix` returns a matrix containing ones and zeros. `f.toMatrix i j` is `1` if
  `f i = some j` and `0` otherwise -/
def toMatrix [DecidableEq n] [Zero α] [One α] (f : m ≃. n) : Matrix m n α 
goal: Matrix m n α

full_name: PEquiv.toMatrix_apply
code: @[simp]
theorem toMatrix_apply [DecidableEq n] [Zero α] [One α] (f : m ≃. n) (i j) :
    toMatrix f i j = if j ∈ f i then (1 : α) else 0 
goal: f.toMatrix i j = if j ∈ f i then 1 else 0

full_name: PEquiv.mul_matrix_apply
code: theorem mul_matrix_apply [Fintype m] [DecidableEq m] [Semiring α] (f : l ≃. m) (M : Matrix m n α)
    (i j) : (f.toMatrix * M :) i j = Option.casesOn (f i) 0 fun fi => M fi j 
goal: (f.toMatrix * M) i j = Option.casesOn (f i) 0 fun fi => M fi j

full_name: PEquiv.toMatrix_symm
code: theorem toMatrix_symm [DecidableEq m] [DecidableEq n] [Zero α] [One α] (f : m ≃. n) :
    (f.symm.toMatrix : Matrix n m α) = f.toMatrixᵀ 
goal: f.symm.toMatrix = f.toMatrix.transpose

full_name: PEquiv.toMatrix_refl
code: @[simp]
theorem toMatrix_refl [DecidableEq n] [Zero α] [One α] :
    ((PEquiv.refl n).toMatrix : Matrix n n α) = 1 
goal: (PEquiv.refl n).toMatrix = 1

full_name: PEquiv.matrix_mul_apply
code: theorem matrix_mul_apply [Fintype m] [Semiring α] [DecidableEq n] (M : Matrix l m α) (f : m ≃. n)
    (i j) : (M * f.toMatrix :) i j = Option.casesOn (f.symm j) 0 fun fj => M i fj 
goal: (M * f.toMatrix) i j = Option.casesOn (f.symm j) 0 fun fj => M i fj

full_name: PEquiv.toPEquiv_mul_matrix
code: theorem toPEquiv_mul_matrix [Fintype m] [DecidableEq m] [Semiring α] (f : m ≃ m)
    (M : Matrix m n α) : f.toPEquiv.toMatrix * M = M.submatrix f id 
goal: f.toPEquiv.toMatrix * M = M.submatrix (⇑f) id

full_name: PEquiv.mul_toPEquiv_toMatrix
code: theorem mul_toPEquiv_toMatrix {m n α : Type*} [Fintype n] [DecidableEq n] [Semiring α] (f : n ≃ n)
    (M : Matrix m n α) : M * f.toPEquiv.toMatrix = M.submatrix id f.symm 
goal: M * f.toPEquiv.toMatrix = M.submatrix id ⇑f.symm

full_name: PEquiv.toMatrix_trans
code: theorem toMatrix_trans [Fintype m] [DecidableEq m] [DecidableEq n] [Semiring α] (f : l ≃. m)
    (g : m ≃. n) : ((f.trans g).toMatrix : Matrix l n α) = f.toMatrix * g.toMatrix 
goal: (f.trans g).toMatrix = f.toMatrix * g.toMatrix

full_name: PEquiv.toMatrix_bot
code: @[simp]
theorem toMatrix_bot [DecidableEq n] [Zero α] [One α] :
    ((⊥ : PEquiv m n).toMatrix : Matrix m n α) = 0 
goal: ⊥.toMatrix = 0

full_name: PEquiv.toMatrix_injective
code: theorem toMatrix_injective [DecidableEq n] [MonoidWithZero α] [Nontrivial α] :
    Function.Injective (@toMatrix m n α _ _ _) 
goal: Function.Injective PEquiv.toMatrix

full_name: PEquiv.toMatrix_swap
code: 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 
goal: (Equiv.toPEquiv (Equiv.swap i j)).toMatrix =
  1 - (PEquiv.single i i).toMatrix - (PEquiv.single j j).toMatrix + (PEquiv.single i j).toMatrix +
    (PEquiv.single j i).toMatrix

full_name: PEquiv.single_mul_single
code: @[simp]
theorem single_mul_single [Fintype n] [DecidableEq k] [DecidableEq m] [DecidableEq n] [Semiring α]
    (a : m) (b : n) (c : k) :
    ((single a b).toMatrix : Matrix _ _ α) * (single b c).toMatrix = (single a c).toMatrix 
goal: (PEquiv.single a b).toMatrix * (PEquiv.single b c).toMatrix = (PEquiv.single a c).toMatrix

full_name: PEquiv.single_mul_single_of_ne
code: theorem single_mul_single_of_ne [Fintype n] [DecidableEq n] [DecidableEq k] [DecidableEq m]
    [Semiring α] {b₁ b₂ : n} (hb : b₁ ≠ b₂) (a : m) (c : k) :
    (single a b₁).toMatrix * (single b₂ c).toMatrix = (0 : Matrix _ _ α) 
goal: (PEquiv.single a b₁).toMatrix * (PEquiv.single b₂ c).toMatrix = 0

full_name: PEquiv.single_mul_single_right
code: /-- Restatement of `single_mul_single`, which will simplify expressions in `simp` normal form,
  when associativity may otherwise need to be carefully applied. -/
@[simp]
theorem single_mul_single_right [Fintype n] [Fintype k] [DecidableEq n] [DecidableEq k]
    [DecidableEq m] [Semiring α] (a : m) (b : n) (c : k) (M : Matrix k l α) :
    (single a b).toMatrix * ((single b c).toMatrix * M) = (single a c).toMatrix * M 
goal: (PEquiv.single a b).toMatrix * ((PEquiv.single b c).toMatrix * M) = (PEquiv.single a c).toMatrix * M

full_name: PEquiv.equiv_toPEquiv_toMatrix
code: /-- We can also define permutation matrices by permuting the rows of the identity matrix. -/
theorem equiv_toPEquiv_toMatrix [DecidableEq n] [Zero α] [One α] (σ : Equiv n n) (i j : n) :
    σ.toPEquiv.toMatrix i j = (1 : Matrix n n α) (σ i) j 
goal: σ.toPEquiv.toMatrix i j = 1 (σ i) j