Semiring

In abstract algebra, a semiring is an algebraic structure similar to a ring, but without the requirement that each element must have an additive inverse.
The term rig is also used occasionally—this originated as a joke, suggesting that rigs are ri"n"gs without "n"egative elements, similar to using "rng" to mean a r"i"ng without a multiplicative "i"dentity.
Tropical semirings are an active area of research, linking algebraic varieties with piecewise linear structures.
Definition.
A semiring is a set "R" equipped with two binary operations + and ⋅, called addition and multiplication, such that:
The symbol ⋅ is usually omitted from the notation; that is, "a"⋅"b" is just written "ab". Similarly, an order of operations is accepted, according to which ⋅ is applied before +; that is, is 
Compared to a ring, a semiring omits the requirement for inverses under addition; that is, it requires only a commutative monoid, not a commutative group. In a ring, the additive inverse requirement implies the existence of a multiplicative zero, so here it must be specified explicitly. If a semiring's multiplication is commutative, then it is called a commutative semiring.
There are some authors who prefer to leave out the requirement that a semiring have a 0 or 1. This makes the analogy between "ring" and "semiring" on the one hand and "group" and "semigroup" on the other hand work more smoothly. These authors often use "rig" for the concept defined here.
Theory.
One can generalise the theory of (associative) algebras over commutative rings directly to a theory of algebras over commutative semirings.
A semiring in which every element is an additive idempotent (that is, "a" + "a" = "a" for all elements "a") is called an . Idempotent semirings are special to semiring theory as any ring which is idempotent under addition is trivial. One can define a partial order ≤ on an idempotent semiring by setting whenever (or, equivalently, if there exists an "x" such that ). It is easy to see that 0 is the least element with respect to this order: for all "a". Addition and multiplication respect the ordering in the sense that implies and and .
Applications.
The and tropical semirings on the reals, are often used in performance evaluation on discrete event systems. The real numbers then are the "costs" or "arrival time"; the "max" operation corresponds to having to wait for all prerequisites of an events (thus taking the maximal time) while the "min" operation corresponds to being able to choose the best, less costly choice; and + corresponds to accumulation along the same path.
The Floyd–Warshall algorithm for shortest paths can thus be reformulated as a computation over a algebra. Similarly, the Viterbi algorithm for finding the most probable state sequence corresponding to an observation sequence in a Hidden Markov model can also be formulated as a computation over a algebra on probabilities. These dynamic programming algorithms rely on the distributive property of their associated semirings to compute quantities over a large (possibly exponential) number of terms more efficiently than enumerating each of them.
Examples.
By definition, any ring is also a semiring. A motivating example of a semiring is the set of natural numbers N (including zero) under ordinary addition and multiplication. Likewise, the non-negative rational numbers and the non-negative real numbers form semirings. All these semirings are commutative.
In general.
Semiring of sets.
A semiring (of sets) is a non-empty collection S of sets such that
Such semirings are used in measure theory. An example of a semiring of sets is the collection of half-open, half-closed real intervals formula_11.
Specific examples.
 := \left\{mb^{-n} \mid m, n \in \N_0 \right\}</math> in a positional number system to a given base formula_12. We have formula_13 if formula_14 divides formula_15. Furthermore, formula_16 is the ring of all terminating fractions to base formula_14, and is dense in formula_18 for formula_19.
with multiplication +, zero element +∞, and unit element 0.
Variations.
Complete and continuous semirings.
A complete semiring is a semiring for which the additive monoid is a complete monoid, meaning that it has an infinitary sum operation Σ"I" for any index set "I" and that the following (infinitary) distributive laws must hold:
Examples of a complete semiring are the power set of a monoid under union and the matrix semiring over a complete semiring.
A continuous semiring is similarly defined as one for which the addition monoid is a continuous monoid. That is, partially ordered with the least upper bound property, and for which addition and multiplication respect order and suprema. The semiring with usual addition, multiplication and order extended is a continuous semiring.
Any continuous semiring is complete: this may be taken as part of the definition.
Star semirings.
A star semiring (sometimes spelled starsemiring) is a semiring with an additional unary operator , satisfying
A Kleene algebra is a star semiring with idempotent addition. They are important in the theory of formal languages and regular expressions.
Complete star semirings.
In a complete star semiring, the star operator behaves more like the usual Kleene star: for a complete semiring we use the infinitary sum operator to give the usual definition of the Kleene star:
where formula_36
Conway semiring.
A Conway semiring is a star semiring satisfying the sum-star and product-star equations:
Every complete star semiring is also a Conway semiring, but the converse does not hold. An example of Conway semiring that is not complete is the set of extended non-negative rational numbers with the usual addition and multiplication (this is a modification of the example with extended non-negative reals given in this section by eliminating irrational numbers).
An iteration semiring is a Conway semiring satisfying the Conway group axioms, associated by John Conway to groups in star-semirings.
Examples.
Examples of star semirings include:
Dioid.
The term dioid (for "double monoid") has been used to mean various types of semirings:
Generalizations.
A generalization of semirings does not require the existence of a multiplicative identity, so that multiplication is a semigroup rather than a monoid. Such structures are called "hemirings" or "pre-semirings". A further generalization are "left-pre-semirings", which additionally do not require right-distributivity (or "right-pre-semirings", which do not require left-distributivity).
Yet a further generalization are "near-semirings": in addition to not requiring a neutral element for product, or right-distributivity (or left-distributivity), they do not require addition to be commutative. Just as cardinal numbers form a (class) semiring, so do ordinal numbers form a near-ring, when the standard ordinal addition and multiplication are taken into account. However, the class of ordinals can be turned into a semiring by considering the so-called natural (or Hessenberg) operations instead.
In category theory, a "2-rig" is a category with functorial operations analogous to those of a rig. That the cardinal numbers form a rig can be categorified to say that the category of sets (or more generally, any topos) is a 2-rig.