dif/2 is a Prolog built-in predicate to express in a sound manner syntactic inequality.

dif/2 is a Prolog built-in predicate to express in a sound manner syntactic inequality, also called disequality of terms. dif/2 is true if and only if its arguments are different terms. Hence the name, which is short for "different".

dif/2 is available directly in B, Prolog IV, SICStus, SWI, YAP and as a library in Ciao, IF, XSB. It was available already in the very first Prolog system, Prolog 0.

dif/2 cannot be directly expressed in ISO Prolog, but a safe approximation is still possible.

Further reading: