Matrix basics #
Basic matrix lemmas used by the monlib4 automorphism-of-matrix-algebras formalization.
@[reducible, inline]
abbrev
Matrix.stdBasisMatrix
{R : Type u_1}
{n : Type u_2}
{m : Type u_3}
[Zero R]
[DecidableEq n]
[DecidableEq m]
(i : n)
(j : m)
(a : R)
:
Matrix n m R
Compatibility name for the old Monlib/mathlib3 matrix unit API.
Equations
- Matrix.stdBasisMatrix i j a = Matrix.single i j a
Instances For
theorem
Matrix.one_eq_sum_std_matrix
{n : Type u_1}
{R : Type u_2}
[CommSemiring R]
[Fintype n]
[DecidableEq n]
:
The identity matrix as a sum of standard matrix units.
theorem
Matrix.kronecker_trace
{R : Type u_1}
{n : Type u_2}
[CommSemiring R]
[Fintype n]
(A B : Matrix n n R)
:
The trace of a Kronecker product is the product of traces.
theorem
Matrix.kronecker.trace
{R : Type u_1}
{n : Type u_2}
[CommSemiring R]
[Fintype n]
(A B : Matrix n n R)
:
@[reducible, inline]
noncomputable abbrev
Matrix.IsHermitian.eigenvectorMatrix
{n : Type u_1}
{𝕜 : Type u_2}
[RCLike 𝕜]
[Fintype n]
[DecidableEq n]
{A : Matrix n n 𝕜}
(hA : A.IsHermitian)
:
Matrix n n 𝕜
The unitary eigenvector matrix associated to a Hermitian matrix.
Equations
- hA.eigenvectorMatrix = ↑hA.eigenvectorUnitary
Instances For
theorem
Matrix.IsHermitian.eigenvectorUnitary_coe_eq_eigenvectorMatrix
{n : Type u_1}
{𝕜 : Type u_2}
[RCLike 𝕜]
[Fintype n]
[DecidableEq n]
{A : Matrix n n 𝕜}
(hA : A.IsHermitian)
:
theorem
Matrix.IsHermitian.eigenvalues_eq'
{n : Type u_1}
{𝕜 : Type u_2}
[RCLike 𝕜]
[Fintype n]
[DecidableEq n]
{A : Matrix n n 𝕜}
(hA : A.IsHermitian)
(i : n)
:
hA.eigenvalues i = RCLike.re (star (hA.eigenvectorMatrix.transpose i) ⬝ᵥ A.mulVec (hA.eigenvectorMatrix.transpose i))
theorem
Matrix.IsHermitian.eigenvectorMatrix_conjTranspose
{n : Type u_1}
{𝕜 : Type u_2}
[RCLike 𝕜]
[Fintype n]
[DecidableEq n]
{A : Matrix n n 𝕜}
(hA : A.IsHermitian)
:
theorem
Matrix.IsHermitian.eigenvectorMatrix_mul_conjTranspose
{n : Type u_1}
{𝕜 : Type u_2}
[RCLike 𝕜]
[Fintype n]
[DecidableEq n]
{A : Matrix n n 𝕜}
(hA : A.IsHermitian)
:
theorem
Matrix.IsHermitian.trace_eq
{𝕜 : Type u_1}
{n : Type u_2}
[RCLike 𝕜]
[Fintype n]
[DecidableEq n]
{A : Matrix n n 𝕜}
(hA : A.IsHermitian)
:
theorem
LinearMap.IsSymmetric.eigenvalue_mem_spectrum
{𝕜 : Type u_1}
{n : Type u_2}
[RCLike 𝕜]
[Fintype n]
{E : Type u_3}
[NormedAddCommGroup E]
[InnerProductSpace 𝕜 E]
[FiniteDimensional 𝕜 E]
{A : E →ₗ[𝕜] E}
(hn : Module.finrank 𝕜 E = Fintype.card n)
(hA : A.IsSymmetric)
(i : Fin (Fintype.card n))
:
theorem
Matrix.IsHermitian.eigenvalues_hasEigenvalue
{𝕜 : Type u_1}
{n : Type u_2}
[RCLike 𝕜]
[Fintype n]
[DecidableEq n]
{M : Matrix n n 𝕜}
(hM : M.IsHermitian)
(i : n)
:
Module.End.HasEigenvalue (toEuclideanLin M) ↑(hM.eigenvalues i)
theorem
Matrix.IsHermitian.hasEigenvector_eigenvectorBasis
{𝕜 : Type u_1}
{n : Type u_2}
[RCLike 𝕜]
[Fintype n]
[DecidableEq n]
{M : Matrix n n 𝕜}
(hM : M.IsHermitian)
(i : n)
:
Module.End.HasEigenvector (toEuclideanLin M) (↑(hM.eigenvalues i)) (hM.eigenvectorBasis i)
theorem
Matrix.IsHermitian.apply_eigenvectorBasis
{𝕜 : Type u_1}
{n : Type u_2}
[RCLike 𝕜]
[Fintype n]
[DecidableEq n]
{M : Matrix n n 𝕜}
(hM : M.IsHermitian)
(i : n)
:
theorem
Matrix.kmul_representation
{R : Type u_1}
{n₁ : Type u_2}
{n₂ : Type u_3}
[Fintype n₁]
[Fintype n₂]
[DecidableEq n₁]
[DecidableEq n₂]
[Semiring R]
(x : Matrix (n₁ × n₂) (n₁ × n₂) R)
:
Expand a square matrix indexed by a product as a sum of Kronecker products of matrix units.
theorem
Matrix.kronecker_conjTranspose
{R : Type u_1}
{m : Type u_2}
{n : Type u_3}
[CommSemiring R]
[StarRing R]
(x : Matrix n n R)
(y : Matrix m m R)
:
(kroneckerMap (fun (x1 x2 : R) => x1 * x2) x y).conjTranspose = kroneckerMap (fun (x1 x2 : R) => x1 * x2) x.conjTranspose y.conjTranspose
theorem
Matrix.kronecker_star
{R : Type u_1}
{n : Type u_2}
[CommSemiring R]
[StarRing R]
(x y : Matrix n n R)
:
star (kroneckerMap (fun (x1 x2 : R) => x1 * x2) x y) = kroneckerMap (fun (x1 x2 : R) => x1 * x2) (star x) (star y)
theorem
Matrix.kronecker.star
{R : Type u_1}
{n : Type u_2}
[CommSemiring R]
[StarRing R]
(x y : Matrix n n R)
:
Star.star (kroneckerMap (fun (x1 x2 : R) => x1 * x2) x y) = kroneckerMap (fun (x1 x2 : R) => x1 * x2) (Star.star x) (Star.star y)
theorem
Matrix.kronecker_transpose
{R : Type u_1}
{n : Type u_2}
[CommSemiring R]
(x y : Matrix n n R)
:
(kroneckerMap (fun (x1 x2 : R) => x1 * x2) x y).transpose = kroneckerMap (fun (x1 x2 : R) => x1 * x2) x.transpose y.transpose
theorem
Matrix.kronecker.transpose
{R : Type u_1}
{n : Type u_2}
[CommSemiring R]
(x y : Matrix n n R)
:
(kroneckerMap (fun (x1 x2 : R) => x1 * x2) x y).transpose = kroneckerMap (fun (x1 x2 : R) => x1 * x2) x.transpose y.transpose
theorem
Matrix.kronecker_conj
{R : Type u_1}
{n : Type u_2}
[CommSemiring R]
[StarRing R]
(x y : Matrix n n R)
:
(kroneckerMap (fun (x1 x2 : R) => x1 * x2) x y).conj = kroneckerMap (fun (x1 x2 : R) => x1 * x2) x.conj y.conj
theorem
Matrix.kronecker.conj
{R : Type u_1}
{n : Type u_2}
[CommSemiring R]
[StarRing R]
(x y : Matrix n n R)
:
(kroneckerMap (fun (x1 x2 : R) => x1 * x2) x y).conj = kroneckerMap (fun (x1 x2 : R) => x1 * x2) x.conj y.conj
theorem
Matrix.unitaryGroup.coe_mk
{n : Type u_1}
{𝕜 : Type u_2}
[RCLike 𝕜]
[Fintype n]
[DecidableEq n]
(x : Matrix n n 𝕜)
(hx : x ∈ unitaryGroup n 𝕜)
:
theorem
kmul_representation
{R : Type u_1}
{n₁ : Type u_2}
{n₂ : Type u_3}
[Fintype n₁]
[Fintype n₂]
[DecidableEq n₁]
[DecidableEq n₂]
[Semiring R]
(x : Matrix (n₁ × n₂) (n₁ × n₂) R)
:
x = ∑ i : n₁,
∑ j : n₁,
∑ k : n₂,
∑ l : n₂,
x (i, k) (j, l) • Matrix.kroneckerMap (fun (x1 x2 : R) => x1 * x2) (Matrix.single i j 1) (Matrix.single k l 1)
@[implicit_reducible]
noncomputable instance
EuclideanSpace.instInnerPi
{n : Type u_1}
{𝕜 : Type u_2}
[RCLike 𝕜]
[Fintype n]
:
Inner 𝕜 (n → 𝕜)
Equations
- EuclideanSpace.instInnerPi = { inner := fun (x y : n → 𝕜) => inner 𝕜 ((EuclideanSpace.equiv n 𝕜).symm x) ((EuclideanSpace.equiv n 𝕜).symm y) }
theorem
EuclideanSpace.rankOne_of_orthonormalBasis_eq_one
{n : Type u_1}
{𝕜 : Type u_2}
[RCLike 𝕜]
[Fintype n]
(h : OrthonormalBasis n 𝕜 (EuclideanSpace 𝕜 n))
:
theorem
Matrix.single_conjTranspose
{R : Type u_1}
{n : Type u_2}
{m : Type u_3}
[Semiring R]
[StarAddMonoid R]
[DecidableEq n]
[DecidableEq m]
(i : n)
(j : m)
(a : R)
:
theorem
Matrix.single.star_apply
{R : Type u_1}
{n : Type u_2}
{m : Type u_3}
[Semiring R]
[StarAddMonoid R]
[DecidableEq n]
[DecidableEq m]
(i k : n)
(j l : m)
(a : R)
:
theorem
Matrix.single.star_apply'
{R : Type u_3}
{n : Type u_1}
{m : Type u_2}
[Semiring R]
[StarAddMonoid R]
[DecidableEq n]
[DecidableEq m]
(i : n)
(j : m)
(x : n × m)
(a : R)
:
theorem
Matrix.single.star_one
{n : Type u_2}
{m : Type u_3}
[DecidableEq n]
[DecidableEq m]
{R : Type u_1}
[Semiring R]
[StarRing R]
(i : n)
(j : m)
:
The conjugate transpose of a standard matrix unit.
theorem
Matrix.trace_iff
{R : Type u_1}
{n : Type u_2}
[AddCommMonoid R]
[Fintype n]
(x : Matrix n n R)
:
theorem
Matrix.single.hMul_apply_basis
{n : Type u_4}
{m : Type u_5}
[DecidableEq n]
[DecidableEq m]
{R : Type u_1}
{p : Type u_2}
{q : Type u_3}
[Semiring R]
[DecidableEq p]
[DecidableEq q]
(i x : n)
(j y : m)
(k z : p)
(l w : q)
:
theorem
Matrix.single.mul_apply_basis'
{n : Type u_4}
{m : Type u_5}
[DecidableEq n]
[DecidableEq m]
{R : Type u_1}
{p : Type u_2}
{q : Type u_3}
[Semiring R]
[DecidableEq p]
[DecidableEq q]
(i x : n)
(j y : m)
(k z : p)
(l w : q)
:
theorem
Matrix.single.hMul_apply
{n : Type u_2}
[DecidableEq n]
{R : Type u_1}
[Fintype n]
[Semiring R]
(i j k l m p : n)
:
∑ x : n × n,
∑ x_1 : n × n,
∑ x_2 : n,
∑ x_3 : n, single l k (single p m 1 x_1.2 x_1.1) x.2 x.1 * single i x_2 (single x_3 j 1 x_1.1 x_1.2) x.1 x.2 = ∑ x : n × n,
∑ x_1 : n × n,
∑ x_2 : n,
∑ x_3 : n,
if p = x_1.2 ∧ m = x_1.1 ∧ l = x.2 ∧ k = x.1 ∧ x_3 = x_1.1 ∧ j = x_1.2 ∧ i = x.1 ∧ x_2 = x.2 then 1 else 0
theorem
Matrix.single.sum_star_hMul_self
{R : Type u_2}
{n : Type u_1}
[Semiring R]
[StarAddMonoid R]
[DecidableEq n]
[Fintype n]
(i j : n)
(a b : R)
:
theorem
Matrix.transposeAlgEquiv_symm_op_apply
{n : Type u_1}
{R : Type u_2}
{α : Type u_3}
[CommSemiring R]
[CommSemiring α]
[Fintype n]
[DecidableEq n]
[Algebra R α]
(x : Matrix n n α)
:
theorem
Matrix.dotProduct_eq_trace
{R : Type u_1}
{n : Type u_2}
[CommSemiring R]
[StarRing R]
[Fintype n]
(x : n → R)
(y : Matrix n n R)
:
star x ⬝ᵥ y.mulVec x = ((replicateCol (Fin 1) x * replicateRow (Fin 1) (star x)).conjTranspose * y).trace
@[reducible]
def
LinearEquiv.toInvertibleMatrix
{n : Type u_1}
{R : Type u_2}
[CommSemiring R]
[Fintype n]
[DecidableEq n]
(x : (n → R) ≃ₗ[R] n → R)
:
A linear equivalence of R^n gives an invertible matrix.
Equations
- x.toInvertibleMatrix = { invOf := LinearMap.toMatrix' ↑x.symm, invOf_mul_self := ⋯, mul_invOf_self := ⋯ }