Commutative additive monoids

class sage.categories.commutative_additive_monoids.CommutativeAdditiveMonoids(s=None)

Bases: sage.categories.category_singleton.Category_singleton

The category of abelian monoids semigroups with an additive identity element

EXAMPLES:

sage: CommutativeAdditiveMonoids()
Category of commutative additive monoids
sage: CommutativeAdditiveMonoids().super_categories()
[Category of commutative additive semigroups]
sage: CommutativeAdditiveMonoids().all_super_categories()
[Category of commutative additive monoids, Category of commutative additive semigroups, Category of additive magmas, Category of sets, Category of sets with partial maps, Category of objects]

TESTS:

sage: TestSuite(CommutativeAdditiveMonoids()).run()
class ElementMethods
class CommutativeAdditiveMonoids.ParentMethods
sum(args)

n-ary sum

INPUT:

  • args – a list (or iterable) of elements of self

Returns the sum of the elements in \(args\), as an element of \(self\).

EXAMPLES:

sage: S = CommutativeAdditiveMonoids().example()
sage: (a,b,c,d) = S.additive_semigroup_generators()
sage: S.sum((a,b,a,c,a,b))
3*a + c + 2*b
sage: S.sum(())
0
sage: S.sum(()).parent() == S
True
zero()

Returns the zero of the abelian monoid, that is the unique neutral element for \(+\).

The default implementation is to coerce 0 into self.

It is recommended to override this method because the coercion from the integers:

  • is not always meaningful (except for \(0\)),
  • often uses self.zero() otherwise.

EXAMPLES:

sage: S = CommutativeAdditiveMonoids().example()
sage: S.zero()
0
zero_element()

Backward compatibility alias for self.zero()

TESTS:

sage: S = CommutativeAdditiveMonoids().example()
sage: S.zero_element()
0
class CommutativeAdditiveMonoids.WithRealizations(category, *args)

Bases: sage.categories.with_realizations.WithRealizationsCategory

TESTS:

sage: from sage.categories.covariant_functorial_construction import CovariantConstructionCategory
sage: class FooBars(CovariantConstructionCategory):
...       _functor_category = "FooBars"
sage: Category.FooBars = lambda self: FooBars.category_of(self)
sage: C = FooBars(ModulesWithBasis(ZZ))
sage: C
Category of foo bars of modules with basis over Integer Ring
sage: C.base_category()
Category of modules with basis over Integer Ring
sage: latex(C)
\mathbf{FooBars}(\mathbf{ModulesWithBasis}_{\Bold{Z}})
sage: import __main__; __main__.FooBars = FooBars # Fake FooBars being defined in a python module
sage: TestSuite(C).run()
ParentMethods

alias of WithRealizations.ParentMethods

CommutativeAdditiveMonoids.super_categories()

EXAMPLES:

sage: CommutativeAdditiveMonoids().super_categories()
[Category of commutative additive semigroups]

Previous topic

Commutative additive groups

Next topic

Commutative additive semigroups

This Page