is_dog(fido). is_dog(rex). is_dog(rover).
A binary relation is a set of pairs all of which are related in the same way. Example:
eats(fido, biscuits). eats(rex, chocolate). eats(rover, cheese). eats(lassie, bone).
Similarly for ternary relations (triples) and so on.
In the examples above,
the functors for the relations. Prolog stores
information in the form of relations, or more specifically
relational instances, like those above, and also in the form of
It is also possible in Prolog to have nullary relations (a relation with no arguments), though they are perhaps not often used. Example:
This could be used as a goal in a query:
?- program_untested. true.
Possibly a better way to do this would be to use a unary relation:
However, the point is that nullary relations are there in Prolog, should you find a use for them.
See also the the next entry for more detail.