pub struct SetoidInstance<T> {
pub carrier: Vec<T>,
pub equiv: fn(&T, &T) -> bool,
}Expand description
A setoid: a Rust type equipped with an explicit equivalence relation.
Mirrors the Lean 4 Setoid typeclass for use at the meta level.
Fields§
§carrier: Vec<T>A representative finite sample of carrier elements.
equiv: fn(&T, &T) -> boolThe equivalence relation: equiv(a, b) iff a ~ b.
Implementations§
Source§impl<T> SetoidInstance<T>
impl<T> SetoidInstance<T>
Sourcepub fn new(carrier: Vec<T>, equiv: fn(&T, &T) -> bool) -> Self
pub fn new(carrier: Vec<T>, equiv: fn(&T, &T) -> bool) -> Self
Create a new setoid from a carrier sample and an equivalence function.
Sourcepub fn check_refl(&self) -> bool
pub fn check_refl(&self) -> bool
Verify reflexivity for all carrier elements.
Sourcepub fn check_symm(&self) -> bool
pub fn check_symm(&self) -> bool
Verify symmetry for all pairs in the carrier.
Sourcepub fn check_trans(&self) -> bool
pub fn check_trans(&self) -> bool
Verify transitivity for all triples in the carrier.
Auto Trait Implementations§
impl<T> Freeze for SetoidInstance<T>
impl<T> RefUnwindSafe for SetoidInstance<T>where
T: RefUnwindSafe,
impl<T> Send for SetoidInstance<T>where
T: Send,
impl<T> Sync for SetoidInstance<T>where
T: Sync,
impl<T> Unpin for SetoidInstance<T>where
T: Unpin,
impl<T> UnsafeUnpin for SetoidInstance<T>
impl<T> UnwindSafe for SetoidInstance<T>where
T: UnwindSafe,
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