Linear maps and matrices #
This file defines the maps to send matrices to a linear map, and to send linear maps between modules with a finite bases to matrices. This defines a linear equivalence between linear maps between finite-dimensional vector spaces and matrices indexed by the respective bases.
Main definitions #
In the list below, and in all this file, R
is a commutative ring (semiring
is sometimes enough), M
and its variations are R
-modules, ι
, κ
, n
and m
are finite
types used for indexing.
LinearMap.toMatrix
: given basesv₁ : ι → M₁
andv₂ : κ → M₂
, theR
-linear equivalence fromM₁ →ₗ[R] M₂
toMatrix κ ι R
Matrix.toLin
: the inverse ofLinearMap.toMatrix
LinearMap.toMatrix'
: theR
-linear equivalence from(m → R) →ₗ[R] (n → R)
toMatrix m n R
(with the standard basis onm → R
andn → R
)Matrix.toLin'
: the inverse ofLinearMap.toMatrix'
algEquivMatrix
: given a basis indexed byn
, theR
-algebra equivalence betweenR
-endomorphisms ofM
andMatrix n n R
Issues #
This file was originally written without attention to non-commutative rings, and so mostly only works in the commutative setting. This should be fixed.
In particular, Matrix.mulVec
gives us a linear equivalence
Matrix m n R ≃ₗ[R] (n → R) →ₗ[Rᵐᵒᵖ] (m → R)
while Matrix.vecMul
gives us a linear equivalence
Matrix m n R ≃ₗ[Rᵐᵒᵖ] (m → R) →ₗ[R] (n → R)
.
At present, the first equivalence is developed in detail but only for commutative rings
(and we omit the distinction between Rᵐᵒᵖ
and R
),
while the second equivalence is developed only in brief, but for not-necessarily-commutative rings.
Naming is slightly inconsistent between the two developments.
In the original (commutative) development linear
is abbreviated to lin
,
although this is not consistent with the rest of mathlib.
In the new (non-commutative) development linear
is not abbreviated, and declarations use _right
to indicate they use the right action of matrices on vectors (via Matrix.vecMul
).
When the two developments are made uniform, the names should be made uniform, too,
by choosing between linear
and lin
consistently,
and (presumably) adding _left
where necessary.
Tags #
linear_map, matrix, linear_equiv, diagonal, det, trace
Matrix.vecMul M
is a linear map.
Equations
- Matrix.vecMulLinear M = { toAddHom := { toFun := fun (x : m → R) => Matrix.vecMul x M, map_add' := ⋯ }, map_smul' := ⋯ }
Instances For
Linear maps (m → R) →ₗ[R] (n → R)
are linearly equivalent over Rᵐᵒᵖ
to Matrix m n R
,
by having matrices act by right multiplication.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A Matrix m n R
is linearly equivalent over Rᵐᵒᵖ
to a linear map (m → R) →ₗ[R] (n → R)
,
by having matrices act by right multiplication.
Equations
- Matrix.toLinearMapRight' = LinearEquiv.symm LinearMap.toMatrixRight'
Instances For
If M
and M'
are each other's inverse matrices, they provide an equivalence between n → A
and m → A
corresponding to M.vecMul
and M'.vecMul
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
From this point on, we only work with commutative rings,
and fail to distinguish between Rᵐᵒᵖ
and R
.
This should eventually be remedied.
Matrix.mulVec M
is a linear map.
Equations
- Matrix.mulVecLin M = { toAddHom := { toFun := Matrix.mulVec M, map_add' := ⋯ }, map_smul' := ⋯ }
Instances For
A variant of Matrix.mulVecLin_submatrix
that keeps around LinearEquiv
s.
Linear maps (n → R) →ₗ[R] (m → R)
are linearly equivalent to Matrix m n R
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A Matrix m n R
is linearly equivalent to a linear map (n → R) →ₗ[R] (m → R)
.
Note that the forward-direction does not require DecidableEq
and is Matrix.vecMulLin
.
Equations
- Matrix.toLin' = LinearEquiv.symm LinearMap.toMatrix'
Instances For
A variant of Matrix.toLin'_submatrix
that keeps around LinearEquiv
s.
Shortcut lemma for Matrix.toLin'_mul
and LinearMap.comp_apply
If M
and M'
are each other's inverse matrices, they provide an equivalence between m → A
and n → A
corresponding to M.mulVec
and M'.mulVec
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Linear maps (n → R) →ₗ[R] (n → R)
are algebra equivalent to Matrix n n R
.
Equations
- LinearMap.toMatrixAlgEquiv' = AlgEquiv.ofLinearEquiv LinearMap.toMatrix' ⋯ ⋯
Instances For
A Matrix n n R
is algebra equivalent to a linear map (n → R) →ₗ[R] (n → R)
.
Equations
- Matrix.toLinAlgEquiv' = AlgEquiv.symm LinearMap.toMatrixAlgEquiv'
Instances For
Given bases of two modules M₁
and M₂
over a commutative ring R
, we get a linear
equivalence between linear maps M₁ →ₗ M₂
and matrices over R
indexed by the bases.
Equations
- LinearMap.toMatrix v₁ v₂ = LinearEquiv.trans (LinearEquiv.arrowCongr (Basis.equivFun v₁) (Basis.equivFun v₂)) LinearMap.toMatrix'
Instances For
LinearMap.toMatrix'
is a particular case of LinearMap.toMatrix
, for the standard basis
Pi.basisFun R n
.
Given bases of two modules M₁
and M₂
over a commutative ring R
, we get a linear
equivalence between matrices over R
indexed by the bases and linear maps M₁ →ₗ M₂
.
Equations
- Matrix.toLin v₁ v₂ = LinearEquiv.symm (LinearMap.toMatrix v₁ v₂)
Instances For
Matrix.toLin'
is a particular case of Matrix.toLin
, for the standard basis
Pi.basisFun R n
.
This will be a special case of LinearMap.toMatrix_id_eq_basis_toMatrix
.
Shortcut lemma for Matrix.toLin_mul
and LinearMap.comp_apply
.
If M
and M
are each other's inverse matrices, Matrix.toLin M
and Matrix.toLin M'
form a linear equivalence.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Given a basis of a module M₁
over a commutative ring R
, we get an algebra
equivalence between linear maps M₁ →ₗ M₁
and square matrices over R
indexed by the basis.
Equations
- LinearMap.toMatrixAlgEquiv v₁ = AlgEquiv.ofLinearEquiv (LinearMap.toMatrix v₁ v₁) ⋯ ⋯
Instances For
Given a basis of a module M₁
over a commutative ring R
, we get an algebra
equivalence between square matrices over R
indexed by the basis and linear maps M₁ →ₗ M₁
.
Equations
Instances For
leftMulMatrix b x
is the matrix corresponding to the linear map fun y ↦ x * y
.
leftMulMatrix_eq_repr_mul
gives a formula for the entries of leftMulMatrix
.
This definition is useful for doing (more) explicit computations with LinearMap.mulLeft
,
such as the trace form or norm map for algebras.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The natural equivalence between linear endomorphisms of finite free modules and square matrices is compatible with the algebra structures.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A linear equivalence of two modules induces an equivalence of algebras of their endomorphisms.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A basis of a module induces an equivalence of algebras from the endomorphisms of the module to square matrices.
Equations
- algEquivMatrix h = AlgEquiv.trans (LinearEquiv.algConj (Basis.equivFun h)) algEquivMatrix'