Non Negative Integer Semiring

class sage.rings.semirings.non_negative_integer_semiring.NonNegativeIntegerSemiring[source]

Bases: NonNegativeIntegers

A class for the semiring of the nonnegative integers.

This parent inherits from the infinite enumerated set of non negative integers and endows it with its natural semiring structure.

EXAMPLES:

sage: NonNegativeIntegerSemiring()
Non negative integer semiring
>>> from sage.all import *
>>> NonNegativeIntegerSemiring()
Non negative integer semiring
NonNegativeIntegerSemiring()

For convenience, NN is a shortcut for NonNegativeIntegerSemiring():

sage: NN == NonNegativeIntegerSemiring()
True

sage: NN.category()
Category of facade infinite enumerated commutative semirings
>>> from sage.all import *
>>> NN == NonNegativeIntegerSemiring()
True

>>> NN.category()
Category of facade infinite enumerated commutative semirings
NN == NonNegativeIntegerSemiring()
NN.category()

Here is a piece of the Cayley graph for the multiplicative structure:

sage: G = NN.cayley_graph(elements=range(9), generators=[0,1,2,3,5,7])          # needs sage.graphs
sage: G                                                                         # needs sage.graphs
Looped multi-digraph on 9 vertices
sage: G.plot()                                                                  # needs sage.graphs sage.plot
Graphics object consisting of 48 graphics primitives
>>> from sage.all import *
>>> G = NN.cayley_graph(elements=range(Integer(9)), generators=[Integer(0),Integer(1),Integer(2),Integer(3),Integer(5),Integer(7)])          # needs sage.graphs
>>> G                                                                         # needs sage.graphs
Looped multi-digraph on 9 vertices
>>> G.plot()                                                                  # needs sage.graphs sage.plot
Graphics object consisting of 48 graphics primitives
G = NN.cayley_graph(elements=range(9), generators=[0,1,2,3,5,7])          # needs sage.graphs
G                                                                         # needs sage.graphs
G.plot()                                                                  # needs sage.graphs sage.plot

This is the Hasse diagram of the divisibility order on NN.

sage: Poset(NN.cayley_graph(elements=[1..12], generators=[2,3,5,7,11])).show() # needs sage.combinat sage.graphs sage.plot

Note: as for NonNegativeIntegers, NN is currently just a “facade” parent; namely its elements are plain Sage Integers with Integer Ring as parent:

sage: x = NN(15); type(x)
<class 'sage.rings.integer.Integer'>
sage: x.parent()
Integer Ring
sage: x+3
18
>>> from sage.all import *
>>> x = NN(Integer(15)); type(x)
<class 'sage.rings.integer.Integer'>
>>> x.parent()
Integer Ring
>>> x+Integer(3)
18
x = NN(15); type(x)
x.parent()
x+3
additive_semigroup_generators()[source]

Return the additive semigroup generators of self.

EXAMPLES:

sage: NN.additive_semigroup_generators()
Family (0, 1)
>>> from sage.all import *
>>> NN.additive_semigroup_generators()
Family (0, 1)
NN.additive_semigroup_generators()