Search code examples
prologterminologyiso-prolog

Prolog jargon: id(X,X). fact or rule?


In Prolog, this is unambiguously a fact:

foo(bar).

And this is unambiguously a rule:

foo(X) :- bar(X).

But what about a clause that has both non-singleton variables and no :- such as

identity(X,X).

or more realistically something like

my_member(X, [X|_]).

I've been calling these rules since I learned Prolog, but now that I've tried to check to be 100% sure, I can't seem to find any source making a stronger distinction than what I have in the first two examples.

So is a rule:

  • a clause that defines a variable logical relationship, i.e. a clause that will not always succeed.
  • a clause that that defines a relationship between predicates (or possibly a predicate and itself).

Solution

  • Sometimes terminology itself causes problems the actual Prolog systems do not have at all. In common terminology as well as standard terminology, both identity(X,X). and my_member(X, [X|_]). are facts. However, better use clause when this seems fit.

    The unease stems from the set of solutions that are implied by such cases. In fact, there is an infinity of solutions for both examples. Otherwise, ground facts just describe one solution each. Sticking to ground facts only, simplifies bottom-up interpretations.

    So what about the clause a :- true. Is it a fact or a rule? It uses a rule-atom. but it's body is true. A Note in 3.72 excludes (:-)/2 as principal functor of facts. Well, all of this is a clear indication that terminology is here a bit too fine grained.

    So, stick as much as you can to clause.