Linear algebra #
This file defines the basics of linear algebra. It sets up the "categorical/lattice structure" of modules over a ring, submodules, and linear maps.
Many of the relevant definitions, including module
, submodule
, and linear_map
, are found in
src/algebra/module
.
Main definitions #
- Many constructors for (semi)linear maps
- The kernel
ker
and rangerange
of a linear map are submodules of the domain and codomain respectively. - The general linear group is defined to be the group of invertible linear maps from
M
to itself.
See linear_algebra.span
for the span of a set (as a submodule),
and linear_algebra.quotient
for quotients by submodules.
Main theorems #
See linear_algebra.isomorphisms
for Noether's three isomorphism theorems for modules.
Notations #
- We continue to use the notations
M →ₛₗ[σ] M₂
andM →ₗ[R] M₂
for the type of semilinear (resp. linear) maps fromM
toM₂
over the ring homomorphismσ
(resp. over the ringR
).
Implementation notes #
We note that, when constructing linear maps, it is convenient to use operations defined on bundled
maps (linear_map.prod
, linear_map.coprod
, arithmetic operations like +
) instead of defining a
function and proving it is linear.
TODO #
- Parts of this file have not yet been generalized to semilinear maps
Tags #
linear algebra, vector space, module
Given fintype α
, linear_equiv_fun_on_fintype R
is the natural R
-linear equivalence between
α →₀ β
and α → β
.
Equations
- finsupp.linear_equiv_fun_on_fintype R M α = {to_fun := coe_fn finsupp.has_coe_to_fun, map_add' := _, map_smul' := _, inv_fun := finsupp.equiv_fun_on_fintype.inv_fun, left_inv := _, right_inv := _}
Properties of linear maps #
The restriction of a linear map f : M → M₂
to a submodule p ⊆ M
gives a linear map
p → M₂
.
Equations
- f.dom_restrict p = f.comp p.subtype
A linear map f : M₂ → M
whose values lie in a submodule p ⊆ M
can be restricted to a
linear map M₂ → p.
Restrict domain and codomain of an endomorphism.
Equations
- f.restrict hf = linear_map.cod_restrict p (f.dom_restrict p) _
Equations
- linear_map.unique_of_left = {to_inhabited := {default := default linear_map.inhabited}, uniq := _}
Evaluation of a σ₁₂
-linear map at a fixed a
, as an add_monoid_hom
.
linear_map.to_add_monoid_hom
promoted to an add_monoid_hom
Equations
- linear_map.to_add_monoid_hom' = {to_fun := linear_map.to_add_monoid_hom σ₁₂, map_zero' := _, map_add' := _}
When f
is an R
-linear map taking values in S
, then λb, f b • x
is an R
-linear map.
A linear map f
applied to x : ι → R
can be computed using the image under f
of elements
of the canonical basis.
Applying a linear map at v : M
, seen as S
-linear map from M →ₗ[R] M₂
to M₂
.
See linear_map.applyₗ
for a version where S = R
.
The equivalence between R-linear maps from R
to M
, and points of M
itself.
This says that the forgetful functor from R
-modules to types is representable, by R
.
This as an S
-linear equivalence, under the assumption that S
acts on M
commuting with R
.
When R
is commutative, we can take this to be the usual action with S = R
.
Otherwise, S = ℕ
shows that the equivalence is additive.
See note [bundled maps over different rings].
Composition by f : M₂ → M₃
is a linear map from the space of linear maps M → M₂
to the space of linear maps M₂ → M₃
.
Applying a linear map at v : M
, seen as a linear map from M →ₗ[R] M₂
to M₂
.
See also linear_map.applyₗ'
for a version that works with two different semirings.
This is the linear_map
version of add_monoid_hom.eval
.
Alternative version of dom_restrict
as a linear map.
Equations
- linear_map.dom_restrict' p = {to_fun := λ (φ : M →ₗ[R] M₂), φ.dom_restrict p, map_add' := _, map_smul' := _}
The family of linear maps M₂ → M
parameterised by f ∈ M₂ → R
, x ∈ M
, is linear in f
, x
.
The R
-linear equivalence between additive morphisms A →+ B
and ℕ
-linear morphisms A →ₗ[ℕ] B
.
Equations
- add_monoid_hom_lequiv_nat R = {to_fun := add_monoid_hom.to_nat_linear_map _inst_3, map_add' := _, map_smul' := _, inv_fun := linear_map.to_add_monoid_hom (ring_hom.id ℕ), left_inv := _, right_inv := _}
The R
-linear equivalence between additive morphisms A →+ B
and ℤ
-linear morphisms A →ₗ[ℤ] B
.
Equations
- add_monoid_hom_lequiv_int R = {to_fun := add_monoid_hom.to_int_linear_map _inst_3, map_add' := _, map_smul' := _, inv_fun := linear_map.to_add_monoid_hom (ring_hom.id ℤ), left_inv := _, right_inv := _}
Properties of submodules #
If two submodules p
and p'
satisfy p ⊆ p'
, then of_le p p'
is the linear map version of
this inclusion.
Equations
- submodule.of_le h = linear_map.cod_restrict p' p.subtype _
Equations
- submodule.unique = {to_inhabited := {default := ⊥}, uniq := _}
Equations
The pushforward of a submodule p ⊆ M
by f : M → M₂
The pushforward of a submodule by an injective linear map is
linearly equivalent to the original submodule. See also linear_equiv.submodule_map
for a
computable version when f
has an explicit inverse.
The pullback of a submodule p ⊆ M₂
along f : M → M₂
map f
and comap f
form a galois_insertion
when f
is surjective.
Equations
map f
and comap f
form a galois_coinsertion
when f
is injective.
Equations
The infimum of a family of invariant submodule of an endomorphism is also an invariant submodule.
Properties of linear maps #
The range of a linear map f : M → M₂
is a submodule of M₂
.
See Note [range copy pattern].
The decreasing sequence of submodules consisting of the ranges of the iterates of a linear map.
Restrict the codomain of a linear map f
to f.range
.
This is the bundled version of set.range_factorization
.
Equations
- f.range_restrict = linear_map.cod_restrict f.range f _
The range of a linear map is finite if the domain is finite.
Note: this instance can form a diamond with subtype.fintype
in the
presence of fintype M₂
.
Equations
The kernel of a linear map f : M → M₂
is defined to be comap f ⊥
. This is equivalent to the
set of x : M
such that f x = 0
. The kernel is a submodule of M
.
Equations
- f.ker = submodule.comap f ⊥
The increasing sequence of submodules consisting of the kernels of the iterates of a linear map.
Under the canonical linear map from a submodule p
to the ambient space M
, the image of the
maximal submodule of p
is just p
.
If N ⊆ M
then submodules of N
are the same as submodules of M
contained in N
Equations
- submodule.map_subtype.rel_iso p = {to_equiv := {to_fun := λ (p' : submodule R ↥p), ⟨submodule.map p.subtype p', _⟩, inv_fun := λ (q : {p' // p' ≤ p}), submodule.comap p.subtype ↑q, left_inv := _, right_inv := _}, map_rel_iff' := _}
If p ⊆ M
is a submodule, the ordering of submodules of p
is embedded in the ordering of
submodules of M
.
Equations
- submodule.map_subtype.order_embedding p = (rel_iso.to_rel_embedding (submodule.map_subtype.rel_iso p)).trans (subtype.rel_embedding has_le.le (λ (p' : submodule R M), p' ≤ p))
A monomorphism is injective.
If O
is a submodule of M
, and Φ : O →ₗ M'
is a linear map,
then (ϕ : O →ₗ M').submodule_image N
is ϕ(N)
as a submodule of M'
Equations
- ϕ.submodule_image N = submodule.map ϕ (submodule.comap O.subtype N)
Linear equivalences #
Between two zero modules, the zero map is an equivalence.
Between two zero modules, the zero map is the only equivalence.
Equations
- linear_equiv.unique = {to_inhabited := {default := 0}, uniq := _}
A linear equivalence of two modules restricts to a linear equivalence from any submodule
p
of the domain onto the image of that submodule.
This is the linear version of add_equiv.submonoid_map
and add_equiv.subgroup_map
.
This is linear_equiv.of_submodule'
but with map
on the right instead of comap
on the left.
Equations
- e.submodule_map p = {to_fun := (linear_map.cod_restrict (submodule.map ↑e p) (↑e.dom_restrict p) _).to_fun, map_add' := _, map_smul' := _, inv_fun := λ (y : ↥(submodule.map ↑e p)), ⟨⇑↑(e.symm) ↑y, _⟩, left_inv := _, right_inv := _}
Linear equivalence between a curried and uncurried function.
Differs from tensor_product.curry
.
Equations
- linear_equiv.curry R V V₂ = {to_fun := (equiv.curry V V₂ R).to_fun, map_add' := _, map_smul' := _, inv_fun := (equiv.curry V V₂ R).inv_fun, left_inv := _, right_inv := _}
Linear equivalence between two equal submodules.
Equations
- linear_equiv.of_eq p q h = {to_fun := (equiv.set.of_eq _).to_fun, map_add' := _, map_smul' := _, inv_fun := (equiv.set.of_eq _).inv_fun, left_inv := _, right_inv := _}
A linear equivalence which maps a submodule of one module onto another, restricts to a linear equivalence of the two submodules.
Equations
- e.of_submodules p q h = (e.submodule_map p).trans (linear_equiv.of_eq (submodule.map ↑e p) q h)
A linear equivalence of two modules restricts to a linear equivalence from the preimage of any submodule to that submodule.
This is linear_equiv.of_submodule
but with comap
on the left instead of map
on the right.
Equations
- f.of_submodule' U = (f.symm.of_submodules U (submodule.comap ↑(f.symm.symm) U) _).symm
The top submodule of M
is linearly equivalent to M
.
If a linear map has an inverse, it is a linear equivalence.
An linear map f : M →ₗ[R] M₂
with a left-inverse g : M₂ →ₗ[R] M
defines a linear
equivalence between M
and f.range
.
This is a computable alternative to linear_equiv.of_injective
, and a bidirectional version of
linear_map.range_restrict
.
An injective
linear map f : M →ₗ[R] M₂
defines a linear equivalence
between M
and f.range
. See also linear_map.of_left_inverse
.
Equations
A bijective linear map is a linear equivalence.
Equations
- linear_equiv.of_bijective f hf₁ hf₂ = (linear_equiv.of_injective f hf₁).trans (linear_equiv.of_top f.range _)
Multiplying by a unit a
of the ring R
is a linear equivalence.
Equations
A linear isomorphism between the domains and codomains of two spaces of linear maps gives a linear isomorphism between the two function spaces.
If M₂
and M₃
are linearly isomorphic then the two spaces of linear maps from M
into M₂
and M
into M₃
are linearly isomorphic.
Equations
- f.congr_right = (linear_equiv.refl R M).arrow_congr f
If M
and M₂
are linearly isomorphic then the two spaces of linear maps from M
and M₂
to
themselves are linearly isomorphic.
Equations
- e.conj = e.arrow_congr e
Multiplying by a nonzero element a
of the field K
is a linear equivalence.
Equations
- linear_equiv.smul_of_ne_zero K M a ha = linear_equiv.smul_of_unit (units.mk0 a ha)
Given p
a submodule of the module M
and q
a submodule of p
, p.equiv_subtype_map q
is the natural linear_equiv
between q
and q.map p.subtype
.
Equations
- p.equiv_subtype_map q = {to_fun := (linear_map.cod_restrict (submodule.map p.subtype q) (p.subtype.dom_restrict q) _).to_fun, map_add' := _, map_smul' := _, inv_fun := λ (ᾰ : ↥(submodule.map p.subtype q)), subtype.cases_on ᾰ (λ (x : M) (hx : x ∈ submodule.map p.subtype q), ⟨⟨x, _⟩, _⟩), left_inv := _, right_inv := _}
If s ≤ t
, then we can view s
as a submodule of t
by taking the comap
of t.subtype
.
Given modules M
, M₂
over a commutative ring, together with submodules p ⊆ M
, q ⊆ M₂
,
the set of maps $\{f ∈ Hom(M, M₂) | f(p) ⊆ q \}$ is a submodule of Hom(M, M₂)
.
An equivalence whose underlying function is linear is a linear equivalence.
Given an R
-module M
and a function m → n
between arbitrary types,
construct a linear map (n → M) →ₗ[R] (m → M)
Given an R
-module M
and an equivalence m ≃ n
between arbitrary types,
construct a linear equivalence (n → M) ≃ₗ[R] (m → M)
Equations
- linear_equiv.fun_congr_left R M e = linear_equiv.of_linear (linear_map.fun_left R M ⇑e) (linear_map.fun_left R M ⇑(e.symm)) _ _
The group of invertible linear maps from M
to itself
Equations
- linear_map.general_linear_group R M = (M →ₗ[R] M)ˣ
An invertible linear map f
determines an equivalence from M
to itself.
An equivalence from M
to itself determines an invertible linear map.
The general linear group on R
and M
is multiplicatively equivalent to the type of linear
equivalences between M
and itself.
Equations
- linear_map.general_linear_group.general_linear_equiv R M = {to_fun := linear_map.general_linear_group.to_linear_equiv _inst_3, inv_fun := linear_map.general_linear_group.of_linear_equiv _inst_3, left_inv := _, right_inv := _, map_mul' := _}