Tensor product of an indexed family of modules over commutative semirings #
We define the tensor product of an indexed family s : ι → Type*
of modules over commutative
semirings. We denote this space by ⨂[R] i, s i
and define it as FreeAddMonoid (R × Π i, s i)
quotiented by the appropriate equivalence relation. The treatment follows very closely that of the
binary tensor product in LinearAlgebra/TensorProduct.lean
.
Main definitions #
PiTensorProduct R s
withR
a commutative semiring ands : ι → Type*
is the tensor product of all thes i
's. This is denoted by⨂[R] i, s i
.tprod R f
withf : Π i, s i
is the tensor product of the vectorsf i
over alli : ι
. This is bundled as a multilinear map fromΠ i, s i
to⨂[R] i, s i
.liftAddHom
constructs anAddMonoidHom
from(⨂[R] i, s i)
to some spaceF
from a functionφ : (R × Π i, s i) → F
with the appropriate properties.lift φ
withφ : MultilinearMap R s E
is the corresponding linear map(⨂[R] i, s i) →ₗ[R] E
. This is bundled as a linear equivalence.PiTensorProduct.reindex e
re-indexes the components of⨂[R] i : ι, M
alonge : ι ≃ ι₂
.PiTensorProduct.tmulEquiv
equivalence between aTensorProduct
ofPiTensorProduct
s and a singlePiTensorProduct
.
Notations #
⨂[R] i, s i
is defined as localized notation in localeTensorProduct
.⨂ₜ[R] i, f i
withf : ∀ i, s i
is defined globally as the tensor product of all thef i
's.
Implementation notes #
- We define it via
FreeAddMonoid (R × Π i, s i)
with theR
representing a "hidden" tensor factor, rather thanFreeAddMonoid (Π i, s i)
to ensure that, ifι
is an empty type, the space is isomorphic to the base ringR
. - We have not restricted the index type
ι
to be aFintype
, as nothing we do here strictly requires it. However, problems may arise in the case whereι
is infinite; use at your own caution. - Instead of requiring
DecidableEq ι
as an argument toPiTensorProduct
itself, we include it as an argument in the constructors of the relation. A decidability instance still has to come from somewhere due to the use ofFunction.update
, but this hides it from the downstream user. See the implementation notes forMultilinearMap
for an extended discussion of this choice.
TODO #
- Define tensor powers, symmetric subspace, etc.
- API for the various ways
ι
can be split into subsets; connect this with the binary tensor product. - Include connection with holors.
- Port more of the API from the binary tensor product over to this case.
Tags #
multilinear, tensor, tensor product
The relation on FreeAddMonoid (R × Π i, s i)
that generates a congruence whose quotient is
the tensor product.
- of_zero: ∀ {ι : Type u_1} {R : Type u_4} [inst : CommSemiring R] {s : ι → Type u_7} [inst_1 : (i : ι) → AddCommMonoid (s i)] [inst_2 : (i : ι) → Module R (s i)] (r : R) (f : (i : ι) → s i) (i : ι), f i = 0 → PiTensorProduct.Eqv R s (FreeAddMonoid.of (r, f)) 0
- of_zero_scalar: ∀ {ι : Type u_1} {R : Type u_4} [inst : CommSemiring R] {s : ι → Type u_7} [inst_1 : (i : ι) → AddCommMonoid (s i)] [inst_2 : (i : ι) → Module R (s i)] (f : (i : ι) → s i), PiTensorProduct.Eqv R s (FreeAddMonoid.of (0, f)) 0
- of_add: ∀ {ι : Type u_1} {R : Type u_4} [inst : CommSemiring R] {s : ι → Type u_7} [inst_1 : (i : ι) → AddCommMonoid (s i)] [inst_2 : (i : ι) → Module R (s i)] (x : DecidableEq ι) (r : R) (f : (i : ι) → s i) (i : ι) (m₁ m₂ : s i), PiTensorProduct.Eqv R s (FreeAddMonoid.of (r, Function.update f i m₁) + FreeAddMonoid.of (r, Function.update f i m₂)) (FreeAddMonoid.of (r, Function.update f i (m₁ + m₂)))
- of_add_scalar: ∀ {ι : Type u_1} {R : Type u_4} [inst : CommSemiring R] {s : ι → Type u_7} [inst_1 : (i : ι) → AddCommMonoid (s i)] [inst_2 : (i : ι) → Module R (s i)] (r r' : R) (f : (i : ι) → s i), PiTensorProduct.Eqv R s (FreeAddMonoid.of (r, f) + FreeAddMonoid.of (r', f)) (FreeAddMonoid.of (r + r', f))
- of_smul: ∀ {ι : Type u_1} {R : Type u_4} [inst : CommSemiring R] {s : ι → Type u_7} [inst_1 : (i : ι) → AddCommMonoid (s i)] [inst_2 : (i : ι) → Module R (s i)] (x : DecidableEq ι) (r : R) (f : (i : ι) → s i) (i : ι) (r' : R), PiTensorProduct.Eqv R s (FreeAddMonoid.of (r, Function.update f i (r' • f i))) (FreeAddMonoid.of (r' * r, f))
- add_comm: ∀ {ι : Type u_1} {R : Type u_4} [inst : CommSemiring R] {s : ι → Type u_7} [inst_1 : (i : ι) → AddCommMonoid (s i)] [inst_2 : (i : ι) → Module R (s i)] (x y : FreeAddMonoid (R × ((i : ι) → s i))), PiTensorProduct.Eqv R s (x + y) (y + x)
Instances For
PiTensorProduct R s
with R
a commutative semiring and s : ι → Type*
is the tensor
product of all the s i
's. This is denoted by ⨂[R] i, s i
.
Equations
- PiTensorProduct R s = (addConGen (PiTensorProduct.Eqv R s)).Quotient
Instances For
This enables the notation ⨂[R] i : ι, s i
for the pi tensor product PiTensorProduct
,
given an indexed family of types s : ι → Type*
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Pretty printer defined by notation3
command.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- PiTensorProduct.instAddCommMonoid s = let __src := (addConGen (PiTensorProduct.Eqv R s)).addMonoid; AddCommMonoid.mk ⋯
Equations
- PiTensorProduct.instInhabited s = { default := 0 }
tprodCoeff R r f
with r : R
and f : Π i, s i
is the tensor product of the vectors f i
over all i : ι
, multiplied by the coefficient r
. Note that this is meant as an auxiliary
definition for this file alone, and that one should use tprod
defined below for most purposes.
Equations
- PiTensorProduct.tprodCoeff R r f = (addConGen (PiTensorProduct.Eqv R fun (i : ι) => s i)).mk' (FreeAddMonoid.of (r, f))
Instances For
Construct an AddMonoidHom
from (⨂[R] i, s i)
to some space F
from a function
φ : (R × Π i, s i) → F
with the appropriate properties.
Equations
- PiTensorProduct.liftAddHom φ C0 C0' C_add C_add_scalar C_smul = (addConGen (PiTensorProduct.Eqv R s)).lift (FreeAddMonoid.lift φ) ⋯
Instances For
Induct using tprodCoeff
Equations
- PiTensorProduct.hasSMul' = { smul := fun (r : R₁) => ⇑(PiTensorProduct.liftAddHom (fun (f : R × ((i : ι) → s i)) => PiTensorProduct.tprodCoeff R (r • f.1) f.2) ⋯ ⋯ ⋯ ⋯ ⋯) }
Equations
- PiTensorProduct.instSMul = PiTensorProduct.hasSMul'
Equations
- PiTensorProduct.distribMulAction' = DistribMulAction.mk ⋯ ⋯
Equations
- ⋯ = ⋯
Equations
- ⋯ = ⋯
Equations
- PiTensorProduct.instModule = PiTensorProduct.module'
Equations
- ⋯ = ⋯
Equations
- ⋯ = ⋯
The canonical MultilinearMap R s (⨂[R] i, s i)
.
tprod R fun i => f i
has notation ⨂ₜ[R] i, f i
.
Equations
- PiTensorProduct.tprod R = { toFun := PiTensorProduct.tprodCoeff R 1, map_add' := ⋯, map_smul' := ⋯ }
Instances For
The canonical MultilinearMap R s (⨂[R] i, s i)
.
tprod R fun i => f i
has notation ⨂ₜ[R] i, f i
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Pretty printer defined by notation3
command.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The image of an element p
of FreeAddMonoid (R × Π i, s i)
in the PiTensorProduct
is
equal to the sum of a • ⨂ₜ[R] i, m i
over all the entries (a, m)
of p
.
The set of lifts of an element x
of ⨂[R] i, s i
in FreeAddMonoid (R × Π i, s i)
.
Equations
- x.lifts = {p : FreeAddMonoid (R × ((i : ι) → s i)) | ↑p = x}
Instances For
An element p
of FreeAddMonoid (R × Π i, s i)
lifts an element x
of ⨂[R] i, s i
if and only if x
is equal to to the sum of a • ⨂ₜ[R] i, m i
over all the entries
(a, m)
of p
.
Every element of ⨂[R] i, s i
has a lift in FreeAddMonoid (R × Π i, s i)
.
The empty list lifts the element 0
of ⨂[R] i, s i
.
If elements p,q
of FreeAddMonoid (R × Π i, s i)
lift elements x,y
of ⨂[R] i, s i
respectively, then p + q
lifts x + y
.
If an element p
of FreeAddMonoid (R × Π i, s i)
lifts an element x
of ⨂[R] i, s i
,
and if a
is an element of R
, then the list obtained by multiplying the first entry of each
element of p
by a
lifts a • x
.
Induct using scaled versions of PiTensorProduct.tprod
.
The pure tensors (i.e. the elements of the image of PiTensorProduct.tprod
) span
the tensor product.
Auxiliary function to constructing a linear map (⨂[R] i, s i) → E
given a
MultilinearMap R s E
with the property that its composition with the canonical
MultilinearMap R s (⨂[R] i, s i)
is the given multilinear map.
Equations
- PiTensorProduct.liftAux φ = PiTensorProduct.liftAddHom (fun (p : R × ((i : ι) → s i)) => p.1 • φ p.2) ⋯ ⋯ ⋯ ⋯ ⋯
Instances For
Constructing a linear map (⨂[R] i, s i) → E
given a MultilinearMap R s E
with the
property that its composition with the canonical MultilinearMap R s E
is
the given multilinear map φ
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Let sᵢ
and tᵢ
be two families of R
-modules.
Let f
be a family of R
-linear maps between sᵢ
and tᵢ
, i.e. f : Πᵢ sᵢ → tᵢ
,
then there is an induced map ⨂ᵢ sᵢ → ⨂ᵢ tᵢ
by ⨂ aᵢ ↦ ⨂ fᵢ aᵢ
.
This is TensorProduct.map
for an arbitrary family of modules.
Equations
- PiTensorProduct.map f = PiTensorProduct.lift ((PiTensorProduct.tprod R).compLinearMap f)
Instances For
Given submodules p i ⊆ s i
, this is the natural map: ⨂[R] i, p i → ⨂[R] i, s i
.
This is TensorProduct.mapIncl
for an arbitrary family of modules.
Equations
- PiTensorProduct.mapIncl p = PiTensorProduct.map fun (i : ι) => (p i).subtype
Instances For
Upgrading PiTensorProduct.map
to a MonoidHom
when s = t
.
Equations
- PiTensorProduct.mapMonoidHom = { toFun := PiTensorProduct.map, map_one' := ⋯, map_mul' := ⋯ }
Instances For
The tensor of a family of linear maps from sᵢ
to tᵢ
, as a multilinear map of
the family.
Equations
- PiTensorProduct.mapMultilinear R s t = { toFun := PiTensorProduct.map, map_add' := ⋯, map_smul' := ⋯ }
Instances For
Let sᵢ
and tᵢ
be families of R
-modules.
Then there is an R
-linear map between ⨂ᵢ Hom(sᵢ, tᵢ)
and Hom(⨂ᵢ sᵢ, ⨂ tᵢ)
defined by
⨂ᵢ fᵢ ↦ ⨂ᵢ aᵢ ↦ ⨂ᵢ fᵢ aᵢ
.
This is TensorProduct.homTensorHomMap
for an arbitrary family of modules.
Note that PiTensorProduct.piTensorHomMap (tprod R f)
is equal to PiTensorProduct.map f
.
Equations
- PiTensorProduct.piTensorHomMap = ↑PiTensorProduct.lift ∘ₗ PiTensorProduct.lift (MultilinearMap.piLinearMap (PiTensorProduct.tprod R))
Instances For
If s i
and t i
are linearly equivalent for every i
in ι
, then ⨂[R] i, s i
and
⨂[R] i, t i
are linearly equivalent.
This is the n-ary version of TensorProduct.congr
Equations
- PiTensorProduct.congr f = LinearEquiv.ofLinear (PiTensorProduct.map fun (i : ι) => ↑(f i)) (PiTensorProduct.map fun (i : ι) => ↑(f i).symm) ⋯ ⋯
Instances For
Let sᵢ
, tᵢ
and t'ᵢ
be families of R
-modules, then f : Πᵢ sᵢ → tᵢ → t'ᵢ
induces an
element of Hom(⨂ᵢ sᵢ, Hom(⨂ tᵢ, ⨂ᵢ t'ᵢ))
defined by ⨂ᵢ aᵢ ↦ ⨂ᵢ bᵢ ↦ ⨂ᵢ fᵢ aᵢ bᵢ
.
This is PiTensorProduct.map
for two arbitrary families of modules.
This is TensorProduct.map₂
for families of modules.
Equations
- PiTensorProduct.map₂ f = PiTensorProduct.lift (PiTensorProduct.piTensorHomMap.compMultilinearMap ((PiTensorProduct.tprod R).compLinearMap f))
Instances For
Let sᵢ
, tᵢ
and t'ᵢ
be families of R
-modules.
Then there is a function from ⨂ᵢ Hom(sᵢ, Hom(tᵢ, t'ᵢ))
to Hom(⨂ᵢ sᵢ, Hom(⨂ tᵢ, ⨂ᵢ t'ᵢ))
defined by ⨂ᵢ fᵢ ↦ ⨂ᵢ aᵢ ↦ ⨂ᵢ bᵢ ↦ ⨂ᵢ fᵢ aᵢ bᵢ
.
Equations
- φ.piTensorHomMapFun₂ = PiTensorProduct.lift (PiTensorProduct.piTensorHomMap.compMultilinearMap ((PiTensorProduct.lift (MultilinearMap.piLinearMap (PiTensorProduct.tprod R))) φ))
Instances For
Let sᵢ
, tᵢ
and t'ᵢ
be families of R
-modules.
Then there is an linear map from ⨂ᵢ Hom(sᵢ, Hom(tᵢ, t'ᵢ))
to Hom(⨂ᵢ sᵢ, Hom(⨂ tᵢ, ⨂ᵢ t'ᵢ))
defined by ⨂ᵢ fᵢ ↦ ⨂ᵢ aᵢ ↦ ⨂ᵢ bᵢ ↦ ⨂ᵢ fᵢ aᵢ bᵢ
.
This is TensorProduct.homTensorHomMap
for two arbitrary families of modules.
Equations
- PiTensorProduct.piTensorHomMap₂ = { toFun := PiTensorProduct.piTensorHomMapFun₂, map_add' := ⋯, map_smul' := ⋯ }
Instances For
Re-index the components of the tensor power by e
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
This lemma is impractical to state in the dependent case.
Re-indexing the components of the tensor product by an equivalence e
is compatible
with PiTensorProduct.map
.
The tensor product over an empty index type ι
is isomorphic to the base ring.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Tensor product of M
over a singleton set is equivalent to M
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equivalence between a TensorProduct
of PiTensorProduct
s and a single
PiTensorProduct
indexed by a Sum
type.
For simplicity, this is defined only for homogeneously- (rather than dependently-) typed components.
Equations
- PiTensorProduct.tmulEquiv R M = LinearEquiv.ofLinear PiTensorProduct.tmul PiTensorProduct.tmulSymm ⋯ ⋯
Instances For
Equations
- PiTensorProduct.instAddCommGroup = Module.addCommMonoidToAddCommGroup R