Modules

class sage.categories.modules.Modules(base, name=None)[source]

Bases: Category_module

The category of all modules over a base ring \(R\).

An \(R\)-module \(M\) is a left and right \(R\)-module over a commutative ring \(R\) such that:

\[r*(x*s) = (r*x)*s \qquad \forall r,s \in R \text{ and } x \in M\]

INPUT:

  • base_ring – a ring \(R\) or subcategory of Rings()

  • dispatch – boolean (for internal use; default: True)

When the base ring is a field, the category of vector spaces is returned instead (unless dispatch == False).

Warning

Outside of the context of symmetric modules over a commutative ring, the specifications of this category are fuzzy and not yet set in stone (see below). The code in this category and its subcategories is therefore prone to bugs or arbitrary limitations in this case.

EXAMPLES:

sage: Modules(ZZ)
Category of modules over Integer Ring
sage: Modules(QQ)
Category of vector spaces over Rational Field

sage: Modules(Rings())
Category of modules over rings
sage: Modules(FiniteFields())
Category of vector spaces over finite enumerated fields

sage: Modules(Integers(9))
Category of modules over Ring of integers modulo 9

sage: Modules(Integers(9)).super_categories()
[Category of bimodules over Ring of integers modulo 9 on the left
                        and Ring of integers modulo 9 on the right]

sage: Modules(ZZ).super_categories()
[Category of bimodules over Integer Ring on the left
                        and Integer Ring on the right]

sage: Modules == RingModules
True

sage: Modules(ZZ['x']).is_abelian()   # see #6081
True
>>> from sage.all import *
>>> Modules(ZZ)
Category of modules over Integer Ring
>>> Modules(QQ)
Category of vector spaces over Rational Field

>>> Modules(Rings())
Category of modules over rings
>>> Modules(FiniteFields())
Category of vector spaces over finite enumerated fields

>>> Modules(Integers(Integer(9)))
Category of modules over Ring of integers modulo 9

>>> Modules(Integers(Integer(9))).super_categories()
[Category of bimodules over Ring of integers modulo 9 on the left
                        and Ring of integers modulo 9 on the right]

>>> Modules(ZZ).super_categories()
[Category of bimodules over Integer Ring on the left
                        and Integer Ring on the right]

>>> Modules == RingModules
True

>>> Modules(ZZ['x']).is_abelian()   # see #6081
True

