Search code examples
prologvisual-prolog

How can i define different in Prolog?


How can i define that two variables are not equal in Prolog? For example :

z is X and Y parent

X is male and Y is female

Now i want find sisters or brothers. But Prolog result is:

Y sister Y when parent have one child and not have X

Now i want define:

different(X,y).

I think old or other version of Visual Prolog have "different" in library but i dont find this in new Visual Prolog. What can i do?


Solution

  • define two variables are not equal in Prolog:

    X \= Y
    not(X = Y)
    \+ (X = Y)