Bases #
This file defines bases in a module or vector space.
It is inspired by Isabelle/HOL's linear algebra, and hence indirectly by HOL Light.
Main definitions #
All definitions are given for families of vectors, i.e. v : ι → M
where M
is the module or
vector space and ι : Type*
is an arbitrary indexing type.
Basis ι R M
is the type ofι
-indexedR
-bases for a moduleM
, represented by a linear equivM ≃ₗ[R] ι →₀ R
.the basis vectors of a basis
b : Basis ι R M
are available asb i
, wherei : ι
Basis.repr
is the isomorphism sendingx : M
to its coordinatesBasis.repr x : ι →₀ R
. The converse, turning this isomorphism into a basis, is calledBasis.ofRepr
.If
ι
is finite, there is a variant ofrepr
calledBasis.equivFun b : M ≃ₗ[R] ι → R
(saving you from having to work withFinsupp
). The converse, turning this isomorphism into a basis, is calledBasis.ofEquivFun
.Basis.constr b R f
constructs a linear mapM₁ →ₗ[R] M₂
given the valuesf : ι → M₂
at the basis elements⇑b : ι → M₁
.Basis.reindex
uses an equiv to map a basis to a different indexing set.Basis.map
uses a linear equiv to map a basis to a different module.
Main statements #
Basis.mk
: a linear independent set of vectors spanning the whole module determines a basisBasis.ext
states that two linear maps are equal if they coincide on a basis. Similar results are available for linear equivs (if they coincide on the basis vectors), elements (if their coordinates coincide) and the functionsb.repr
and⇑b
.
Implementation notes #
We use families instead of sets because it allows us to say that two identical vectors are linearly
dependent. For bases, this is useful as well because we can easily derive ordered bases by using an
ordered index type ι
.
Tags #
basis, bases
A Basis ι R M
for a module M
is the type of ι
-indexed R
-bases of M
.
The basis vectors are available as DFunLike.coe (b : Basis ι R M) : ι → M
.
To turn a linear independent family of vectors spanning M
into a basis, use Basis.mk
.
They are internally represented as linear equivs M ≃ₗ[R] (ι →₀ R)
,
available as Basis.repr
.
- ofRepr :: (
repr
is the linear equivalence sending a vectorx
to its coordinates: thec
s such thatx = ∑ i, c i
.- )
Instances For
Equations
- uniqueBasis = { default := { repr := default }, uniq := ⋯ }
b i
is the i
th basis vector.
Equations
- Basis.instFunLike = { coe := fun (b : Basis ι R M) (i : ι) => b.repr.symm (Finsupp.single i 1), coe_injective' := ⋯ }
b.coord i
is the linear function giving the i
'th coordinate of a vector
with respect to the basis b
.
b.coord i
is an element of the dual space. In particular, for
finite-dimensional spaces it is the ι
th basis vector of the dual space.
Equations
- b.coord i = Finsupp.lapply i ∘ₗ ↑b.repr
Instances For
The sum of the coordinates of an element m : M
with respect to a basis.
Equations
- b.sumCoords = ((Finsupp.lsum ℕ) fun (x : ι) => LinearMap.id) ∘ₗ ↑b.repr
Instances For
Two linear maps are equal if they are equal on basis vectors.
Two linear equivs are equal if they are equal on basis vectors.
Alias of the reverse direction of Basis.ext_elem_iff
.
Two elements are equal iff their coordinates are equal.
An unbundled version of repr_eq_iff
Apply the linear equivalence f
to the basis vectors.
Equations
- b.map f = { repr := f.symm ≪≫ₗ b.repr }
Instances For
The action on a Basis
by acting on each element.
See also Basis.unitsSMul
and Basis.groupSMul
, for the cases when a different action is applied
to each basis element.
Equations
- Basis.instSMul = { smul := fun (g : G) (b : Basis ι R M) => b.map (DistribMulAction.toLinearEquiv R M g) }
Equations
- Basis.instMulAction = Function.Injective.mulAction (fun (f : Basis ι R M) => ⇑f) ⋯ ⋯
Equations
- ⋯ = ⋯
Equations
- ⋯ = ⋯
If R
and R'
are isomorphic rings that act identically on a module M
,
then a basis for M
as R
-module is also a basis for M
as R'
-module.
See also Basis.algebraMapCoeffs
for the case where f
is equal to algebraMap
.
Equations
- b.mapCoeffs f h = { repr := LinearEquiv.restrictScalars R' b.repr ≪≫ₗ Finsupp.mapRange.linearEquiv (Module.compHom.toLinearEquiv f.symm).symm }
Instances For
b.reindex (e : ι ≃ ι')
is a basis indexed by ι'
Equations
- b.reindex e = { repr := b.repr ≪≫ₗ Finsupp.domLCongr e }
Instances For
simp
can prove this as Basis.coe_reindex
+ EquivLike.range_comp
b.reindex_range
is a basis indexed by range b
, the basis vectors themselves.
Equations
- b.reindexRange = if h : Nontrivial R then b.reindex (Equiv.ofInjective ⇑b ⋯) else { repr := Module.subsingletonEquiv R M ↑(Set.range ⇑b) }
Instances For
b.reindexFinsetRange
is a basis indexed by Finset.univ.image b
,
the finite set of basis vectors themselves.
Equations
- b.reindexFinsetRange = b.reindexRange.reindex ((Equiv.refl M).subtypeEquiv ⋯)
Instances For
If the submodule P
has a basis, x ∈ P
iff it is a linear combination of basis vectors.
Construct a linear map given the value at the basis, called Basis.constr b S f
where b
is
a basis, f
is the value of the linear map over the elements of the basis, and S
is an
extra semiring (typically S = R
or S = ℕ
).
This definition is parameterized over an extra Semiring S
,
such that SMulCommClass R S M'
holds.
If R
is commutative, you can set S := R
; if R
is not commutative,
you can recover an AddEquiv
by setting S := ℕ
.
See library note [bundled maps over different rings].
Equations
- One or more equations did not get rendered due to their size.
Instances For
If b
is a basis for M
and b'
a basis for M'
, and the index types are equivalent,
b.equiv b' e
is a linear equivalence M ≃ₗ[R] M'
, mapping b i
to b' (e i)
.
Equations
- b.equiv b' e = b.repr ≪≫ₗ (b'.reindex e.symm).repr.symm
Instances For
Basis.prod
maps an ι
-indexed basis for M
and an ι'
-indexed basis for M'
to an ι ⊕ ι'
-index basis for M × M'
.
For the specific case of R × R
, see also Basis.finTwoProd
.
Equations
- b.prod b' = { repr := b.repr.prod b'.repr ≪≫ₗ (Finsupp.sumFinsuppLEquivProdFinsupp R).symm }
Instances For
Basis.singleton ι R
is the basis sending the unique element of ι
to 1 : R
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
If M
is a subsingleton and ι
is empty, this is the unique ι
-indexed basis for M
.
Equations
- Basis.empty M = { repr := 0 }
Instances For
Equations
- Basis.emptyUnique M = { default := Basis.empty M, uniq := ⋯ }
A module over R
with a finite basis is linearly equivalent to functions from its basis to R
.
Equations
- b.equivFun = b.repr ≪≫ₗ let __src := Finsupp.equivFunOnFinite; { toFun := DFunLike.coe, map_add' := ⋯, map_smul' := ⋯, invFun := __src.invFun, left_inv := ⋯, right_inv := ⋯ }
Instances For
A module over a finite ring that admits a finite basis is finite.
Equations
- Module.fintypeOfFintype b = Fintype.ofEquiv (ι → R) b.equivFun.toEquiv.symm
Instances For
Given a basis v
indexed by ι
, the canonical linear equivalence between ι → R
and M
maps
a function x : ι → R
to the linear combination ∑_i x i • v i
.
Define a basis by mapping each vector x : M
to its coordinates e x : ι → R
,
as long as ι
is finite.
Equations
- Basis.ofEquivFun e = { repr := e ≪≫ₗ (Finsupp.linearEquivFunOnFinite R R ι).symm }
Instances For
If the submodule P
has a finite basis,
x ∈ P
iff it is a linear combination of basis vectors.
If b
is a basis for M
and b'
a basis for M'
,
and f
, g
form a bijection between the basis vectors,
b.equiv' b' f g hf hg hgf hfg
is a linear equivalence M ≃ₗ[R] M'
, mapping b i
to f (b i)
.
Equations
Instances For
Any basis is a maximal linear independent set.
A linear independent family of vectors spanning the whole module is a basis.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Given a basis, the i
th element of the dual basis evaluates to 1 on the i
th element of the
basis.
Given a basis, the i
th element of the dual basis evaluates to 0 on the j
th element of the
basis if j ≠ i
.
Given a basis, the i
th element of the dual basis evaluates to the Kronecker delta on the
j
th element of the basis.
A linear independent family of vectors is a basis for their span.
Equations
- Basis.span hli = Basis.mk ⋯ ⋯
Instances For
Given a basis v
and a map w
such that for all i
, w i
are elements of a group,
groupSMul
provides the basis corresponding to w • v
.
Instances For
Let b
be a basis for a submodule N
of M
. If y : M
is linear independent of N
and y
and N
together span the whole of M
, then there is a basis for M
whose basis vectors are given by Fin.cons y b
.
Equations
- Basis.mkFinCons y b hli hsp = let_fun span_b := ⋯; Basis.mk ⋯ ⋯
Instances For
Let b
be a basis for a submodule N ≤ O
. If y ∈ O
is linear independent of N
and y
and N
together span the whole of O
, then there is a basis for O
whose basis vectors are given by Fin.cons y b
.
Equations
- Basis.mkFinConsOfLE y yO b hNO hli hsp = Basis.mkFinCons ⟨y, yO⟩ (b.map (Submodule.comapSubtypeEquivOfLe hNO).symm) ⋯ ⋯
Instances For
The basis of R × R
given by the two vectors (1, 0)
and (0, 1)
.
Equations
- Basis.finTwoProd R = Basis.ofEquivFun (LinearEquiv.finTwoArrow R R).symm
Instances For
If N
is a submodule with finite rank, do induction on adjoining a linear independent
element to a submodule.
Equations
- One or more equations did not get rendered due to their size.
Instances For
An element of a non-unital-non-associative algebra is in the center exactly when it commutes with the basis elements.
Let b
be an S
-basis of M
. Let R
be a CommRing such that Algebra R S
has no zero smul
divisors, then the submodule of M
spanned by b
over R
admits b
as an R
-basis.
Equations
- Basis.restrictScalars R b = Basis.span ⋯
Instances For
Let b
be an S
-basis of M
. Then m : M
lies in the R
-module spanned by b
iff all the
coordinates of m
on the basis b
are in R
(see Basis.mem_span
for the case R = S
).
Over any nontrivial ring, the existence of a finite spanning set implies that any basis is finite.
Over any ring R
, if b
is a basis for a module M
,
and s
is a maximal linearly independent set,
then the union of the supports of x ∈ s
(when written out in the basis b
) is all of b
.
Over any ring R
, if b
is an infinite basis for a module M
,
and s
is a maximal linearly independent set,
then the cardinality of b
is bounded by the cardinality of s
.
Over any ring R
, if b
is an infinite basis for a module M
,
and s
is a maximal linearly independent set,
then the cardinality of b
is bounded by the cardinality of s
.