I need to see if there are three people such that at least two are from the group g1. I wrote:
ingroup(person1, g1).
ingroup(person2, g1).
ingroup(person3, g1).
ingroup(person4, g2).
ingroup(person5, g2).
test_ok :- ingroup(X,g1),ingroup(Y,g1), ingroup(Z,G), diff(X,Y,Z).
diff(X,Y,Z) :- X =\= Y, X =\= Z, Y =\= Z.
This gives the following error in SWI Prolog:
68 ?- test_ok.
ERROR: =\=/2: Arithmetic: `person1/0' is not a function.
Where am I going wrong?