A semiring is a set together with two binary operators satisfying the following conditions:
1. Additive associativity: For all ,
,
2. Additive commutativity: For all ,
,
3. Multiplicative associativity: For all ,
,
4. Left and right distributivity: For all ,
and
.
A semiring is therefore a commutative semigroup under addition and a semigroup under multiplication. A semiring can be empty.