Monoids#
- class sage.monoids.monoid.Monoid_class(names)[source]#
Bases:
Parent
EXAMPLES:
sage: from sage.monoids.monoid import Monoid_class sage: Monoid_class(('a','b')) <sage.monoids.monoid.Monoid_class_with_category object at ...>
>>> from sage.all import * >>> from sage.monoids.monoid import Monoid_class >>> Monoid_class(('a','b')) <sage.monoids.monoid.Monoid_class_with_category object at ...>
- gens()[source]#
Return the generators for
self
.EXAMPLES:
sage: F.<a,b,c,d,e> = FreeMonoid(5) sage: F.gens() (a, b, c, d, e)
>>> from sage.all import * >>> F = FreeMonoid(Integer(5), names=('a', 'b', 'c', 'd', 'e',)); (a, b, c, d, e,) = F._first_ngens(5) >>> F.gens() (a, b, c, d, e)
- monoid_generators()[source]#
Return the generators for
self
.EXAMPLES:
sage: F.<a,b,c,d,e> = FreeMonoid(5) sage: F.monoid_generators() Family (a, b, c, d, e)
>>> from sage.all import * >>> F = FreeMonoid(Integer(5), names=('a', 'b', 'c', 'd', 'e',)); (a, b, c, d, e,) = F._first_ngens(5) >>> F.monoid_generators() Family (a, b, c, d, e)
- sage.monoids.monoid.is_Monoid(x)[source]#
Return
True
ifx
is of typeMonoid_class
.EXAMPLES:
sage: from sage.monoids.monoid import is_Monoid sage: is_Monoid(0) doctest:warning... DeprecationWarning: the function is_Monoid is deprecated; use 'isinstance(..., Monoid_class)' instead See https://github.com/sagemath/sage/issues/37897 for details. False sage: is_Monoid(ZZ) # The technical math meaning of monoid has ....: # no bearing whatsoever on the result: it's ....: # a typecheck which is not satisfied by ZZ ....: # since it does not inherit from Monoid_class. False sage: is_Monoid(sage.monoids.monoid.Monoid_class(('a','b'))) True sage: F.<a,b,c,d,e> = FreeMonoid(5) sage: is_Monoid(F) True
>>> from sage.all import * >>> from sage.monoids.monoid import is_Monoid >>> is_Monoid(Integer(0)) doctest:warning... DeprecationWarning: the function is_Monoid is deprecated; use 'isinstance(..., Monoid_class)' instead See https://github.com/sagemath/sage/issues/37897 for details. False >>> is_Monoid(ZZ) # The technical math meaning of monoid has ... # no bearing whatsoever on the result: it's ... # a typecheck which is not satisfied by ZZ ... # since it does not inherit from Monoid_class. False >>> is_Monoid(sage.monoids.monoid.Monoid_class(('a','b'))) True >>> F = FreeMonoid(Integer(5), names=('a', 'b', 'c', 'd', 'e',)); (a, b, c, d, e,) = F._first_ngens(5) >>> is_Monoid(F) True