The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V07. Linear algebra

Mathlib.LinearAlgebra.Trace

43 declarations. Mathlib docs · Source

Trace of a linear map

This file defines the trace of a linear map.

See also Mathlib/LinearAlgebra/Matrix/Trace.lean for the trace of a matrix.

Tags

linear map, trace, diagonal

theorem LinearMap.llcomp.congr_simp E1 #

∀ {R : Type u_2} [inst : CommSemiring R] {R₂ : Type u_14} (R₃ : Type u_15) (M : Type u_17) (N : Type u_18)
  (P : Type u_19) [inst_1 : CommSemiring R₂] [inst_2 : CommSemiring R₃] [inst_3 : AddCommMonoid M]
  [inst_4 : AddCommMonoid N] [inst_5 : AddCommMonoid P] [inst_6 : Module R M] [inst_7 : Module R₂ N]
  [inst_8 : Module R₃ P] {σ₁₂ : R →+* R₂} {σ₁₃ : R →+* R₃} {σ₂₃ : R₂ →+* R₃} [inst_9 : RingHomCompTriple σ₁₂ σ₂₃ σ₁₃],
  LinearMap.llcomp R₃ M N P = LinearMap.llcomp R₃ M N P

def LinearMap.traceAux E0 #

(R : Type u) →
  [inst : CommSemiring R] →
    {M : Type v} →
      [inst_1 : AddCommMonoid M] →
        [inst_2 : Module R M] → {ι : Type w} → [DecidableEq ι] → [Fintype ι] → Module.Basis ι R M → (M →ₗ[R] M) →ₗ[R] R

The trace of an endomorphism given a basis.

theorem LinearMap.traceAux_def E0 #

∀ (R : Type u) [inst : CommSemiring R] {M : Type v} [inst_1 : AddCommMonoid M] [inst_2 : Module R M] {ι : Type w}
  [inst_3 : DecidableEq ι] [inst_4 : Fintype ι] (b : Module.Basis ι R M) (f : M →ₗ[R] M),
  (LinearMap.traceAux R b) f = ((LinearMap.toMatrix b b) f).trace

theorem LinearMap.traceAux_eq E0 #

∀ (R : Type u) [inst : CommSemiring R] {M : Type v} [inst_1 : AddCommMonoid M] [inst_2 : Module R M] {ι : Type w}
  [inst_3 : DecidableEq ι] [inst_4 : Fintype ι] {κ : Type u_1} [inst_5 : DecidableEq κ] [inst_6 : Fintype κ]
  (b : Module.Basis ι R M) (c : Module.Basis κ R M), LinearMap.traceAux R b = LinearMap.traceAux R c

def LinearMap.trace E1 #

(R : Type u) →
  [inst : CommSemiring R] → (M : Type v) → [inst_1 : AddCommMonoid M] → [inst_2 : Module R M] → (M →ₗ[R] M) →ₗ[R] R

Trace of an endomorphism independent of basis.

theorem LinearMap.trace_eq_matrix_trace_of_finset E2 #

∀ (R : Type u) [inst : CommSemiring R] {M : Type v} [inst_1 : AddCommMonoid M] [inst_2 : Module R M] {s : Finset M}
  (b : Module.Basis (↥s) R M) (f : M →ₗ[R] M), (LinearMap.trace R M) f = ((LinearMap.toMatrix b b) f).trace

Auxiliary lemma for trace_eq_matrix_trace.

theorem LinearMap.trace_eq_matrix_trace E1 #

∀ (R : Type u) [inst : CommSemiring R] {M : Type v} [inst_1 : AddCommMonoid M] [inst_2 : Module R M] {ι : Type w}
  [inst_3 : DecidableEq ι] [inst_4 : Fintype ι] (b : Module.Basis ι R M) (f : M →ₗ[R] M),
  (LinearMap.trace R M) f = ((LinearMap.toMatrix b b) f).trace

theorem Matrix.trace_toLin_eq E0 #

∀ {R : Type u} [inst : CommSemiring R] {M : Type v} [inst_1 : AddCommMonoid M] [inst_2 : Module R M] {ι : Type w}
  [inst_3 : DecidableEq ι] [inst_4 : Fintype ι] (A : Matrix ι ι R) (b : Module.Basis ι R M),
  (LinearMap.trace R M) ((Matrix.toLin b b) A) = A.trace

theorem Matrix.trace_toLin'_eq E0 #

