Next: Unification
Up: complete2
Previous: Horn Clause Logic
A query is a means of extracting information from a logic program and
consists of attempting to prove that the query is a logical
consequence of the program. We will say more about how Prolog does
this in section 1.4. When we pose a query to Prolog, we
are setting up a goal for Prolog to try to satisfy. If Prolog is able
to find facts and rules that allow it to conclude that the goal is
true, we say that the goal is `satisfied', or `succeeds'; if a goal
cannot be satisfied, we say it `fails'.
There is a major difference between the interpretations assigned to
variables in facts and queries. In facts, variables are taken as being
universally quantified; in queries, they are treated as being
existentially quantified.
As a fact in file, human(X) is equivalent to
-
`everything is human'.
As a query,
|? human(X).
corresponds to evaluating
- `is there at least
one thing that is human?'.
Steve Harlow
2001-11-26