Logic error?

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 doing the query:

avô(X, Y).

SWI-Prolog returns me:

X = gil,
Y = noé ;
X = gil,
Y = gal ;
X = ivo,
Y = noé ;
false.

I thought it should return 'true', but I did not understand if I made a logic error because I can not identify it, I'd like to know the reason for returning 'false'. Thank you.

    
asked by anonymous 12.08.2014 / 14:07

1 answer

5

There is no error in your code. The prolog is returning all pairs (X,Y) that satisfy the query avo(X,Y) .

It would return true if you asked a question where both "variables" X and Y "have some value":

avo(gil, noe)

for example.

    
12.08.2014 / 14:10