Examples of semigroups¶
- class sage.categories.examples.semigroups.FreeSemigroup(alphabet=('a', 'b', 'c', 'd'))[source]¶
Bases:
UniqueRepresentation
,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')
>>> from sage.all import * >>> 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')
>>> from sage.all import * >>> S.semigroup_generators() Family ('a', 'b', 'c', 'd')
and with product given by concatenation:
sage: S('dab') * S('acb') 'dabacb'
>>> from sage.all import * >>> S('dab') * S('acb') 'dabacb'
- class Element[source]¶
Bases:
ElementWrapper
The class for elements of the free semigroup.
- wrapped_class¶
alias of
str
- an_element()[source]¶
Return an element of the semigroup.
EXAMPLES:
sage: F = Semigroups().example('free') sage: F.an_element() 'abcd'
>>> from sage.all import * >>> F = Semigroups().example('free') >>> F.an_element() 'abcd'
- product(x, y)[source]¶
Return the product of
x
andy
in the semigroup, as perSemigroups.ParentMethods.product()
.EXAMPLES:
sage: F = Semigroups().example('free') sage: F.an_element() * F('a')^5 'abcdaaaaa'
>>> from sage.all import * >>> F = Semigroups().example('free') >>> F.an_element() * F('a')**Integer(5) 'abcdaaaaa'
- semigroup_generators()[source]¶
Return the generators of the semigroup.
EXAMPLES:
sage: F = Semigroups().example('free') sage: F.semigroup_generators() Family ('a', 'b', 'c', 'd')
>>> from sage.all import * >>> F = Semigroups().example('free') >>> F.semigroup_generators() Family ('a', 'b', 'c', 'd')
- class sage.categories.examples.semigroups.IncompleteSubquotientSemigroup(category=None)[source]¶
Bases:
UniqueRepresentation
,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
>>> from sage.all import * >>> S = sage.categories.examples.semigroups.IncompleteSubquotientSemigroup() >>> S A subquotient of An example of a semigroup: the left zero semigroup
- class Element[source]¶
Bases:
ElementWrapper
- ambient()[source]¶
Return the ambient semigroup.
EXAMPLES:
sage: S = Semigroups().Subquotients().example() sage: S.ambient() An example of a semigroup: the left zero semigroup
>>> from sage.all import * >>> S = Semigroups().Subquotients().example() >>> S.ambient() An example of a semigroup: the left zero semigroup
- class sage.categories.examples.semigroups.LeftZeroSemigroup[source]¶
Bases:
UniqueRepresentation
,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
>>> from sage.all import * >>> 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']
>>> from sage.all import * >>> 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
>>> from sage.all import * >>> S('hello') * S('world') 'hello' >>> S(Integer(3))*S(Integer(1))*S(Integer(2)) 3 >>> S(Integer(3))**Integer(12312321312321) 3
- class Element[source]¶
Bases:
ElementWrapper
- is_idempotent()[source]¶
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
>>> from sage.all import * >>> S = Semigroups().example() >>> S.an_element().is_idempotent() True >>> S(Integer(17)).is_idempotent() True
- an_element()[source]¶
Return an element of the semigroup.
EXAMPLES:
sage: Semigroups().example().an_element() 42
>>> from sage.all import * >>> Semigroups().example().an_element() 42
- product(x, y)[source]¶
Return the product of
x
andy
in the semigroup, as perSemigroups.ParentMethods.product()
.EXAMPLES:
sage: S = Semigroups().example() sage: S('hello') * S('world') 'hello' sage: S(3)*S(1)*S(2) 3
>>> from sage.all import * >>> S = Semigroups().example() >>> S('hello') * S('world') 'hello' >>> S(Integer(3))*S(Integer(1))*S(Integer(2)) 3
- class sage.categories.examples.semigroups.QuotientOfLeftZeroSemigroup(category=None)[source]¶
Bases:
UniqueRepresentation
,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
>>> from sage.all import * >>> 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
>>> from sage.all import * >>> 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
>>> from sage.all import * >>> S(Integer(100)) 42 >>> S(Integer(100)) == S(Integer(42)) True
The product is inherited from the ambient semigroup:
sage: S(1)*S(2) == S(1) True
>>> from sage.all import * >>> S(Integer(1))*S(Integer(2)) == S(Integer(1)) True
- class Element[source]¶
Bases:
ElementWrapper
- ambient()[source]¶
Return the ambient semigroup.
EXAMPLES:
sage: S = Semigroups().Subquotients().example() sage: S.ambient() An example of a semigroup: the left zero semigroup
>>> from sage.all import * >>> S = Semigroups().Subquotients().example() >>> S.ambient() An example of a semigroup: the left zero semigroup
- an_element()[source]¶
Return an element of the semigroup.
EXAMPLES:
sage: S = Semigroups().Subquotients().example() sage: S.an_element() 42
>>> from sage.all import * >>> S = Semigroups().Subquotients().example() >>> S.an_element() 42
- lift(x)[source]¶
Lift the element
x
into the ambient semigroup.INPUT:
x
– an element ofself
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
>>> from sage.all import * >>> S = Semigroups().Subquotients().example() >>> x = S.an_element(); x 42 >>> S.lift(x) 42 >>> S.lift(x) in S.ambient() True >>> y = S.ambient()(Integer(100)); y 100 >>> S.lift(S(y)) 42
- retract(x)[source]¶
Return 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
>>> from sage.all import * >>> S = Semigroups().Subquotients().example() >>> L = S.ambient() >>> S.retract(L(Integer(17))) 17 >>> S.retract(L(Integer(42))) 42 >>> S.retract(L(Integer(171))) 42