Search code examples
prologprolog-toplevelgnu-prolog

When does Prolog prompts 'yes' and when does it says 'true'


I wrote the following knowledge base in Prolog:

likes(yamini,chocolate).
likes(anuj,apple).
likes(yamini,book).
likes(john,book).
likes(john,france).

Now, when I consult the above file and try the following commands:

| ?- likes(anuj,apple).      

(1 ms) yes
| ?- likes(yamini,chocolate).

true ? ;

no

I want to understand when does Prolog replies a 'yes' versus when does it replies 'true'.


Solution

  • That output depends on the toplevel you are using. It seems you are using GProlog. It will output yes when the query succeeds and there are no choice points left (no other possible solutions).

    And it will answer true when the query succeeds but there are still other possible solutions to be checked.