BoundedMeetSemilattice

Trait BoundedMeetSemilattice 

Source
pub trait BoundedMeetSemilattice: MeetSemilattice {
    // Required method
    fn top() -> Self;

    // Provided method
    fn meet_all_from_top<I>(it: I) -> Self
       where I: IntoIterator<Item = Self> { ... }
}
Expand description

A bounded meet-semilattice: a meet-semilattice with a top element.

Laws (not enforced by type system):

  • Associative: a.meet(b).meet(c) == a.meet(b.meet(c))
  • Commutative: a.meet(b) == b.meet(a)
  • Idempotent: a.meet(a) == a
  • Identity: top().meet(a) == a == a.meet(top())

The top element (⊤) is the greatest element in the partial order.

§Example

use algebra_core::{BoundedMeetSemilattice, MeetSemilattice};

// For bool: top = true, meet = AND
let a = true;
let top = bool::top();
assert_eq!(top, true);
assert_eq!(top.meet(&a), a);
assert_eq!(a.meet(&top), a);

Required Methods§

Source

fn top() -> Self

The top element of the lattice (⊤).

This is the greatest element w.r.t. the induced partial order: for all x, top().meet(x) == x.

Provided Methods§

Source

fn meet_all_from_top<I>(it: I) -> Self
where I: IntoIterator<Item = Self>,

Meet a finite iterator of values, starting from ⊤.

Never returns None: an empty iterator produces top().

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl BoundedMeetSemilattice for bool

Source§

fn top() -> Self

Source§

impl BoundedMeetSemilattice for ()

Source§

fn top() -> Self

Source§

impl<A> BoundedMeetSemilattice for (A,)

Source§

fn top() -> Self

Source§

impl<A, B> BoundedMeetSemilattice for (A, B)

Source§

fn top() -> Self

Source§

impl<A, B, C> BoundedMeetSemilattice for (A, B, C)

Source§

fn top() -> Self

Source§

impl<A, B, C, D> BoundedMeetSemilattice for (A, B, C, D)

Source§

fn top() -> Self

Source§

impl<L: BoundedMeetSemilattice + Clone> BoundedMeetSemilattice for Option<L>

Source§

fn top() -> Self

Implementors§