5
I have the following code:
mãe(ana, eva).
mãe(eva, noé).
mãe(bia, raí).
mãe(bia, clô).
mãe(bia, ary).
mãe(lia, gal).
pai(ivo, eva).
pai(raí, noé).
pai(gil, raí).
pai(gil, clô).
pai(gil, ary).
pai(ary, gal).
avô(X, Y) :- pai(X, Z), pai(Z, Y); pai(X, Z), mãe(Z, Y).
When making the consultation:
avô(X, Y).
SWI-Prolog returns to me:
X = gil,
Y = noé ;
X = gil,
Y = gal ;
X = ivo,
Y = noé ;
false.
I thought it should return 'true', but I didn’t understand if I made a logic error because I can’t identify it, I would like to know the reason to return 'false' (I’m quite beginner). Thank you.
Thank you for clarifying.
– Wellington Viana
+1 just complementing: it returns
false
because you asked for "more results" (command;
) after all possible results had already been explored. That is, thefalse
You mean, "More results? No."– mgibsonbr