Examples of semigroups

class sage.categories.examples.semigroups.FreeSemigroup(alphabet=('a', 'b', 'c', 'd'))

Bases: sage.structure.unique_representation.UniqueRepresentation, sage.structure.parent.Parent

An example of semigroup.

The purpose of this class is to provide a minimal template for implementing of a semigroup.

EXAMPLES:

sage: S = Semigroups().example("free"); S
An example of a semigroup: the free semigroup generated by ('a', 'b', 'c', 'd')

This is the free semigroup generated by:

sage: S.semigroup_generators()
Family ('a', 'b', 'c', 'd')

and with product given by concatenation:

sage: S('dab') * S('acb')
'dabacb'
class Element

Bases: sage.structure.element_wrapper.ElementWrapper

The class for elements of the free semigroup.

an_element()

Returns an element of the semigroup.

EXAMPLES:

sage: F = Semigroups().example('free')
sage: F.an_element()
'abcd'
product(x, y)

Returns the product of x and y in the semigroup, as per Semigroups.ParentMethods.product().

EXAMPLES:

sage: F = Semigroups().example('free')
sage: F.an_element() * F('a')^5
'abcdaaaaa'
semigroup_generators()

Returns the generators of the semigroup.

EXAMPLES:

sage: F = Semigroups().example('free')
sage: F.semigroup_generators()
Family ('a', 'b', 'c', 'd')
class sage.categories.examples.semigroups.IncompleteSubquotientSemigroup(category=None)

Bases: sage.structure.unique_representation.UniqueRepresentation, sage.structure.parent.Parent

An incompletely implemented subquotient semigroup, for testing purposes

EXAMPLES:

sage: S = sage.categories.examples.semigroups.IncompleteSubquotientSemigroup()
sage: S
A subquotient of An example of a semigroup: the left zero semigroup
class Element

Bases: sage.structure.element_wrapper.ElementWrapper

ambient()

Returns the ambient semigroup.

EXAMPLES:

sage: S = Semigroups().Subquotients().example()
sage: S.ambient()
An example of a semigroup: the left zero semigroup
class sage.categories.examples.semigroups.LeftZeroSemigroup

Bases: sage.structure.unique_representation.UniqueRepresentation, sage.structure.parent.Parent

An example of a semigroup.

This class illustrates a minimal implementation of a semigroup.

EXAMPLES:

sage: S = Semigroups().example(); S
An example of a semigroup: the left zero semigroup

This is the semigroup that contains all sorts of objects:

sage: S.some_elements()
[3, 42, 'a', 3.4, 'raton laveur']

with product rule given by \(a \times b = a\) for all \(a, b\):

sage: S('hello') * S('world')
'hello'
sage: S(3)*S(1)*S(2)
3
sage: S(3)^12312321312321
3
class Element

Bases: sage.structure.element_wrapper.ElementWrapper

is_idempotent()

Trivial implementation of Semigroups.Element.is_idempotent since all elements of this semigroup are idempotent!

EXAMPLES:

sage: S = Semigroups().example()
sage: S.an_element().is_idempotent()
True
sage: S(17).is_idempotent()
True
an_element()

Returns an element of the semigroup.

EXAMPLES:

sage: Semigroups().example().an_element()
42
product(x, y)

Returns the product of x and y in the semigroup, as per Semigroups.ParentMethods.product().

EXAMPLES:

sage: S = Semigroups().example()
sage: S('hello') * S('world')
'hello'
sage: S(3)*S(1)*S(2)
3
some_elements()

Returns a list of some elements of the semigroup.

EXAMPLES:

sage: Semigroups().example().some_elements()
[3, 42, 'a', 3.4, 'raton laveur']
class sage.categories.examples.semigroups.QuotientOfLeftZeroSemigroup(category=None)

Bases: sage.structure.unique_representation.UniqueRepresentation, sage.structure.parent.Parent

Example of a quotient semigroup

EXAMPLES:

sage: S = Semigroups().Subquotients().example(); S
An example of a (sub)quotient semigroup: a quotient of the left zero semigroup

This is the quotient of:

sage: S.ambient()
An example of a semigroup: the left zero semigroup

obtained by setting \(x=42\) for any \(x\geq 42\):

sage: S(100)
42
sage: S(100) == S(42)
True

The product is inherited from the ambient semigroup:

sage: S(1)*S(2) == S(1)
True
class Element

Bases: sage.structure.element_wrapper.ElementWrapper

ambient()

Returns the ambient semigroup.

EXAMPLES:

sage: S = Semigroups().Subquotients().example()
sage: S.ambient()
An example of a semigroup: the left zero semigroup
an_element()

Returns an element of the semigroup.

EXAMPLES:

sage: S = Semigroups().Subquotients().example()
sage: S.an_element()
42
lift(x)

Lift the element x into the ambient semigroup.

INPUT:

  • x – an element of self.

OUTPUT:

  • an element of self.ambient().

EXAMPLES:

sage: S = Semigroups().Subquotients().example()
sage: x = S.an_element(); x
42
sage: S.lift(x)
42
sage: S.lift(x) in S.ambient()
True
sage: y = S.ambient()(100); y
100
sage: S.lift(S(y))
42
retract(x)

Returns the retract x onto an element of this semigroup.

INPUT:

  • x – an element of the ambient semigroup (self.ambient()).

OUTPUT:

  • an element of self.

EXAMPLES:

sage: S = Semigroups().Subquotients().example()
sage: L = S.ambient()
sage: S.retract(L(17))
17
sage: S.retract(L(42))
42
sage: S.retract(L(171))
42
some_elements()

Returns a list of some elements of the semigroup.

EXAMPLES:

sage: S = Semigroups().Subquotients().example()
sage: S.some_elements()
[1, 2, 3, 8, 42, 42]
the_answer()

Returns the Answer to Life, the Universe, and Everything as an element of this semigroup.

EXAMPLES:

sage: S = Semigroups().Subquotients().example()
sage: S.the_answer()
42