Next: Sample Program
Up: prolog
Previous: SWI-Prolog
Every entry into the interpreter is a goal that Prolog tries to satisfy.
Every goal in Prolog ends with ``.''.
A Prolog program consists of a database of facts, rules, and queries.
This program is, in essence, a knowledge base.
- Fact: head but no body
man(socrates).
man(plato).
- Rules: head and body
mortal(X) :- man(X).
- Questions: body but no head
mortal(X).
Use ``;'' to get next possible answer, Return to end.
Yes means true with no variables, no means not consistent with database.