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:
Mulitplication 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 \f$0\f$ annihilates \f$R\f$: \f$0 \times a = a \times 0\f$ for all \f$R\f$. More information about semirings can be found on [Wikipedia](https://en.wikipedia.org/wiki/Semiring).