∀ {R : Type u} [inst : CommSemiring R] {ι : Type w} [inst_1 : DecidableEq ι] [inst_2 : Fintype ι] (A : Matrix ι ι R),
  (LinearMap.trace R (ι → R)) (Matrix.toLin' A) = A.trace

theorem LinearMap.trace_mul_comm E1 #

∀ (R : Type u) [inst : CommSemiring R] {M : Type v} [inst_1 : AddCommMonoid M] [inst_2 : Module R M] (f g : M →ₗ[R] M),
  (LinearMap.trace R M) (f * g) = (LinearMap.trace R M) (g * f)

theorem LinearMap.trace_mul_cycle E1 #

∀ (R : Type u) [inst : CommSemiring R] {M : Type v} [inst_1 : AddCommMonoid M] [inst_2 : Module R M]
  (f g h : M →ₗ[R] M), (LinearMap.trace R M) (f * g * h) = (LinearMap.trace R M) (h * f * g)

theorem LinearMap.trace_mul_cycle' E1 #

∀ (R : Type u) [inst : CommSemiring R] {M : Type v} [inst_1 : AddCommMonoid M] [inst_2 : Module R M]
  (f g h : M →ₗ[R] M), (LinearMap.trace R M) (f * (g * h)) = (LinearMap.trace R M) (h * (f * g))

theorem LinearMap.trace_lie_mul_eq E0 #

∀ {R : Type u_2} {M : Type u_3} [inst : CommRing R] [inst_1 : AddCommGroup M] [inst_2 : Module R M] (f g h : M →ₗ[R] M),
  (LinearMap.trace R M) (⁅f, g⁆ * h) = (LinearMap.trace R M) (f * ⁅g, h⁆)

theorem LinearMap.trace_conj E0 #

∀ (R : Type u) [inst : CommSemiring R] {M : Type v} [inst_1 : AddCommMonoid M] [inst_2 : Module R M] (g : M →ₗ[R] M)
  (f : (M →ₗ[R] M)ˣ), (LinearMap.trace R M) (↑f * g * ↑f⁻¹) = (LinearMap.trace R M) g

The trace of an endomorphism is invariant under conjugation

theorem LinearMap.trace_lie E0 #

∀ {R : Type u_2} {M : Type u_3} [inst : CommRing R] [inst_1 : AddCommGroup M] [inst_2 : Module R M]
  (f g : Module.End R M), (LinearMap.trace R M) ⁅f, g⁆ = 0

theorem LinearMap.trace_eq_contract_of_basis E1 #

∀ {R : Type u_1} [inst : CommRing R] {M : Type u_2} [inst_1 : AddCommGroup M] [inst_2 : Module R M] {ι : Type u_5}
  [Finite ι] (b : Module.Basis ι R M), LinearMap.trace R M ∘ₗ dualTensorHom R M M = contractLeft R M

The trace of a linear map corresponds to the contraction pairing under the isomorphism End(M) ≃ M* ⊗ M

theorem LinearMap.trace_eq_contract_of_basis' E1 #

∀ {R : Type u_1} [inst : CommRing R] {M : Type u_2} [inst_1 : AddCommGroup M] [inst_2 : Module R M] {ι : Type u_5}
  [inst_3 : Fintype ι] [inst_4 : DecidableEq ι] (b : Module.Basis ι R M),
  LinearMap.trace R M = contractLeft R M ∘ₗ ↑(dualTensorHomEquivOfBasis b).symm

The trace of a linear map corresponds to the contraction pairing under the isomorphism End(M) ≃ M* ⊗ M.

theorem LinearMap.trace_eq_contract E0 #

∀ (R : Type u_1) [inst : CommRing R] (M : Type u_2) [inst_1 : AddCommGroup M] [inst_2 : Module R M] [Module.Free R M]
  [Module.Finite R M], LinearMap.trace R M ∘ₗ dualTensorHom R M M = contractLeft R M

When M is finite free, the trace of a linear map corresponds to the contraction pairing under the isomorphism End(M) ≃ M* ⊗ M.

theorem LinearMap.trace_eq_contract_apply E0 #

∀ (R : Type u_1) [inst : CommRing R] (M : Type u_2) [inst_1 : AddCommGroup M] [inst_2 : Module R M] [Module.Free R M]
  [Module.Finite R M] (x : TensorProduct R (Module.Dual R M) M),
  (LinearMap.trace R M) ((dualTensorHom R M M) x) = (contractLeft R M) x

theorem LinearMap.trace_eq_contract' E1 #

∀ (R : Type u_1) [inst : CommRing R] (M : Type u_2) [inst_1 : AddCommGroup M] [inst_2 : Module R M]
  [inst_3 : Module.Free R M] [inst_4 : Module.Finite R M],
  LinearMap.trace R M = contractLeft R M ∘ₗ ↑(dualTensorHomEquiv R M M).symm

When M is finite free, the trace of a linear map corresponds to the contraction pairing under the isomorphism End(M) ≃ M* ⊗ M.

theorem LinearMap.trace_one E0 #

∀ (R : Type u_1) [inst : CommRing R] (M : Type u_2) [inst_1 : AddCommGroup M] [inst_2 : Module R M] [Module.Free R M]
  [Module.Finite R M], (LinearMap.trace R M) 1 = ↑(Module.finrank R M)

The trace of the identity endomorphism is the dimension of the free module.

theorem LinearMap.trace_id E0 #

∀ (R : Type u_1) [inst : CommRing R] (M : Type u_2) [inst_1 : AddCommGroup M] [inst_2 : Module R M] [Module.Free R M]
  [Module.Finite R M], (LinearMap.trace R M) LinearMap.id = ↑(Module.finrank R M)

The trace of the identity endomorphism is the dimension of the free module.

theorem LinearMap.trace_transpose E0 #

∀ (R : Type u_1) [inst : CommRing R] (M : Type u_2) [inst_1 : AddCommGroup M] [inst_2 : Module R M] [Module.Free R M]
  [Module.Finite R M], LinearMap.trace R (Module.Dual R M) ∘ₗ Module.Dual.transpose = LinearMap.trace R M

theorem LinearMap.trace_prodMap E1 #

∀ (R : Type u_1) [inst : CommRing R] (M : Type u_2) [inst_1 : AddCommGroup M] [inst_2 : Module R M] (N : Type u_3)
  [inst_3 : AddCommGroup N] [inst_4 : Module R N] [Module.Free R M] [Module.Finite R M] [Module.Free R N]
  [Module.Finite R N],
  LinearMap.trace R (M × N) ∘ₗ LinearMap.prodMapLinear R M N M N R =
    LinearMap.id.coprod LinearMap.id ∘ₗ (LinearMap.trace R M).prodMap (LinearMap.trace R N)

theorem LinearMap.trace_prodMap' E1 #

∀ {R : Type u_1} [inst : CommRing R] {M : Type u_2} [inst_1 : AddCommGroup M] [inst_2 : Module R M] {N : Type u_3}
  [inst_3 : AddCommGroup N] [inst_4 : Module R N] [Module.Free R M] [Module.Finite R M] [Module.Free R N]
  [Module.Finite R N] (f : M →ₗ[R] M) (g : N →ₗ[R] N),
  (LinearMap.trace R (M × N)) (f.prodMap g) = (LinearMap.trace R M) f + (LinearMap.trace R N) g

theorem LinearMap.trace_tensorProduct E1 #

∀ (R : Type u_1) [inst : CommRing R] (M : Type u_2) [inst_1 : AddCommGroup M] [inst_2 : Module R M] (N : Type u_3)
  [inst_3 : AddCommGroup N] [inst_4 : Module R N] [Module.Free R M] [Module.Finite R M] [Module.Free R N]
  [Module.Finite R N],
  (TensorProduct.mapBilinear (RingHom.id R) M N M N).compr₂ (LinearMap.trace R (TensorProduct R M N)) =
    (LinearMap.lsmul R R).compl₁₂ (LinearMap.trace R M) (LinearMap.trace R N)

theorem LinearMap.trace_comp_comm E1 #

∀ (R : Type u_1) [inst : CommRing R] (M : Type u_2) [inst_1 : AddCommGroup M] [inst_2 : Module R M] (N : Type u_3)
  [inst_3 : AddCommGroup N] [inst_4 : Module R N] [Module.Free R M] [Module.Finite R M] [Module.Free R N]
  [Module.Finite R N],
  (LinearMap.llcomp R M N M).compr₂ (LinearMap.trace R M) = (LinearMap.llcomp R N M N).flip.compr₂ (LinearMap.trace R N)

theorem LinearMap.trace_transpose' E0 #

∀ {R : Type u_1} [inst : CommRing R] {M : Type u_2} [inst_1 : AddCommGroup M] [inst_2 : Module R M] [Module.Free R M]
  [Module.Finite R M] (f : M →ₗ[R] M),
  (LinearMap.trace R (Module.Dual R M)) (Module.Dual.transpose f) = (LinearMap.trace R M) f

theorem LinearMap.trace_tensorProduct' E1 #

∀ {R : Type u_1} [inst : CommRing R] {M : Type u_2} [inst_1 : AddCommGroup M] [inst_2 : Module R M] {N : Type u_3}
  [inst_3 : AddCommGroup N] [inst_4 : Module R N] [Module.Free R M] [Module.Finite R M] [Module.Free R N]
  [Module.Finite R N] (f : M →ₗ[R] M) (g : N →ₗ[R] N),
  (LinearMap.trace R (TensorProduct R M N)) (TensorProduct.map f g) = (LinearMap.trace R M) f * (LinearMap.trace R N) g

theorem LinearMap.trace_comp_comm' E1 #

∀ {R : Type u_1} [inst : CommRing R] {M : Type u_2} [inst_1 : AddCommGroup M] [inst_2 : Module R M] {N : Type u_3}
  [inst_3 : AddCommGroup N] [inst_4 : Module R N] [Module.Free R M] [Module.Finite R M] [Module.Free R N]
  [Module.Finite R N] (f : M →ₗ[R] N) (g : N →ₗ[R] M), (LinearMap.trace R M) (g ∘ₗ f) = (LinearMap.trace R N) (f ∘ₗ g)

theorem LinearMap.trace_smulRight E0 #

∀ {R : Type u_1} [inst : CommRing R] {M : Type u_2} [inst_1 : AddCommGroup M] [inst_2 : Module R M] [Module.Free R M]
  [Module.Finite R M] (f : M →ₗ[R] R) (x : M), (LinearMap.trace R M) (f.smulRight x) = f x

theorem LinearMap.trace_comp_cycle E1 #

∀ {R : Type u_1} [inst : CommRing R] {M : Type u_2} [inst_1 : AddCommGroup M] [inst_2 : Module R M] {N : Type u_3}
  {P : Type u_4} [inst_3 : AddCommGroup N] [inst_4 : Module R N] [inst_5 : AddCommGroup P] [inst_6 : Module R P]
  [Module.Free R N] [Module.Finite R N] [Module.Free R P] [Module.Finite R P] (f : M →ₗ[R] N) (g : N →ₗ[R] P)
  (h : P →ₗ[R] M), (LinearMap.trace R P) (g ∘ₗ f ∘ₗ h) = (LinearMap.trace R N) (f ∘ₗ h ∘ₗ g)

theorem LinearMap.trace_comp_cycle' E1 #

∀ {R : Type u_1} [inst : CommRing R] {M : Type u_2} [inst_1 : AddCommGroup M] [inst_2 : Module R M] {N : Type u_3}
  {P : Type u_4} [inst_3 : AddCommGroup N] [inst_4 : Module R N] [inst_5 : AddCommGroup P] [inst_6 : Module R P]
  [Module.Free R M] [Module.Finite R M] [Module.Free R P] [Module.Finite R P] (f : M →ₗ[R] N) (g : N →ₗ[R] P)
  (h : P →ₗ[R] M), (LinearMap.trace R P) ((g ∘ₗ f) ∘ₗ h) = (LinearMap.trace R M) ((h ∘ₗ g) ∘ₗ f)

theorem LinearMap.trace_conj' E0 #

∀ {R : Type u_1} [inst : CommRing R] {M : Type u_2} [inst_1 : AddCommGroup M] [inst_2 : Module R M] {N : Type u_3}
  [inst_3 : AddCommGroup N] [inst_4 : Module R N] (f : M →ₗ[R] M) (e : M ≃ₗ[R] N),
  (LinearMap.trace R N) (e.conj f) = (LinearMap.trace R M) f

theorem LinearMap.trace_map E0 #

∀ {K : Type u_6} {V : Type u_7} {W : Type u_8} [inst : Field K] [inst_1 : AddCommGroup V] [inst_2 : Module K V]
  [inst_3 : AddCommGroup W] [inst_4 : Module K W] {F : Type u_9}
  [inst_5 : EquivLike F (Module.End K V) (Module.End K W)] [AlgEquivClass F K (Module.End K V) (Module.End K W)] (f : F)
  (x : Module.End K V), (LinearMap.trace K W) (f x) = (LinearMap.trace K V) x

theorem Matrix.trace_map E0 #

∀ {K : Type u_6} {m : Type u_7} {n : Type u_8} [inst : Field K] [inst_1 : Fintype m] [inst_2 : Fintype n] {F : Type u_9}
  [inst_3 : EquivLike F (Matrix m m K) (Matrix n n K)] [AlgEquivClass F K (Matrix m m K) (Matrix n n K)] (f : F)
  (x : Matrix m m K), (f x).trace = x.trace

theorem Matrix.trace_map' E0 #

∀ {K : Type u_6} {m : Type u_7} {F : Type u_8} [inst : Field K] [inst_1 : Fintype m] [inst_2 : DecidableEq m]
  [inst_3 : FunLike F (Matrix m m K) (Matrix m m K)] [AlgHomClass F K (Matrix m m K) (Matrix m m K)] (f : F)
  (x : Matrix m m K), (f x).trace = x.trace

theorem LinearMap.IsProj.trace E1 #

∀ {R : Type u_1} [inst : CommRing R] {M : Type u_2} [inst_1 : AddCommGroup M] [inst_2 : Module R M] {p : Submodule R M}
  {f : M →ₗ[R] M},
  LinearMap.IsProj p f →
    ∀ [Module.Free R ↥p] [Module.Finite R ↥p] [Module.Free R ↥f.ker] [Module.Finite R ↥f.ker],
      (LinearMap.trace R M) f = ↑(Module.finrank R ↥p)

theorem LinearMap.IsIdempotentElem.trace_eq_zero_iff E0 #

∀ {R : Type u_6} [inst : CommRing R] [CharZero R] {M : Type u_7} [inst_2 : AddCommGroup M] [inst_3 : Module R M]
  {e : M →ₗ[R] M},
  IsIdempotentElem e →
    ∀ [Module.Free R ↥e.range] [Module.Finite R ↥e.range] [Module.Free R ↥e.ker] [Module.Finite R ↥e.ker],
      (LinearMap.trace R M) e = 0 ↔ e = 0

An idempotent endomorphism of a module over a characteristic-zero commutative ring with vanishing trace is the zero map, provided its range and kernel are finite and free.

The Module.Free and Module.Finite instance arguments on range e and ker e are automatic over a field, and more generally over any principal ideal domain R for which M itself is finite and free (submodules of finite free modules over a PID are finite and free).

theorem LinearMap.isNilpotent_trace_of_isNilpotent E1 #

∀ {R : Type u_1} [inst : CommRing R] {M : Type u_2} [inst_1 : AddCommGroup M] [inst_2 : Module R M] {f : M →ₗ[R] M},
  IsNilpotent f → IsNilpotent ((LinearMap.trace R M) f)

theorem LinearMap.trace_comp_eq_mul_of_commute_of_isNilpotent E1 #

∀ {R : Type u_1} [inst : CommRing R] {M : Type u_2} [inst_1 : AddCommGroup M] [inst_2 : Module R M] [IsReduced R]
  {f g : Module.End R M} (μ : R),
  Commute f g →
    IsNilpotent (g - (algebraMap R (Module.End R M)) μ) → (LinearMap.trace R M) (f ∘ₗ g) = μ * (LinearMap.trace R M) f

theorem LinearMap.trace_baseChange E0 #

∀ {R : Type u_1} [inst : CommRing R] {M : Type u_2} [inst_1 : AddCommGroup M] [inst_2 : Module R M] [Module.Free R M]
  [Module.Finite R M] (f : M →ₗ[R] M) (A : Type u_6) [inst_5 : CommRing A] [inst_6 : Algebra R A],
  (LinearMap.trace A (TensorProduct R A M)) (LinearMap.baseChange A f) = (algebraMap R A) ((LinearMap.trace R M) f)

theorem Module.Free.bijective_algebraMap_of_finrank_eq_one E1 #

∀ {R : Type u_1} {S : Type u_2} [inst : CommRing R] [inst_1 : Ring S] [inst_2 : Algebra R S] [Nontrivial R]
  [Module.Free R S], Module.finrank R S = 1 → Function.Bijective ⇑(algebraMap R S)

If S is an R-algebra that is free of rank 1 over R, the map R →+* S is an isomorphism.