### Navigation

- index
- modules |
- next |
- previous |
- Category Theory »

# Additive monoids

class `sage.categories.additive_monoids.``AdditiveMonoids`(base_category)

  Bases: `sage.categories.category_with_axiom.CategoryWithAxiom_singleton`

  The category of additive monoids.

  An additive monoid is a unital class:\(additive semigroup <sage.categories.additive_semigroups.AdditiveSemigroups>\), that is a set endowed with a binary operation \(+\) which is associative and admits a zero (see Wikipedia article Monoid).

  EXAMPLES:

      sage: from sage.categories.additive_monoids import AdditiveMonoids
      sage: C = AdditiveMonoids(); C
      Category of additive monoids
      sage: C.super_categories()
      [Category of additive unital additive magmas, Category of additive semigroups]
      sage: sorted(C.axioms())
      ['AdditiveAssociative', 'AdditiveUnital']
      sage: from sage.categories.additive_semigroups import AdditiveSemigroups
      sage: C is AdditiveSemigroups().AdditiveUnital()
      True

  TESTS:

      sage: C.Algebras(QQ).is_subcategory(AlgebrasWithBasis(QQ))
      True
      sage: TestSuite(C).run()

  `AdditiveCommutative`

    alias of `CommutativeAdditiveMonoids`

  `AdditiveInverse`

    alias of `AdditiveGroups`

  class `Homsets`(category, *args)

    Bases: `sage.categories.homsets.HomsetsCategory`

    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()

    `extra_super_categories`()

      Implement the fact that a homset between two monoids is associative.

      EXAMPLES:

          sage: from sage.categories.additive_monoids import AdditiveMonoids
          sage: AdditiveMonoids().Homsets().extra_super_categories()
          [Category of additive semigroups]
          sage: AdditiveMonoids().Homsets().super_categories()
          [Category of homsets of additive unital additive magmas, Category of additive monoids]

      Todo

      This could be deduced from `AdditiveSemigroups.Homsets.extra_super_categories()`. See comment in `Objects.SubcategoryMethods.Homsets()`.

  class `AdditiveMonoids.``ParentMethods`
    `sum`(args)

      Return the sum of the elements in `args`, as an element of `self`.

      INPUT:

      - `args` – a list (or iterable) of elements 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

### Navigation

- index
- modules |
- next |
- previous |
- Category Theory »