Module herbrand

This Jekejeke Minlog module provides a subject to occurs check constraint sto/1 and a term inequality constraint dif/2. To allow good performance both constraints perform an attribute variable verification before their attribute variables are instantiated and new sub constraints are registered:

?- sto(X), X = f(X).
?- dif(f(X,X), f(Y,Z)), X = Y.
Y = X,
dif(X, Z)

The subject to occurs check has to be initially called with an acyclic term, but it will subsequently assure the subject to occurs check as required. The subject to occurs check is ordered so that it is always checked before some inequality constraint is checked against the same variable.

The following herbrand predicates are provided.

The predicate continues the subject to occurs check for the term T. The term T has to be acyclic when calling this predicate.
dif(S, T):
The predicate checks S and T for inequality and establishes variable constraints, so that this inequality is maintained in the continuation. The inequality neither decides for or against the occurs check.