Like lists, clauses have two parts, head and tail.
Head :- Tail. Head.In the second clause, the tail is assumed to be
true
.
Variables which appear in the head of the clause are universally quantified.
d( U+V, X, A+B ) :- d( U, X, A ), d( V, X, B ).
Variables which appear only in the tail of the clause are existentially quantified.
is_grandparent_of(X, Z) :- is_parent_of(X, Y), is_parent_of(Y, Z).
Read this as
X is a grandparent of Z if there is some Y for which X is a parent of Y and Y is a parent of Z.
These are the only quantifications possible. You can't write explicit quantifiers into a clause (though they can sometimes be simulated with various programming tricks).