This section explains the basic concepts of Prolog programs by means of simple examples. At the end of the section, the following will summarize the topics that have been touched:
programming consists of defining relations and querying about
program consists of facts and rules, which we
collectively call clauses. A set of facts and rules about the
same relation is called a predicate.
about relations, by means of goals, resembles querying a
database. Prolog's answer to a query consists of a set of objects
that satisfy the question (query).
Prolog, to establish whether an object satisfies a query is often a
complicated process that involves logical inference and exploring
among alternatives. All this is done automatically by the Prolog
system and is, in principle, hidden from the user.
types of interpretation (or meaning) of Prolog programs are
distinguished: declarative and procedural.
following concepts have been discussed: Clause, fact, rule, query,
goal, head and body of a rule, recursive rule, predicate, variable,
a goal succeeds or fails.
built-in predicates allow for arithmetic calculations, with a
notation similar to the one of well-established procedural
programming languages (e.g. Java). Arithmetic assignment is achieved
by the is predicate.