Examples of finite monoids

sage.categories.examples.finite_monoids.Example[source]

alias of IntegerModMonoid

class sage.categories.examples.finite_monoids.IntegerModMonoid(n=12)[source]

Bases: UniqueRepresentation, Parent

An example of a finite monoid: the integers mod \(n\).

This class illustrates a minimal implementation of a finite monoid.

EXAMPLES:

sage: S = FiniteMonoids().example(); S
An example of a finite multiplicative monoid: the integers modulo 12

sage: S.category()
Category of finitely generated finite enumerated monoids
>>> from sage.all import *
>>> S = FiniteMonoids().example(); S
An example of a finite multiplicative monoid: the integers modulo 12

>>> S.category()
Category of finitely generated finite enumerated monoids

We conclude by running systematic tests on this monoid:

sage: TestSuite(S).run(verbose = True)
running ._test_an_element() . . . pass
running ._test_associativity() . . . pass
running ._test_cardinality() . . . pass
running ._test_category() . . . pass
running ._test_construction() . . . pass
running ._test_elements() . . .
  Running the test suite of self.an_element()
  running ._test_category() . . . pass
  running ._test_eq() . . . pass
  running ._test_new() . . . pass
  running ._test_not_implemented_methods() . . . pass
  running ._test_pickling() . . . pass
  pass
running ._test_elements_eq_reflexive() . . . pass
running ._test_elements_eq_symmetric() . . . pass
running ._test_elements_eq_transitive() . . . pass
running ._test_elements_neq() . . . pass
running ._test_enumerated_set_contains() . . . pass
running ._test_enumerated_set_iter_cardinality() . . . pass
running ._test_enumerated_set_iter_list() . . . pass
running ._test_eq() . . . pass
running ._test_new() . . . pass
running ._test_not_implemented_methods() . . . pass
running ._test_one() . . . pass
running ._test_pickling() . . . pass
running ._test_prod() . . . pass
running ._test_some_elements() . . . pass
>>> from sage.all import *
>>> TestSuite(S).run(verbose = True)
running ._test_an_element() . . . pass
running ._test_associativity() . . . pass
running ._test_cardinality() . . . pass
running ._test_category() . . . pass
running ._test_construction() . . . pass
running ._test_elements() . . .
  Running the test suite of self.an_element()
  running ._test_category() . . . pass
  running ._test_eq() . . . pass
  running ._test_new() . . . pass
  running ._test_not_implemented_methods() . . . pass
  running ._test_pickling() . . . pass
  pass
running ._test_elements_eq_reflexive() . . . pass
running ._test_elements_eq_symmetric() . . . pass
running ._test_elements_eq_transitive() . . . pass
running ._test_elements_neq() . . . pass
running ._test_enumerated_set_contains() . . . pass
running ._test_enumerated_set_iter_cardinality() . . . pass
running ._test_enumerated_set_iter_list() . . . pass
running ._test_eq() . . . pass
running ._test_new() . . . pass
running ._test_not_implemented_methods() . . . pass
running ._test_one() . . . pass
running ._test_pickling() . . . pass
running ._test_prod() . . . pass
running ._test_some_elements() . . . pass
class Element[source]

Bases: ElementWrapper

wrapped_class[source]

alias of Integer

an_element()[source]

Return an element of the monoid, as per Sets.ParentMethods.an_element().

EXAMPLES:

sage: M = FiniteMonoids().example()
sage: M.an_element()
6
>>> from sage.all import *
>>> M = FiniteMonoids().example()
>>> M.an_element()
6
one()[source]

Return the one of the monoid, as per Monoids.ParentMethods.one().

EXAMPLES:

sage: M = FiniteMonoids().example()
sage: M.one()
1
>>> from sage.all import *
>>> M = FiniteMonoids().example()
>>> M.one()
1
product(x, y)[source]

Return the product of two elements \(x\) and \(y\) of the monoid, as per Semigroups.ParentMethods.product().

EXAMPLES:

sage: M = FiniteMonoids().example()
sage: M.product(M(3), M(5))
3
>>> from sage.all import *
>>> M = FiniteMonoids().example()
>>> M.product(M(Integer(3)), M(Integer(5)))
3
semigroup_generators()[source]

Returns a set of generators for self, as per Semigroups.ParentMethods.semigroup_generators(). Currently this returns all integers mod \(n\), which is of course far from optimal!

EXAMPLES:

sage: M = FiniteMonoids().example()
sage: M.semigroup_generators()
Family (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)
>>> from sage.all import *
>>> M = FiniteMonoids().example()
>>> M.semigroup_generators()
Family (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)