Here is my knowledge base:
a(b,c).
a(X,Y):-a(Y,X).
Here is my request: a(c,b).
I am using SWI-Prolog. I thought this request would print the program "true". However, instead it prints "true" and continues to print true if I hit the semicolon ... before FOREVER.
Why doesn't he stop?
My thoughts: firstly, X is associated with b and Y is associated with c. Prolog then checks a (b, c) and finds that it is true. Therefore, a (c, b) is also true, and SWI-Prolog should print true once. However, since it prints the truth forever, while I continue to hit this semicolon, it makes me think that something recursive is happening. Where is this going? Help!
EDIT: More specifically, my question is why does the program pause after each “true” and wait for me to press the semicolon or another key, and not just do it? If I have two predicates of a person (socrates) and a mortal (X): - people (X), the answer to the query mortal (socrates) will be a single "true". (Sorry if I couldn’t make it clear above.)
source
share