D Glossary of Terms

anonymous [variable]
The variable _ is called the anonymous variable. Multiple occurrences of _ in a single term are not shared.
arguments
Arguments are terms that appear in a compound term. A1 and a2 are the first and second argument of the term myterm(A1, a2).
arity
Argument count (is number of arguments) of a compound term.
assert
Add a clause to a predicate. Clauses can be added at either end of the clause-list of a predicate. See assert/1 and assertz/1.
atom
Textual constant. Used as name for compound terms, to represent constants or text.
backtracking
Searching process used by Prolog. If a predicate offers multiple clauses to solve a goal, they are tried one-by-one until one succeeds. If a subsequent part of the proof is not satisfied with the resulting variable binding, it may ask for an alternative solution (= binding of the variables), causing Prolog to reject the previously chosen clause and try the next one.
binding [of a variable]
Current value of the variable. See also backtracking and query.
built-in [predicate]
Predicate that is part of the Prolog system. Built in predicates cannot be redefined by the user, unless this is overruled using redefine_system_predicate/1.
body
Part of a clause behind the neck operator (:-).
clause
`Sentence' of a Prolog program. A clause consists of a head and body separated by the neck operator (:-) or it is a fact. For example:
parent(X) :-
        father(X, _).

Expressed ``X is a parent if X is a father of someone''. See also variable and predicate.

compile
Process where a Prolog program is translated to a sequence of instructions. See also interpreted. SWI-Prolog always compiles your program before executing it.
compound [term]
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.
context module
If a term is referring to a predicate in a module, the context module is used to find the target module. The context module of a goal is the module in which the predicate is defined, unless this predicate is module transparent, in which case the context module is inherited from the parent goal. See also module_transparent/1.
dynamic [predicate]
A dynamic predicate is a predicate to which clauses may be asserted and from which clauses may be retracted while the program is running. See also update view.
exported [predicate]
A predicate is said to be exported from a module if it appears in the public list. This implies that the predicate can be imported into another module to make it visible there. See also use_module/[1,2].
fact
Clause without a body. This is called a fact because interpreted as logic, there is no condition to be satisfied. The example below states john is a person.
person(john).
fail
A goal is said to haved failed if it could not be proven.
float
Computers crippled representation of a real number. Represented as `IEEE double'.
foreign
Computer code expressed in other languages than Prolog. SWI-Prolog can only cooperate directly with the C and C++ computer languages.
functor
Combination of name and arity of a compound term. The term foo(a, b, c) 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.
hashing
Indexing technique used for quick lookup.
head
Part of a clause before the neck instruction. This is an atom or compound term.
imported [predicate]
A predicate is said to be imported into a module if it is defined in another module and made available in this module. See also chapter 5.
indexing
Indexing is a technique used to quickly select candidate clauses of a predicate for a specific goal. In most Prolog systems, including SWI-Prolog, indexing is done on the first argument of the head. If this argument is instantiated to an atom, integer, float or compound term with functor, hashing is used quickly select all clauses of which the first argument may unify with the first argument of the goal.
integer
Whole number. On all implementations of SWI-Prolog integers are at least 64-bit signed values. When linked to the GNU GMP library, integer arithmetic is unbounded. See also current_prolog_flag/2, flags bounded, max_integer and min_integer.
interpreted
As opposed to compiled, interpreted means the Prolog system attempts to prove a goal by directly reading the clauses rather than executing instructions from an (abstract) instruction set that is not or only indirectly related to Prolog.
meta-predicate
A predicate that reasons about other predicates, either by calling them, (re)defining them or querying properties.
module
Collection of predicates. Each module defines a name-space for predicates. built-in predicates are accessible from all modules. Predicates can be published (exported) and imported to make their definition available to other modules.
module transparent [predicate]
A predicate that does not change the context module. Sometimes also called a meta-predicate.
multifile [predicate]
Predicate for which the definition is distributed over multiple source-files. See multifile/1.
neck
Operator (:-) separating head from body in a clause.
operator
Symbol (atom) that may be placed before its operand (prefix), after its operand (postfix) or between its two operands (infix).

In Prolog, the expression a+b is exactly the same as the canonical term +(a,b).

operand
Argument of an operator.
precedence
The priority of an operator. Operator precedence is used to interpret a+b*c as +(a, *(b,c)).
predicate
Collection of clauses with the same functor (name/arity). If a goal is proved, the system looks for a predicate with the same functor, then used indexing to select candidate clauses and then tries these clauses one-by-one. See also backtracking.
predicate indicator
Term of the form Name/Arity (traditional) or Name//Arity (ISO DCG proposal) where Name is an atom an Arity a non-negative integer. It acts as an indicator (or reference) to a predicate or DCG rule.
priority
In the context of operators a synonym for precedence.
program
Collection of predicates.
property
Attribute of an object. SWI-Prolog defines various *_property predicates to query the status of predicates, clauses. etc.
prove
Process where Prolog attempts to prove a query using the available predicates.
public list
List of predicates exported from a module.
query
See goal.
retract
Remove a clause from a predicate. See also dynamic, update view and assert.
shared
Two variables are called shared after they are unified. This implies if either of them is bound, the other is bound to the same value:
?- A = B, A = a.

A = a,
B = a
singleton [variable]
Variable appearing only one time in a clause. SWI-Prolog normally warns for this to avoid you making spelling mistakes. If a variable appears on purpose only once in a clause, write it as _ (see anonymous). Rules for naming a variable and avoiding a warning are given in section 2.15.1.5.
solution
Bindings resulting from a successfully proven goal.
structure
Synonym for compound term.
string
Used for the following representations of text: a packed array (see section 4.23), SWI-Prolog specific), a list of character codes or a list of one-character atoms.
succeed
A goal is said to have succeeded if it has been proven.
term
Value in Prolog. A term is either a variable, atom, integer, float or compound term. In addition, SWI-Prolog also defines the type string
transparent
See module transparent.
unify
Prolog process to make two terms equal by assigning variables in one term to values at the corresponding location of the other term. For example:
?- foo(a, B) = foo(A, b).

A = a,
B = b

Unlike assignment (which does not exist in Prolog), unification is not directed.

update view
How Prolog behaves when a dynamic predicate is changed while it is running. There are two models. In most older Prolog systems the change becomes immediately visible to the goal, in modern systems including SWI-Prolog, the running goal is not affected. Only new goals `see' the new definition.
variable
A Prolog variable is a value that `is not yet bound'. After binding a variable, it cannot be modified. Backtracking to a point in the execution before the variable was bound will turn it back into a variable:
?- A = b, A = c.
No
?- (A = b; true; A = c).
A = b ;
A = _G283 ;
A = c ;
No

See also unify.