eats(Person, Thing) :- likes(Person, Thing), food(Thing).
This says that a
Thing if the
Thing, and the
that Prolog has no notion of the meanings of
food, so for Prolog the rule is simply abstract symbol
manipulation. However, presumably the author of the rule intended to
have the meaning stated above. It would be possible to write the
e(P, T) :- l(P, T), f(T). or even
xx(X1, X2) :- xxx(X1, X2), xxxx(X2). Obviously
the rule is much more readable if meaningful procedure names and
variable names are used.
Sometimes, in a "rule", the body may be empty:
This says that the Item is a member of any list (the second argument) of which it is the first member. Here, no special condition needs to be satisfied to make the head true - it is always true.
Such rules can be re-expressed so that they have a body - e.g.
member(Item, [Head|Rest]) :- Head = Item.
This forces Prolog to perform another step
Head = Item)
so it is deprecated.
Sometimes in a rule, there might be no variables, or none in the head of the rule:
start_system :- initialise, invoke_system, finalise.
Such rules tend to have a very procedural style, effectively specifying a sequence of steps that need to be done in sequence. It's a look that is best avoided, or at least minimised.
See also fact.