Skip to main content

Setoid

Trait Setoid 

Source
pub trait Setoid {
    // Required method
    fn equiv(&self, other: &Self) -> bool;

    // Provided methods
    fn refl(&self) -> bool { ... }
    fn symm(&self, other: &Self) -> bool { ... }
}
Expand description

A setoid: a type equipped with an equivalence relation.

This is the Rust-level analogue of Lean 4’s Setoid typeclass, used for quotiented types and proof-irrelevant equality.

Required Methods§

Source

fn equiv(&self, other: &Self) -> bool

The equivalence relation.

Provided Methods§

Source

fn refl(&self) -> bool

Reflexivity of the equivalence.

Source

fn symm(&self, other: &Self) -> bool

Symmetry: if self ~ other then other ~ self.

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.

Implementors§

Source§

impl<T: PartialEq> Setoid for T