Prolog/Glossary

This is a glossary of common Prolog terms.


 * Argument
 * Arguments are terms that appear in a compound term. E.g. A1 and a2 are the first and the second argument of the term.


 * Arity
 * The number of arguments that a predicate takes. E.g.  has arity 2. In documentation, the arity of a predicate is written as predicate/arity. E.g..


 * Backtracking
 * If a sub-goal fails, the built-in Prolog search mechanism will go back to the parent-goal. Any variables that were instantiated in the sub-goal will be un-instantiated. Prolog will then search for a new way of satisfying the sub-goal. This process is called backtracking.


 * Clause
 * A single clause of a relation, usually defined as Head :- Body, but see also fact.

Also called structure. It consists of a name followed by N arguments, each of which are terms. N is called the arity of the term.
 * Compound term
 * Fact
 * A clause with no body, that is a head on its own.


 * Functor
 * Combination of name and arity of a compound term. The term  is said to be a term belonging to the functor foo/3 . foo/0 is used to refer to the atom foo.


 * Goal
 * Question stated to the Prolog engine. A goal is either an atom or a compound term. A goal succeeds, in which case the variables in the compound terms have a binding or fails if Prolog fails to prove the goal.


 * Ground Term
 * A Term which has no logic variables in it.


 * Predicate
 * A set of clauses or a relation.


 * Query
 * See goal.


 * Relation
 * Synonym for Predicate.


 * Recursion/Recursive
 * Definition missing


 * Rule
 * See clause.


 * Term
 * Every object in Prolog is a term, that includes variables, compounds, numbers, source code.


 * Unification
 * Prolog process to make two terms equal by assigning variables in one term to values at the corresponding location of the other term. E.g.,

Unlike assignment, which does not exist in Prolog, unification is not directed.
 * Singleton Variable
 * If a variable is named only once in a clause, usually it is replace with _.