File: Mathlib/LinearAlgebra/Matrix/Trace.lean

full_name: Matrix.trace
code: /-- The trace of a square matrix. For more bundled versions, see:
* `Matrix.traceAddMonoidHom`
* `Matrix.traceLinearMap`
-/
def trace (A : Matrix n n R) : R 
goal: R

full_name: Matrix.trace_diagonal
code: lemma trace_diagonal {o} [Fintype o] [DecidableEq o] (d : o → R) :
    trace (diagonal d) = ∑ i, d i 
goal: (Matrix.diagonal d).trace = ∑ i : o, d i

full_name: Matrix.trace_zero
code: @[simp]
theorem trace_zero : trace (0 : Matrix n n R) = 0 
goal: Matrix.trace 0 = 0

full_name: Matrix.trace_eq_zero_of_isEmpty
code: @[simp]
lemma trace_eq_zero_of_isEmpty [IsEmpty n] (A : Matrix n n R) : trace A = 0 
goal: A.trace = 0

full_name: Matrix.trace_add
code: @[simp]
theorem trace_add (A B : Matrix n n R) : trace (A + B) = trace A + trace B 
goal: (A + B).trace = A.trace + B.trace

full_name: Matrix.trace_smul
code: @[simp]
theorem trace_smul [Monoid α] [DistribMulAction α R] (r : α) (A : Matrix n n R) :
    trace (r • A) = r • trace A 
goal: (r • A).trace = r • A.trace

full_name: Matrix.trace_transpose
code: @[simp]
theorem trace_transpose (A : Matrix n n R) : trace Aᵀ = trace A 
goal: Aᵀ.trace = A.trace

full_name: Matrix.trace_conjTranspose
code: @[simp]
theorem trace_conjTranspose [StarAddMonoid R] (A : Matrix n n R) : trace Aᴴ = star (trace A) 
goal: Aᴴ.trace = star A.trace

full_name: Matrix.traceAddMonoidHom_apply
code: /-- `Matrix.trace` as an `AddMonoidHom` -/
@[simps]
def traceAddMonoidHom : Matrix n n R →+ R 
goal: (Matrix.traceAddMonoidHom n R) A = A.trace

full_name: Matrix.traceAddMonoidHom
code: /-- `Matrix.trace` as an `AddMonoidHom` -/
@[simps]
def traceAddMonoidHom : Matrix n n R →+ R 
goal: Matrix n n R →+ R

full_name: Matrix.traceLinearMap
code: /-- `Matrix.trace` as a `LinearMap` -/
@[simps]
def traceLinearMap [Semiring α] [Module α R] : Matrix n n R →ₗ[α] R 
goal: Matrix n n R →ₗ[α] R

full_name: Matrix.traceLinearMap_apply
code: /-- `Matrix.trace` as a `LinearMap` -/
@[simps]
def traceLinearMap [Semiring α] [Module α R] : Matrix n n R →ₗ[α] R 
goal: (Matrix.traceLinearMap n α R) A = A.trace

full_name: Matrix.trace_list_sum
code: @[simp]
theorem trace_list_sum (l : List (Matrix n n R)) : trace l.sum = (l.map trace).sum 
goal: l.sum.trace = (List.map Matrix.trace l).sum

full_name: Matrix.trace_multiset_sum
code: @[simp]
theorem trace_multiset_sum (s : Multiset (Matrix n n R)) : trace s.sum = (s.map trace).sum 
goal: s.sum.trace = (Multiset.map Matrix.trace s).sum

full_name: Matrix.trace_sum
code: @[simp]
theorem trace_sum (s : Finset ι) (f : ι → Matrix n n R) :
    trace (∑ i ∈ s, f i) = ∑ i ∈ s, trace (f i) 
goal: (∑ i ∈ s, f i).trace = ∑ i ∈ s, (f i).trace

full_name: AddMonoidHom.map_trace
code: theorem _root_.AddMonoidHom.map_trace [AddCommMonoid S] (f : R →+ S) (A : Matrix n n R) :
    f (trace A)  = trace (f.mapMatrix A) 
goal: f A.trace = (f.mapMatrix A).trace

