An equivalence relation is a boolean-returning function of two arguments that returns true when two values are equivalent, according to some notion of equivalence. The details of what counts as equivalent vary based on the equivalence relation used, but all equivalence relations should obey the following laws:
Reflexive property —
every value should always be equivalent to itself, meaning (equivalence-relation-holds? rel x x) is always true.
Symmetric property —
if two values are equivalent, then the order in which they are given to the function should not matter, meaning (equivalence-relation-holds? rel x y) implies (equivalence-relation-holds? rel y x).
Transitive property —
if x is equivalent to y, and y is equivalent to z, then x must be equivalent to z.
relation : equivalence-relation? x : any/c y : any/c
> (equivalence-relation-holds? natural-equality 1 1)
> (equivalence-relation-holds? natural-equality 1 2)
(make-equivalence-relation function [ #:name name]) → equivalence-relation? function : (-> any/c any/c boolean?) name : (or/c interned-symbol? #f) = #f
→ (-> any/c any/c boolean?) relation : equivalence-relation?
relation : equivalence-relation? f : (-> any/c any/c)