I am very new to Prolog programming. Any help is greatly appreciated. I have the following program,
bigger(elephant, horse).
bigger(horse, donkey).
bigger(donkey, dog).
bigger(donkey, monkey).
is_bigger(X, Y) :- bigger(X, Y).
is_bigger(X, Y) :- is_bigger(Z, Y), bigger(X,Z).
On running the query,
?- is_bigger(A, donkey)
I get the following output,
A = horse ;
A = elephant ;
ERROR: Out of local stack
While I do somewhat understand how A = horse and A = elephant, I am having a difficult time understanding why it's recursing infinitely (I used the builtin trace trace predicate but couldn't understand it after A = elephant).
Thank you.