pub struct PartialOrderChecker<T> {
pub elements: Vec<T>,
pub le: Box<dyn Fn(&T, &T) -> bool>,
}Expand description
Checker for partial-order properties on a finite set encoded as a comparison closure.
Fields§
§elements: Vec<T>Elements of the poset.
le: Box<dyn Fn(&T, &T) -> bool>The underlying partial order relation: returns true iff a ≤ b.
Implementations§
Source§impl<T: Clone + PartialEq> PartialOrderChecker<T>
impl<T: Clone + PartialEq> PartialOrderChecker<T>
Sourcepub fn new(elements: Vec<T>, le: impl Fn(&T, &T) -> bool + 'static) -> Self
pub fn new(elements: Vec<T>, le: impl Fn(&T, &T) -> bool + 'static) -> Self
Create a new checker.
Sourcepub fn check_reflexive(&self) -> bool
pub fn check_reflexive(&self) -> bool
Verify reflexivity: ∀ a, a ≤ a.
Sourcepub fn check_transitive(&self) -> bool
pub fn check_transitive(&self) -> bool
Verify transitivity: ∀ a b c, a ≤ b ∧ b ≤ c → a ≤ c.
Sourcepub fn check_antisymmetric(&self) -> bool
pub fn check_antisymmetric(&self) -> bool
Verify antisymmetry: ∀ a b, a ≤ b ∧ b ≤ a → a = b.
Sourcepub fn is_partial_order(&self) -> bool
pub fn is_partial_order(&self) -> bool
Check all three partial-order axioms at once.
Sourcepub fn maximal_elements(&self) -> Vec<T>
pub fn maximal_elements(&self) -> Vec<T>
Find all maximal elements (no strictly larger element exists).
Sourcepub fn minimal_elements(&self) -> Vec<T>
pub fn minimal_elements(&self) -> Vec<T>
Find all minimal elements.
Auto Trait Implementations§
impl<T> Freeze for PartialOrderChecker<T>
impl<T> !RefUnwindSafe for PartialOrderChecker<T>
impl<T> !Send for PartialOrderChecker<T>
impl<T> !Sync for PartialOrderChecker<T>
impl<T> Unpin for PartialOrderChecker<T>where
T: Unpin,
impl<T> UnsafeUnpin for PartialOrderChecker<T>
impl<T> !UnwindSafe for PartialOrderChecker<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more