Your little program actually works, upto a point. Are you aware that you should press ‘;’ after each answer?
The problem is that once you get all the answers you will fall into infinite recursion. You can sidestep that by renaming the recursive predicate.
eat(lion, dog).
eat(dog, cat).
eat(cat, bird).
eat(bird, spider).
eat(spider, fly).
eats(A, B) :-eat(A, B).
eats(A, C) :-eat(A, B), eats(B, C).
eats_what(X) :-
eats(X, Y),
write(X), write(' ate the '), write(Y), nl, fail.
eats_what(_) :-
write("That is all, folks!").
31 ~/tmp/prolog> swipl
Welcome to SWI-Prolog (threaded, 64 bits, version 7.4.2)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.
For built-in help, use ?- help(Topic). or ?- apropos(Word).
?- [eats].
true.
?- eats_what(lion).
lion ate the dog
lion ate the cat
lion ate the bird
lion ate the spider
lion ate the fly
That is all, folks!
true.
?-
Hope this helps a little. :-)