Semiring¶
-
template<typename
T
>
classSemiring
¶ Defined in
semiring.hpp
.This class its subclasses provide very basic functionality for creating semirings.
A semiring is a set \(R\) together with two binary operations \(+\) and \(\times\) (called addition and multiplication) such that \((R, +)\) is a commutative monoid with identity \(0\), \((R, \times)\) is a monoid with identity \(1\), and the following hold:
Multiplication is left and right distributive over addition, i.e. \(a \times (b + c) = a \times b + a \times c\) and \((a + b) \times c = (a \times c) + (b \times c)\) for all \(a,b,c\in R\);
Multiplication by \(0\) annihilates \(R\): \(0 \times a = a \times 0\) for all \(R\).
More information about semirings can be found on Wikipedia.