full_name: Matrix.trace_blockDiagonal
code: lemma trace_blockDiagonal [DecidableEq p] (M : p → Matrix n n R) :
    trace (blockDiagonal M) = ∑ i, trace (M i) 
goal: (Matrix.blockDiagonal M).trace = ∑ i : p, (M i).trace

full_name: Matrix.trace_blockDiagonal'
code: lemma trace_blockDiagonal' [DecidableEq p] {m : p → Type*} [∀ i, Fintype (m i)]
    (M : ∀ i, Matrix (m i) (m i) R) :
    trace (blockDiagonal' M) = ∑ i, trace (M i) 
goal: (Matrix.blockDiagonal' M).trace = ∑ i : p, (M i).trace

full_name: Matrix.trace_sub
code: @[simp]
theorem trace_sub (A B : Matrix n n R) : trace (A - B) = trace A - trace B 
goal: (A - B).trace = A.trace - B.trace

full_name: Matrix.trace_neg
code: @[simp]
theorem trace_neg (A : Matrix n n R) : trace (-A) = -trace A 
goal: (-A).trace = -A.trace

full_name: Matrix.trace_one
code: @[simp]
theorem trace_one : trace (1 : Matrix n n R) = Fintype.card n 
goal: Matrix.trace 1 = ↑(Fintype.card n)

full_name: Matrix.trace_transpose_mul
code: @[simp]
theorem trace_transpose_mul [AddCommMonoid R] [Mul R] (A : Matrix m n R) (B : Matrix n m R) :
    trace (Aᵀ * Bᵀ) = trace (A * B) 
goal: (Aᵀ * Bᵀ).trace = (A * B).trace

full_name: Matrix.trace_mul_comm
code: theorem trace_mul_comm [AddCommMonoid R] [CommSemigroup R] (A : Matrix m n R) (B : Matrix n m R) :
    trace (A * B) = trace (B * A) 
goal: (A * B).trace = (B * A).trace

full_name: Matrix.trace_mul_cycle
code: theorem trace_mul_cycle [NonUnitalCommSemiring R] (A : Matrix m n R) (B : Matrix n p R)
    (C : Matrix p m R) : trace (A * B * C) = trace (C * A * B) 
goal: (A * B * C).trace = (C * A * B).trace

full_name: Matrix.trace_mul_cycle'
code: theorem trace_mul_cycle' [NonUnitalCommSemiring R] (A : Matrix m n R) (B : Matrix n p R)
    (C : Matrix p m R) : trace (A * (B * C)) = trace (C * (A * B)) 
goal: (A * (B * C)).trace = (C * (A * B)).trace

full_name: Matrix.trace_col_mul_row
code: @[simp]
theorem trace_col_mul_row {ι : Type*} [Unique ι] [NonUnitalNonAssocSemiring R] (a b : n → R) :
    trace (col ι a * row ι b) = dotProduct a b 
goal: (Matrix.col ι a * Matrix.row ι b).trace = a ⬝ᵥ b

full_name: Matrix.trace_submatrix_succ
code: lemma trace_submatrix_succ {n : ℕ} [NonUnitalNonAssocSemiring R]
    (M : Matrix (Fin n.succ) (Fin n.succ) R) :
    M 0 0 + trace (submatrix M Fin.succ Fin.succ) = trace M 
goal: M 0 0 + (M.submatrix Fin.succ Fin.succ).trace = M.trace

full_name: Matrix.trace_fin_zero
code: theorem trace_fin_zero (A : Matrix (Fin 0) (Fin 0) R) : trace A = 0 
goal: A.trace = 0

full_name: Matrix.trace_fin_one
code: theorem trace_fin_one (A : Matrix (Fin 1) (Fin 1) R) : trace A = A 0 0 
goal: A.trace = A 0 0

full_name: Matrix.trace_fin_two
code: theorem trace_fin_two (A : Matrix (Fin 2) (Fin 2) R) : trace A = A 0 0 + A 1 1 
goal: A.trace = A 0 0 + A 1 1

full_name: Matrix.trace_fin_three
code: theorem trace_fin_three (A : Matrix (Fin 3) (Fin 3) R) : trace A = A 0 0 + A 1 1 + A 2 2 
goal: A.trace = A 0 0 + A 1 1 + A 2 2