Bases: sage.categories.category_with_axiom.CategoryWithAxiom_singleton
The category of (multiplicative) monoids.
A monoid is a unital semigroup, that is a
set endowed with a multiplicative binary operation which is
associative and admits a unit (see Wikipedia article Monoid).
EXAMPLES:
sage: Monoids()
Category of monoids
sage: Monoids().super_categories()
[Category of semigroups, Category of unital magmas]
sage: Monoids().all_super_categories()
[Category of monoids,
Category of semigroups,
Category of unital magmas, Category of magmas,
Category of sets,
Category of sets with partial maps,
Category of objects]
sage: Monoids().axioms()
frozenset({'Associative', 'Unital'})
sage: Semigroups().Unital()
Category of monoids
sage: Monoids().example()
An example of a monoid: the free monoid generated by ('a', 'b', 'c', 'd')
TESTS:
sage: C = Monoids()
sage: TestSuite(C).run()
Bases: sage.categories.algebra_functor.AlgebrasCategory
TESTS:
sage: from sage.categories.covariant_functorial_construction import CovariantConstructionCategory
sage: class FooBars(CovariantConstructionCategory):
... _functor_category = "FooBars"
sage: Category.FooBars = lambda self: FooBars.category_of(self)
sage: C = FooBars(ModulesWithBasis(ZZ))
sage: C
Category of foo bars of modules with basis over Integer Ring
sage: C.base_category()
Category of modules with basis over Integer Ring
sage: latex(C)
\mathbf{FooBars}(\mathbf{ModulesWithBasis}_{\Bold{Z}})
sage: import __main__; __main__.FooBars = FooBars # Fake FooBars being defined in a python module
sage: TestSuite(C).run()
Return whether the element self is central.
EXAMPLES:
sage: SG4=SymmetricGroupAlgebra(ZZ,4)
sage: SG4(1).is_central()
True
sage: SG4(Permutation([1,3,2,4])).is_central()
False
sage: A=GroupAlgebras(QQ).example(); A
Group algebra of Dihedral group of order 8 as a permutation group over Rational Field
sage: sum(i for i in A.basis()).is_central()
True
Return the unit of the monoid, which indexes the unit of this algebra, as per AlgebrasWithBasis.ParentMethods.one_basis().
EXAMPLES:
sage: A = Monoids().example().algebra(ZZ)
sage: A.one_basis()
''
sage: A.one()
B['']
sage: A(3)
3*B['']
EXAMPLES:
sage: Monoids().Algebras(QQ).extra_super_categories()
[Category of monoids]
sage: Monoids().Algebras(QQ).super_categories()
[Category of algebras with basis over Rational Field,
Category of semigroup algebras over Rational Field,
Category of unital magma algebras over Rational Field]
Bases: sage.categories.cartesian_product.CartesianProductsCategory
The category of monoids constructed as cartesian products of monoids.
This construction gives the direct product of monoids. See Wikipedia article Direct_product for more information.
Return the generators of self.
EXAMPLES:
sage: M = Monoids.free([1,2,3])
sage: N = Monoids.free(['a','b'])
sage: C = cartesian_product([M, N])
sage: C.monoid_generators()
Family ((F[1], 1), (F[2], 1), (F[3], 1),
(1, F['a']), (1, F['b']))
An example with an infinitely generated group (a better output is needed):
sage: N = Monoids.free(ZZ)
sage: C = cartesian_product([M, N])
sage: C.monoid_generators()
Lazy family (gen(i))_{i in The cartesian product of (...)}
A cartesian product of monoids is endowed with a natural group structure.
EXAMPLES:
sage: C = Monoids().CartesianProducts()
sage: C.extra_super_categories()
[Category of monoids]
sage: sorted(C.super_categories(), key=str)
[Category of Cartesian products of semigroups,
Category of Cartesian products of unital magmas,
Category of monoids]
Bases: sage.categories.category_with_axiom.CategoryWithAxiom_singleton
Category of commutative (abelian) monoids.
A monoid is commutative if
for all
.
Return a free abelian monoid on generators or with
the generators indexed by a set
.
A free monoid is constructed by specifing either:
INPUT:
EXAMPLES:
sage: Monoids.Commutative.free(index_set=ZZ)
Free abelian monoid indexed by Integer Ring
sage: Monoids().Commutative().free(ZZ)
Free abelian monoid indexed by Integer Ring
sage: F.<x,y,z> = Monoids().Commutative().free(); F
Free abelian monoid indexed by {'x', 'y', 'z'}
Return whether self is the one of the monoid.
The default implementation is to compare with self.one().
TESTS:
sage: S = Monoids().example()
sage: S.one().is_one()
True
sage: S("aa").is_one()
False
alias of FiniteMonoids
Backward compatibility alias for one().
TESTS:
sage: S = Monoids().example()
sage: S.one_element()
''
n-ary product of elements of self.
INPUT:
Returns the product of the elements in args, as an element of self.
EXAMPLES:
sage: S = Monoids().example()
sage: S.prod([S('a'), S('b')])
'ab'
Return the generators of self as a semigroup.
The generators of a monoid as a semigroup are the generators
of
as a monoid and the unit.
EXAMPLES:
sage: M = Monoids().free([1,2,3])
sage: M.semigroup_generators()
Family (1, F[1], F[2], F[3])
Bases: sage.categories.subquotients.SubquotientsCategory
TESTS:
sage: from sage.categories.covariant_functorial_construction import CovariantConstructionCategory
sage: class FooBars(CovariantConstructionCategory):
... _functor_category = "FooBars"
sage: Category.FooBars = lambda self: FooBars.category_of(self)
sage: C = FooBars(ModulesWithBasis(ZZ))
sage: C
Category of foo bars of modules with basis over Integer Ring
sage: C.base_category()
Category of modules with basis over Integer Ring
sage: latex(C)
\mathbf{FooBars}(\mathbf{ModulesWithBasis}_{\Bold{Z}})
sage: import __main__; __main__.FooBars = FooBars # Fake FooBars being defined in a python module
sage: TestSuite(C).run()
Bases: sage.categories.with_realizations.WithRealizationsCategory
TESTS:
sage: from sage.categories.covariant_functorial_construction import CovariantConstructionCategory
sage: class FooBars(CovariantConstructionCategory):
... _functor_category = "FooBars"
sage: Category.FooBars = lambda self: FooBars.category_of(self)
sage: C = FooBars(ModulesWithBasis(ZZ))
sage: C
Category of foo bars of modules with basis over Integer Ring
sage: C.base_category()
Category of modules with basis over Integer Ring
sage: latex(C)
\mathbf{FooBars}(\mathbf{ModulesWithBasis}_{\Bold{Z}})
sage: import __main__; __main__.FooBars = FooBars # Fake FooBars being defined in a python module
sage: TestSuite(C).run()
Return the unit of this monoid.
This default implementation returns the unit of the realization of self given by a_realization().
EXAMPLES:
sage: A = Sets().WithRealizations().example(); A
The subset algebra of {1, 2, 3} over Rational Field
sage: A.one.__module__
'sage.categories.monoids'
sage: A.one()
F[{}]
TESTS:
sage: A.one() is A.a_realization().one()
True
sage: A._test_one()
Return a free monoid on generators or with the generators
indexed by a set
.
A free monoid is constructed by specifing either:
INPUT:
EXAMPLES:
sage: Monoids.free(index_set=ZZ)
Free monoid indexed by Integer Ring
sage: Monoids().free(ZZ)
Free monoid indexed by Integer Ring
sage: F.<x,y,z> = Monoids().free(); F
Free monoid indexed by {'x', 'y', 'z'}