Examples of commutative additive semigroups

sage.categories.examples.commutative_additive_semigroups.Example
alias of FreeCommutativeAdditiveSemigroup
class sage.categories.examples.commutative_additive_semigroups.FreeCommutativeAdditiveSemigroup(alphabet=('a', 'b', 'c', 'd'))

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

An example of a commutative additive monoid: the free commutative monoid

This class illustrates a minimal implementation of a commutative additive monoid.

EXAMPLES:

sage: S = CommutativeAdditiveSemigroups().example(); S
An example of a commutative monoid: the free commutative monoid generated by ('a', 'b', 'c', 'd')

sage: S.category()
Category of commutative additive semigroups

This is the free semigroup generated by:

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

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

sage: (a,b,c,d) = S.additive_semigroup_generators()

We conclude by running systematic tests on this commutative monoid:

sage: TestSuite(S).run(verbose = True)
running ._test_additive_associativity() . . . pass
running ._test_an_element() . . . pass
running ._test_category() . . . pass
running ._test_elements() . . .
  Running the test suite of self.an_element()
  running ._test_category() . . . pass
  running ._test_eq() . . . pass
  running ._test_not_implemented_methods() . . . pass
  running ._test_pickling() . . . pass
  pass
running ._test_elements_eq() . . . pass
running ._test_eq() . . . pass
running ._test_not_implemented_methods() . . . pass
running ._test_pickling() . . . pass
running ._test_some_elements() . . . pass
class Element(iterable, parent)
Bases: sage.structure.element_wrapper.ElementWrapper
FreeCommutativeAdditiveSemigroup.additive_semigroup_generators(*args, **kwds)

Returns the generators of the semigroup.

EXAMPLES:

sage: F = CommutativeAdditiveSemigroups().example()
sage: F.additive_semigroup_generators()
Family (a, b, c, d)
FreeCommutativeAdditiveSemigroup.an_element()

Returns an element of the semigroup.

EXAMPLES:

sage: F = CommutativeAdditiveSemigroups().example()
sage: F.an_element()
a + 3*c + 2*b + 4*d
FreeCommutativeAdditiveSemigroup.summation(x, y)

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

EXAMPLES:

sage: F = CommutativeAdditiveSemigroups().example()
sage: (a,b,c,d) = F.additive_semigroup_generators()
sage: F.summation(a,b)
a + b
sage: (a+b) + (a+c)
2*a + c + b

Previous topic

Examples of commutative additive monoids

Next topic

Examples of Coxeter groups

This Page