Symbols in Prolog

In Prolog, symbols (or atoms) are the main primitive data types, similar to numbers. The exact notation may differ in different Prolog dialects. However, it is always quite simple (no quotations or special beginning characters are necessary).

Contrary to many other languages, it is possible to give symbols a meaning by creating some Prolog facts and/or rules.

Examples

The following example demonstrates two facts (describing what father is) and one rule (describing the meaning of sibling). These three sentences use symbols (father, zeus, hermes, perseus and sibling) and some abstract variables (X, Y and Z). The mother relationship is omitted for clarity.

father(zeus, hermes).
father(zeus, perseus).

sibling(X, Y) :- father(Z, X), father(Z, Y).