A trait for representing equivalence relations. It is important to distinguish between a type that can be compared for equality or equivalence and a representation of equivalence on some type. This trait is for representing the latter.
Anequivalence relation is a binary relation on a type. This relation is exposed as theequiv method of theEquiv trait. The relation must be:
reflexive:equiv(x, x) == true for any x of typeT.
symmetric:equiv(x, y) == equiv(y, x) for anyx andy of typeT.
transitive: ifequiv(x, y) == true andequiv(y, z) == true, thenequiv(x, z) == true for anyx,y, andz of typeT.
Returnstrue iffx is equivalent toy.
Returnstrue iffx is equivalent toy.