Function lattices::algebra::semiring

source ·
pub fn semiring<S: Debug + PartialEq + Clone, const N: usize>(
    items: &[S; N],
    f: &impl Fn(S, S) -> S,
    g: &impl Fn(S, S) -> S,
    zero: S,
    one: S
) -> Result<(), &'static str>
Expand description

Defines a semiring structure. A semiring is a set of items along with two associative binary operations f and g, and two identity elements zero and one. f must be commutative and g must distribute over f. the zero of f must also be absorbing with respect to g.