Todo

  • Clarify the distinction, if any, with BiModules(R, R). In particular, if \(R\) is a commutative ring (e.g. a field), some pieces of the code possibly assume that \(M\) is a symmetric `R`-`R`-bimodule:

    \[r*x = x*r \qquad \forall r \in R \text{ and } x \in M\]
  • Make sure that non symmetric modules are properly supported by all the code, and advertise it.

  • Make sure that non commutative rings are properly supported by all the code, and advertise it.

  • Add support for base semirings.

  • Implement a FreeModules(R) category, when so prompted by a concrete use case: e.g. modeling a free module with several bases (using Sets.SubcategoryMethods.Realizations()) or with an atlas of local maps (see e.g. Issue #15916).

class CartesianProducts(category, *args)[source]

Bases: CartesianProductsCategory

The category of modules constructed as Cartesian products of modules.

This construction gives the direct product of modules. The implementation is based on the following resources:

class ElementMethods[source]

Bases: object

class ParentMethods[source]

Bases: object

extra_super_categories()[source]

A Cartesian product of modules is endowed with a natural module structure.

EXAMPLES:

sage: Modules(ZZ).CartesianProducts().extra_super_categories()
[Category of modules over Integer Ring]
sage: Modules(ZZ).CartesianProducts().super_categories()
[Category of Cartesian products of commutative additive groups,
 Category of modules over Integer Ring]
>>> from sage.all import *
>>> Modules(ZZ).CartesianProducts().extra_super_categories()
[Category of modules over Integer Ring]
>>> Modules(ZZ).CartesianProducts().super_categories()
[Category of Cartesian products of commutative additive groups,
 Category of modules over Integer Ring]
class ElementMethods[source]

Bases: object

Filtered[source]

alias of FilteredModules

class FiniteDimensional(base_category)[source]

Bases: CategoryWithAxiom_over_base_ring

class TensorProducts(category, *args)[source]

Bases: TensorProductsCategory

extra_super_categories()[source]

Implement the fact that a (finite) tensor product of finite dimensional modules is a finite dimensional module.

EXAMPLES:

sage: Modules(ZZ).FiniteDimensional().TensorProducts().extra_super_categories()
[Category of finite dimensional modules over Integer Ring]
sage: Modules(QQ).FiniteDimensional().TensorProducts().FiniteDimensional()
Category of tensor products of finite dimensional vector spaces
 over Rational Field
>>> from sage.all import *
>>> Modules(ZZ).FiniteDimensional().TensorProducts().extra_super_categories()
[Category of finite dimensional modules over Integer Ring]
>>> Modules(QQ).FiniteDimensional().TensorProducts().FiniteDimensional()
Category of tensor products of finite dimensional vector spaces
 over Rational Field
extra_super_categories()[source]

Implement the fact that a finite dimensional module over a finite ring is finite.

EXAMPLES:

sage: Modules(IntegerModRing(4)).FiniteDimensional().extra_super_categories()
[Category of finite sets]
sage: Modules(ZZ).FiniteDimensional().extra_super_categories()
[]
sage: Modules(GF(5)).FiniteDimensional().is_subcategory(Sets().Finite())
True
sage: Modules(ZZ).FiniteDimensional().is_subcategory(Sets().Finite())
False

sage: Modules(Rings().Finite()).FiniteDimensional().is_subcategory(Sets().Finite())
True
sage: Modules(Rings()).FiniteDimensional().is_subcategory(Sets().Finite())
False
>>> from sage.all import *
>>> Modules(IntegerModRing(Integer(4))).FiniteDimensional().extra_super_categories()
[Category of finite sets]
>>> Modules(ZZ).FiniteDimensional().extra_super_categories()
[]
>>> Modules(GF(Integer(5))).FiniteDimensional().is_subcategory(Sets().Finite())
True
>>> Modules(ZZ).FiniteDimensional().is_subcategory(Sets().Finite())
False

>>> Modules(Rings().Finite()).FiniteDimensional().is_subcategory(Sets().Finite())
True
>>> Modules(Rings()).FiniteDimensional().is_subcategory(Sets().Finite())
False
class FinitelyPresented(base_category)[source]

Bases: CategoryWithAxiom_over_base_ring

extra_super_categories()[source]

Implement the fact that a finitely presented module over a finite ring is finite.

EXAMPLES:

sage: Modules(IntegerModRing(4)).FiniteDimensional().extra_super_categories()
[Category of finite sets]
sage: Modules(ZZ).FiniteDimensional().extra_super_categories()
[]
sage: Modules(GF(5)).FiniteDimensional().is_subcategory(Sets().Finite())
True
sage: Modules(ZZ).FiniteDimensional().is_subcategory(Sets().Finite())
False

sage: Modules(Rings().Finite()).FiniteDimensional().is_subcategory(Sets().Finite())
True
sage: Modules(Rings()).FiniteDimensional().is_subcategory(Sets().Finite())
False
>>> from sage.all import *
>>> Modules(IntegerModRing(Integer(4))).FiniteDimensional().extra_super_categories()
[Category of finite sets]
>>> Modules(ZZ).FiniteDimensional().extra_super_categories()
[]
>>> Modules(GF(Integer(5))).FiniteDimensional().is_subcategory(Sets().Finite())
True
>>> Modules(ZZ).FiniteDimensional().is_subcategory(Sets().Finite())
False

>>> Modules(Rings().Finite()).FiniteDimensional().is_subcategory(Sets().Finite())
True
>>> Modules(Rings()).FiniteDimensional().is_subcategory(Sets().Finite())
False
Graded[source]

alias of GradedModules

class Homsets(category, *args)[source]

Bases: HomsetsCategory

The category of homomorphism sets \(\hom(X,Y)\) for \(X\), \(Y\) modules.

class Endset(base_category)[source]

Bases: CategoryWithAxiom_over_base_ring

The category of endomorphism sets \(End(X)\) for \(X\) a module (this is not used yet)

extra_super_categories()[source]

Implement the fact that the endomorphism set of a module is an algebra.

See also

CategoryWithAxiom.extra_super_categories()

EXAMPLES:

sage: Modules(ZZ).Endsets().extra_super_categories()
[Category of magmatic algebras over Integer Ring]

sage: End(ZZ^3) in Algebras(ZZ)                                     # needs sage.modules
True
>>> from sage.all import *
>>> Modules(ZZ).Endsets().extra_super_categories()
[Category of magmatic algebras over Integer Ring]

>>> End(ZZ**Integer(3)) in Algebras(ZZ)                                     # needs sage.modules
True
class ParentMethods[source]

Bases: object

base_ring()[source]

Return the base ring of self.

EXAMPLES:

sage: # needs sage.modules
sage: E = CombinatorialFreeModule(ZZ, [1,2,3])
sage: F = CombinatorialFreeModule(ZZ, [2,3,4])
sage: H = Hom(E, F)
sage: H.base_ring()
Integer Ring
>>> from sage.all import *
>>> # needs sage.modules
>>> E = CombinatorialFreeModule(ZZ, [Integer(1),Integer(2),Integer(3)])
>>> F = CombinatorialFreeModule(ZZ, [Integer(2),Integer(3),Integer(4)])
>>> H = Hom(E, F)
>>> H.base_ring()
Integer Ring

This base_ring method is actually overridden by sage.structure.category_object.CategoryObject.base_ring():

sage: H.base_ring.__module__                                        # needs sage.modules
>>> from sage.all import *
>>> H.base_ring.__module__                                        # needs sage.modules

Here we call it directly:

sage: method = H.category().parent_class.base_ring                  # needs sage.modules
sage: method.__get__(H)()                                           # needs sage.modules
Integer Ring
>>> from sage.all import *
>>> method = H.category().parent_class.base_ring                  # needs sage.modules
>>> method.__get__(H)()                                           # needs sage.modules
Integer Ring
zero()[source]

EXAMPLES:

sage: # needs sage.modules
sage: E = CombinatorialFreeModule(ZZ, [1,2,3])
sage: F = CombinatorialFreeModule(ZZ, [2,3,4])
sage: H = Hom(E, F)
sage: f = H.zero()
sage: f
Generic morphism:
  From: Free module generated by {1, 2, 3} over Integer Ring
  To:   Free module generated by {2, 3, 4} over Integer Ring
sage: f(E.monomial(2))
0
sage: f(E.monomial(3)) == F.zero()
True
>>> from sage.all import *
>>> # needs sage.modules
>>> E = CombinatorialFreeModule(ZZ, [Integer(1),Integer(2),Integer(3)])
>>> F = CombinatorialFreeModule(ZZ, [Integer(2),Integer(3),Integer(4)])
>>> H = Hom(E, F)
>>> f = H.zero()
>>> f
Generic morphism:
  From: Free module generated by {1, 2, 3} over Integer Ring
  To:   Free module generated by {2, 3, 4} over Integer Ring
>>> f(E.monomial(Integer(2)))
0
>>> f(E.monomial(Integer(3))) == F.zero()
True
base_ring()[source]

EXAMPLES:

sage: Modules(ZZ).Homsets().base_ring()
Integer Ring
>>> from sage.all import *
>>> Modules(ZZ).Homsets().base_ring()
Integer Ring

Todo

Generalize this so that any homset category of a full subcategory of modules over a base ring is a category over this base ring.

extra_super_categories()[source]

EXAMPLES:

sage: Modules(ZZ).Homsets().extra_super_categories()
[Category of modules over Integer Ring]
>>> from sage.all import *
>>> Modules(ZZ).Homsets().extra_super_categories()
[Category of modules over Integer Ring]
class ParentMethods[source]

Bases: object

linear_combination(iter_of_elements_coeff, factor_on_left=True)[source]

Return the linear combination \(\lambda_1 v_1 + \cdots + \lambda_k v_k\) (resp. the linear combination \(v_1 \lambda_1 + \cdots + v_k \lambda_k\)) where iter_of_elements_coeff iterates through the sequence \(((\lambda_1, v_1), ..., (\lambda_k, v_k))\).

INPUT:

  • iter_of_elements_coeff – iterator of pairs (element, coeff) with element in self and coeff in self.base_ring()

  • factor_on_left – (optional) if True, the coefficients are multiplied from the left; if False, the coefficients are multiplied from the right

EXAMPLES:

sage: m = matrix([[0,1], [1,1]])                                        # needs sage.modules
sage: J.<a,b,c> = JordanAlgebra(m)                                      # needs sage.combinat sage.modules
sage: J.linear_combination(((a+b, 1), (-2*b + c, -1)))                  # needs sage.combinat sage.modules
1 + (3, -1)
>>> from sage.all import *
>>> m = matrix([[Integer(0),Integer(1)], [Integer(1),Integer(1)]])                                        # needs sage.modules
>>> J = JordanAlgebra(m, names=('a', 'b', 'c',)); (a, b, c,) = J._first_ngens(3)# needs sage.combinat sage.modules
>>> J.linear_combination(((a+b, Integer(1)), (-Integer(2)*b + c, -Integer(1))))                  # needs sage.combinat sage.modules
1 + (3, -1)
module_morphism(function, category, codomain, **keywords)[source]

Construct a module morphism from self to codomain.

Let self be a module \(X\) over a ring \(R\). This constructs a morphism \(f: X \to Y\).

INPUT:

  • self – a parent \(X\) in Modules(R)

  • function – a function \(f\) from \(X\) to \(Y\)

  • codomain – the codomain \(Y\) of the morphism (default: f.codomain() if it’s defined; otherwise it must be specified)

  • category – a category or None (default: None)

EXAMPLES:

sage: # needs sage.modules
sage: V = FiniteRankFreeModule(QQ, 2)
sage: e = V.basis('e'); e
Basis (e_0,e_1) on the
 2-dimensional vector space over the Rational Field
sage: neg = V.module_morphism(function=operator.neg, codomain=V); neg
Generic endomorphism of
 2-dimensional vector space over the Rational Field
sage: neg(e[0])
Element -e_0 of the 2-dimensional vector space over the Rational Field
>>> from sage.all import *
>>> # needs sage.modules
>>> V = FiniteRankFreeModule(QQ, Integer(2))
>>> e = V.basis('e'); e
Basis (e_0,e_1) on the
 2-dimensional vector space over the Rational Field
>>> neg = V.module_morphism(function=operator.neg, codomain=V); neg
Generic endomorphism of
 2-dimensional vector space over the Rational Field
>>> neg(e[Integer(0)])
Element -e_0 of the 2-dimensional vector space over the Rational Field
quotient(submodule, check=True, **kwds)[source]

Construct the quotient module self / submodule.

INPUT:

  • submodule – a submodule with basis of self, or something that can be turned into one via self.submodule(submodule)

  • check, other keyword arguments – passed on to quotient_module().

This method just delegates to quotient_module(). Classes implementing modules should override that method.

Parents in categories with additional structure may override quotient(). For example, in algebras, quotient() will be the same as quotient_ring().

EXAMPLES:

sage: C = CombinatorialFreeModule(QQ, ['a','b','c'])                    # needs sage.modules
sage: TA = TensorAlgebra(C)                                             # needs sage.combinat sage.modules
sage: TA.quotient                                                       # needs sage.combinat sage.modules
<bound method Rings.ParentMethods.quotient of
 Tensor Algebra of Free module generated by {'a', 'b', 'c'}
 over Rational Field>
>>> from sage.all import *
>>> C = CombinatorialFreeModule(QQ, ['a','b','c'])                    # needs sage.modules
>>> TA = TensorAlgebra(C)                                             # needs sage.combinat sage.modules
>>> TA.quotient                                                       # needs sage.combinat sage.modules
<bound method Rings.ParentMethods.quotient of
 Tensor Algebra of Free module generated by {'a', 'b', 'c'}
 over Rational Field>
tensor_square()[source]

Return the tensor square of self.

EXAMPLES:

sage: A = HopfAlgebrasWithBasis(QQ).example()                           # needs sage.groups sage.modules
sage: A.tensor_square()                                                 # needs sage.groups sage.modules
An example of Hopf algebra with basis:
 the group algebra of the Dihedral group of order 6
 as a permutation group over Rational Field # An example
 of Hopf algebra with basis: the group algebra of the Dihedral
 group of order 6 as a permutation group over Rational Field
>>> from sage.all import *
>>> A = HopfAlgebrasWithBasis(QQ).example()                           # needs sage.groups sage.modules
>>> A.tensor_square()                                                 # needs sage.groups sage.modules
An example of Hopf algebra with basis:
 the group algebra of the Dihedral group of order 6
 as a permutation group over Rational Field # An example
 of Hopf algebra with basis: the group algebra of the Dihedral
 group of order 6 as a permutation group over Rational Field
class SubcategoryMethods[source]

Bases: object

DualObjects()[source]

Return the category of spaces constructed as duals of spaces of self.

The dual of a vector space \(V\) is the space consisting of all linear functionals on \(V\) (see Wikipedia article Dual_space). Additional structure on \(V\) can endow its dual with additional structure; for example, if \(V\) is a finite dimensional algebra, then its dual is a coalgebra.

This returns the category of spaces constructed as dual of spaces in self, endowed with the appropriate additional structure.

Warning

  • This semantic of dual and DualObject is imposed on all subcategories, in particular to make dual a covariant functorial construction.

    A subcategory that defines a different notion of dual needs to use a different name.

  • Typically, the category of graded modules should define a separate graded_dual construction (see Issue #15647). For now the two constructions are not distinguished which is an oversimplified model.

EXAMPLES:

sage: VectorSpaces(QQ).DualObjects()
Category of duals of vector spaces over Rational Field
>>> from sage.all import *
>>> VectorSpaces(QQ).DualObjects()
Category of duals of vector spaces over Rational Field

The dual of a vector space is a vector space:

sage: VectorSpaces(QQ).DualObjects().super_categories()
[Category of vector spaces over Rational Field]
>>> from sage.all import *
>>> VectorSpaces(QQ).DualObjects().super_categories()
[Category of vector spaces over Rational Field]

The dual of an algebra is a coalgebra:

sage: sorted(Algebras(QQ).DualObjects().super_categories(), key=str)
[Category of coalgebras over Rational Field,
 Category of duals of vector spaces over Rational Field]
>>> from sage.all import *
>>> sorted(Algebras(QQ).DualObjects().super_categories(), key=str)
[Category of coalgebras over Rational Field,
 Category of duals of vector spaces over Rational Field]

The dual of a coalgebra is an algebra:

sage: sorted(Coalgebras(QQ).DualObjects().super_categories(), key=str)
[Category of algebras over Rational Field,
 Category of duals of vector spaces over Rational Field]
>>> from sage.all import *
>>> sorted(Coalgebras(QQ).DualObjects().super_categories(), key=str)
[Category of algebras over Rational Field,
 Category of duals of vector spaces over Rational Field]

As a shorthand, this category can be accessed with the dual() method:

sage: VectorSpaces(QQ).dual()
Category of duals of vector spaces over Rational Field
>>> from sage.all import *
>>> VectorSpaces(QQ).dual()
Category of duals of vector spaces over Rational Field
Filtered(base_ring=None)[source]

Return the subcategory of the filtered objects of self.

INPUT:

  • base_ring – this is ignored

EXAMPLES:

sage: Modules(ZZ).Filtered()
Category of filtered modules over Integer Ring

sage: Coalgebras(QQ).Filtered()
Category of filtered coalgebras over Rational Field

sage: AlgebrasWithBasis(QQ).Filtered()
Category of filtered algebras with basis over Rational Field
>>> from sage.all import *
>>> Modules(ZZ).Filtered()
Category of filtered modules over Integer Ring

>>> Coalgebras(QQ).Filtered()
Category of filtered coalgebras over Rational Field

>>> AlgebrasWithBasis(QQ).Filtered()
Category of filtered algebras with basis over Rational Field

Todo

  • Explain why this does not commute with WithBasis()

  • Improve the support for covariant functorial constructions categories over a base ring so as to get rid of the base_ring argument.

FiniteDimensional()[source]

Return the full subcategory of the finite dimensional objects of self.

EXAMPLES:

sage: Modules(ZZ).FiniteDimensional()
Category of finite dimensional modules over Integer Ring
sage: Coalgebras(QQ).FiniteDimensional()
Category of finite dimensional coalgebras over Rational Field
sage: AlgebrasWithBasis(QQ).FiniteDimensional()
Category of finite dimensional algebras with basis over Rational Field
>>> from sage.all import *
>>> Modules(ZZ).FiniteDimensional()
Category of finite dimensional modules over Integer Ring
>>> Coalgebras(QQ).FiniteDimensional()
Category of finite dimensional coalgebras over Rational Field
>>> AlgebrasWithBasis(QQ).FiniteDimensional()
Category of finite dimensional algebras with basis over Rational Field
FinitelyPresented()[source]

Return the full subcategory of the finitely presented objects of self.

EXAMPLES:

sage: Modules(ZZ).FinitelyPresented()
Category of finitely presented modules over Integer Ring
sage: A = SteenrodAlgebra(2)                                            # needs sage.combinat sage.modules
sage: from sage.modules.fp_graded.module import FPModule                # needs sage.combinat sage.modules
sage: FPModule(A, [0, 1], [[Sq(2), Sq(1)]]).category()                  # needs sage.combinat sage.modules
Category of finitely presented graded modules
 over mod 2 Steenrod algebra, milnor basis
>>> from sage.all import *
>>> Modules(ZZ).FinitelyPresented()
Category of finitely presented modules over Integer Ring
>>> A = SteenrodAlgebra(Integer(2))                                            # needs sage.combinat sage.modules
>>> from sage.modules.fp_graded.module import FPModule                # needs sage.combinat sage.modules
>>> FPModule(A, [Integer(0), Integer(1)], [[Sq(Integer(2)), Sq(Integer(1))]]).category()                  # needs sage.combinat sage.modules
Category of finitely presented graded modules
 over mod 2 Steenrod algebra, milnor basis
Graded(base_ring=None)[source]

Return the subcategory of the graded objects of self.

INPUT:

  • base_ring – this is ignored

EXAMPLES:

sage: Modules(ZZ).Graded()
Category of graded modules over Integer Ring

sage: Coalgebras(QQ).Graded()
Category of graded coalgebras over Rational Field

sage: AlgebrasWithBasis(QQ).Graded()
Category of graded algebras with basis over Rational Field
>>> from sage.all import *
>>> Modules(ZZ).Graded()
Category of graded modules over Integer Ring

>>> Coalgebras(QQ).Graded()
Category of graded coalgebras over Rational Field

>>> AlgebrasWithBasis(QQ).Graded()
Category of graded algebras with basis over Rational Field

Todo

  • Explain why this does not commute with WithBasis()

  • Improve the support for covariant functorial constructions categories over a base ring so as to get rid of the base_ring argument.

Super(base_ring=None)[source]

Return the super-analogue category of self.

INPUT:

  • base_ring – this is ignored

EXAMPLES:

sage: Modules(ZZ).Super()
Category of super modules over Integer Ring

sage: Coalgebras(QQ).Super()
Category of super coalgebras over Rational Field

sage: AlgebrasWithBasis(QQ).Super()
Category of super algebras with basis over Rational Field
>>> from sage.all import *
>>> Modules(ZZ).Super()
Category of super modules over Integer Ring

>>> Coalgebras(QQ).Super()
Category of super coalgebras over Rational Field

>>> AlgebrasWithBasis(QQ).Super()
Category of super algebras with basis over Rational Field

Todo

  • Explain why this does not commute with WithBasis()

  • Improve the support for covariant functorial constructions categories over a base ring so as to get rid of the base_ring argument.

TensorProducts()[source]

Return the full subcategory of objects of self constructed as tensor products.

See also

EXAMPLES:

sage: ModulesWithBasis(QQ).TensorProducts()
Category of tensor products of vector spaces with basis over Rational Field
>>> from sage.all import *
>>> ModulesWithBasis(QQ).TensorProducts()
Category of tensor products of vector spaces with basis over Rational Field
WithBasis()[source]

Return the full subcategory of the objects of self with a distinguished basis.

EXAMPLES:

sage: Modules(ZZ).WithBasis()
Category of modules with basis over Integer Ring
sage: Coalgebras(QQ).WithBasis()
Category of coalgebras with basis over Rational Field
sage: AlgebrasWithBasis(QQ).WithBasis()
Category of algebras with basis over Rational Field
>>> from sage.all import *
>>> Modules(ZZ).WithBasis()
Category of modules with basis over Integer Ring
>>> Coalgebras(QQ).WithBasis()
Category of coalgebras with basis over Rational Field
>>> AlgebrasWithBasis(QQ).WithBasis()
Category of algebras with basis over Rational Field
base_ring()[source]

Return the base ring (category) for self.

This implements a base_ring method for all subcategories of Modules(K).

EXAMPLES:

sage: C = Modules(QQ) & Semigroups(); C
Join of Category of semigroups
    and Category of vector spaces over Rational Field
sage: C.base_ring()
Rational Field
sage: C.base_ring.__module__
'sage.categories.modules'

sage: C2 = Modules(Rings()) & Semigroups(); C2
Join of Category of semigroups and Category of modules over rings
sage: C2.base_ring()
Category of rings
sage: C2.base_ring.__module__
'sage.categories.modules'

sage: # needs sage.combinat sage.groups sage.modules
sage: C3 = DescentAlgebra(QQ,3).B().category()
sage: C3.base_ring.__module__
'sage.categories.modules'
sage: C3.base_ring()
Rational Field

sage: # needs sage.combinat sage.modules
sage: C4 = QuasiSymmetricFunctions(QQ).F().category()
sage: C4.base_ring.__module__
'sage.categories.modules'
sage: C4.base_ring()
Rational Field
>>> from sage.all import *
>>> C = Modules(QQ) & Semigroups(); C
Join of Category of semigroups
    and Category of vector spaces over Rational Field
>>> C.base_ring()
Rational Field
>>> C.base_ring.__module__
'sage.categories.modules'

>>> C2 = Modules(Rings()) & Semigroups(); C2
Join of Category of semigroups and Category of modules over rings
>>> C2.base_ring()
Category of rings
>>> C2.base_ring.__module__
'sage.categories.modules'

>>> # needs sage.combinat sage.groups sage.modules
>>> C3 = DescentAlgebra(QQ,Integer(3)).B().category()
>>> C3.base_ring.__module__
'sage.categories.modules'
>>> C3.base_ring()
Rational Field

>>> # needs sage.combinat sage.modules
>>> C4 = QuasiSymmetricFunctions(QQ).F().category()
>>> C4.base_ring.__module__
'sage.categories.modules'
>>> C4.base_ring()
Rational Field
dual()[source]

Return the category of spaces constructed as duals of spaces of self.

The dual of a vector space \(V\) is the space consisting of all linear functionals on \(V\) (see Wikipedia article Dual_space). Additional structure on \(V\) can endow its dual with additional structure; for example, if \(V\) is a finite dimensional algebra, then its dual is a coalgebra.

This returns the category of spaces constructed as dual of spaces in self, endowed with the appropriate additional structure.

Warning

  • This semantic of dual and DualObject is imposed on all subcategories, in particular to make dual a covariant functorial construction.

    A subcategory that defines a different notion of dual needs to use a different name.

  • Typically, the category of graded modules should define a separate graded_dual construction (see Issue #15647). For now the two constructions are not distinguished which is an oversimplified model.

EXAMPLES:

sage: VectorSpaces(QQ).DualObjects()
Category of duals of vector spaces over Rational Field
>>> from sage.all import *
>>> VectorSpaces(QQ).DualObjects()
Category of duals of vector spaces over Rational Field

The dual of a vector space is a vector space:

sage: VectorSpaces(QQ).DualObjects().super_categories()
[Category of vector spaces over Rational Field]
>>> from sage.all import *
>>> VectorSpaces(QQ).DualObjects().super_categories()
[Category of vector spaces over Rational Field]

The dual of an algebra is a coalgebra:

sage: sorted(Algebras(QQ).DualObjects().super_categories(), key=str)
[Category of coalgebras over Rational Field,
 Category of duals of vector spaces over Rational Field]
>>> from sage.all import *
>>> sorted(Algebras(QQ).DualObjects().super_categories(), key=str)
[Category of coalgebras over Rational Field,
 Category of duals of vector spaces over Rational Field]

The dual of a coalgebra is an algebra:

sage: sorted(Coalgebras(QQ).DualObjects().super_categories(), key=str)
[Category of algebras over Rational Field,
 Category of duals of vector spaces over Rational Field]
>>> from sage.all import *
>>> sorted(Coalgebras(QQ).DualObjects().super_categories(), key=str)
[Category of algebras over Rational Field,
 Category of duals of vector spaces over Rational Field]

As a shorthand, this category can be accessed with the dual() method:

sage: VectorSpaces(QQ).dual()
Category of duals of vector spaces over Rational Field
>>> from sage.all import *
>>> VectorSpaces(QQ).dual()
Category of duals of vector spaces over Rational Field
Super[source]

alias of SuperModules

class TensorProducts(category, *args)[source]

Bases: TensorProductsCategory

The category of modules constructed by tensor product of modules.

class ParentMethods[source]

Bases: object

Implement operations on tensor products of modules.

construction()[source]

Return the construction of self.

EXAMPLES:

sage: A = algebras.Free(QQ, 2)                                      # needs sage.combinat sage.modules
sage: T = A.tensor(A)                                               # needs sage.combinat sage.modules
sage: T.construction()                                              # needs sage.combinat sage.modules
(The tensor functorial construction,
 (Free Algebra on 2 generators (None0, None1) over Rational Field,
  Free Algebra on 2 generators (None0, None1) over Rational Field))
>>> from sage.all import *
>>> A = algebras.Free(QQ, Integer(2))                                      # needs sage.combinat sage.modules
>>> T = A.tensor(A)                                               # needs sage.combinat sage.modules
>>> T.construction()                                              # needs sage.combinat sage.modules
(The tensor functorial construction,
 (Free Algebra on 2 generators (None0, None1) over Rational Field,
  Free Algebra on 2 generators (None0, None1) over Rational Field))
tensor_factors()[source]

Return the tensor factors of this tensor product.

EXAMPLES:

sage: # needs sage.modules
sage: F = CombinatorialFreeModule(ZZ, [1,2])
sage: F.rename('F')
sage: G = CombinatorialFreeModule(ZZ, [3,4])
sage: G.rename('G')
sage: T = tensor([F, G]); T
F # G
sage: T.tensor_factors()
(F, G)
>>> from sage.all import *
>>> # needs sage.modules
>>> F = CombinatorialFreeModule(ZZ, [Integer(1),Integer(2)])
>>> F.rename('F')
>>> G = CombinatorialFreeModule(ZZ, [Integer(3),Integer(4)])
>>> G.rename('G')
>>> T = tensor([F, G]); T
F # G
>>> T.tensor_factors()
(F, G)
extra_super_categories()[source]

EXAMPLES:

sage: Modules(ZZ).TensorProducts().extra_super_categories()
[Category of modules over Integer Ring]
sage: Modules(ZZ).TensorProducts().super_categories()
[Category of modules over Integer Ring]
>>> from sage.all import *
>>> Modules(ZZ).TensorProducts().extra_super_categories()
[Category of modules over Integer Ring]
>>> Modules(ZZ).TensorProducts().super_categories()
[Category of modules over Integer Ring]
WithBasis[source]

alias of ModulesWithBasis

additional_structure()[source]

Return None.

Indeed, the category of modules defines no additional structure: a bimodule morphism between two modules is a module morphism.

Todo

Should this category be a CategoryWithAxiom?

EXAMPLES:

sage: Modules(ZZ).additional_structure()
>>> from sage.all import *
>>> Modules(ZZ).additional_structure()
super_categories()[source]

EXAMPLES:

sage: Modules(ZZ).super_categories()
[Category of bimodules over Integer Ring on the left
                        and Integer Ring on the right]
>>> from sage.all import *
>>> Modules(ZZ).super_categories()
[Category of bimodules over Integer Ring on the left
                        and Integer Ring on the right]

Nota bene:

sage: Modules(QQ)
Category of vector spaces over Rational Field
sage: Modules(QQ).super_categories()
[Category of modules over Rational Field]
>>> from sage.all import *
>>> Modules(QQ)
Category of vector spaces over Rational Field
>>> Modules(QQ).super_categories()
[Category of modules over Rational Field]