next up previous contents index
Next: Summary Up: < Previous: Readline Interaction   Contents   Index

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 mytermA1, 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 assert1 and assertz1.

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 prove 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_predicate1.

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:


\begin{code}
parent(X) :-
father(X, _).
\end{code}

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_transparent1.

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.


\begin{code}
person(john).
\end{code}

fail

A goal is said to haved failed if it could not be proven.

float

Computers cripled 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 fooa, b, c is said to be a term belonging to the functor foo3. foo0 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 modules.

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 most current machines, SWI-Prolog integers are represented as `32-bit signed values', ranging from -2147483648 to 2147483647. See also current_prolog_flag2.

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 multi_file1.

neck

Operator () separating head from body in a clause.

operator

Symbol (atom) that may be placed before its operant (prefix), after its operant (postfix) or between its two operants (infix).

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

operant

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.

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:


\begin{code}
?- A = B, A = a.
\par A = a,
B = a
\end{code}

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) or make sure the first character is a _. See also the style_check1 option singletons.

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 strings, 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:


\begin{code}
?- foo(a, B) = foo(A, b).
\par A = a,
B = b
\end{code}

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:


\begin{code}
?- A = b, A = c.
No
?- (A = b; true; A = c).
A = b ;
A = _G283 ;
A = c ;
No
\end{code}

See also unify.


next up previous contents index
Next: Summary Up: < Previous: Readline Interaction   Contents   Index
Dr. Richard Botting 2001-12-12