The Mercury Language Reference Manual

(1)

If equalitypred is not an equivalence relation, then the program is inconsistent: its declarative semantics contains a contradiction, because the additional axioms for the user-defined equality contradict the standard equality axioms. That implies that the implementation may compute any answer at all (see section Semantics), i.e. the behaviour of the program is undefined.