File: glossary.doc

package info (click to toggle)
swi-prolog 8.2.4%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 78,084 kB
  • sloc: ansic: 362,656; perl: 322,276; java: 5,451; cpp: 4,625; sh: 3,047; ruby: 1,594; javascript: 1,509; yacc: 845; xml: 317; makefile: 156; sed: 12; sql: 6
file content (357 lines) | stat: -rw-r--r-- 13,825 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
\chapter{Glossary of Terms}		\label{sec:glossary}

\newcommand{\glossitem}[1]{\item [{#1}]\mbox{}\\}
\newcommand{\g}[1]{{\em #1}}

\begin{description}
    \glossitem{anonymous [variable]}\index{anonymous variable}\index{variable,anonymous}%
The variable \verb$_$ is called the \g{anonymous} variable.  Multiple
occurrences of \verb$_$ in a single \g{term} are not \g{shared}.

    \glossitem{arguments}
Arguments are \g{terms} that appear in a \g{compound} \g{term}. \arg{A1}
and \arg{a2} are the first and second argument of the term
\term{myterm}{A1, a2}.

    \glossitem{arity}\index{arity}%
Argument count (= number of arguments) of a \g{compound} \g{term}.

    \glossitem{assert}\index{assert}%
Add a \g{clause} to a \g{predicate}. Clauses can be added at either
end of the clause-list of a \g{predicate}.  See asserta/1 and assertz/1.

    \glossitem{atom}\index{atom}%
Textual constant.  Used as name for \g{compound} terms, to represent
constants or text.

    \glossitem{backtracking}\index{backtracking}%
Search process used by Prolog.  If a predicate offers multiple
\g{clauses} to solve a \g{goal}, they are tried one-by-one until
one \g{succeeds}.  If a subsequent part of the proof is not satisfied
with the resulting \g{variable} \g{binding}, it may ask for
an alternative \g{solution} (= \g{binding} of the \g{variables}),
causing Prolog to reject the previously chosen \g{clause} and try the
next one.

    \glossitem{binding [of a variable]}\index{binding}%
Current value of the \g{variable}.  See also \g{backtracking} and
\g{query}.

    \glossitem{built-in [predicate]}\index{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.

    \glossitem{body}\index{body}%
Part of a \g{clause} behind the \g{neck} operator (\const{:-}).

    \glossitem{choice point}\index{choice point}%
A \g{choice point} represents a choice in the search for a \g{solution}.
Choice points are created if multiple clauses match a \g{query} or using
disjunction (\predref{;}{2}). On \g{backtracking}, the execution state
of the most recent \g{choice point} is restored and search continues
with the next alternative (i.e., next clause or second branch of
\predref{;}{2}).

    \glossitem{clause}\index{clause}%
`Sentence' of a Prolog program. A \g{clause} consists of a \g{head} and
\g{body} separated by the \g{neck} operator (\const{:-}) or it is a
\g{fact}.  For example:

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

Expressed as ``X is a parent if X is a father of someone''.  See also
\g{variable} and \g{predicate}.

    \glossitem{compile}
Process where a Prolog \g{program} is translated to a sequence of
instructions.  See also \g{interpreted}.  SWI-Prolog always
compiles your program before executing it.

    \glossitem{compound [term]}\index{compound}%
Also called \g{structure}.  It consists of a name followed by \arg{N}
\g{arguments}, each of which are \g{terms}.  \arg{N} is called the
\g{arity} of the term.

    \glossitem{context module}\index{context module}\index{module,contex}%
If a \g{term} is referring to a \g{predicate} in a \g{module}, the
\g{context module} is used to find the target module.  The context
module of a \g{goal} is the module in which the \g{predicate} is
defined, unless this \g{predicate} is \g{module transparent}, in
which case the \g{context module} is inherited from the parent
\g{goal}.  See also module_transparent/1 and \g{meta-predicate}.

    \glossitem{dcg}\index{dcg}%
Abbreviation for \g{Definite Clause Grammar}.

    \glossitem{det [determinism]}\index{det}%
Short for \g{deterministic}.

    \glossitem{determinism}\index{determinism}%
How many solutions a \g{goal} can provide.  Values are `nondet' (zero
to infinite), `multi' (one to infinite), `det' (exactly one) and
`semidet' (zero or one).

    \glossitem{deterministic}\index{deterministic}%
A \g{predicate} is \g{deterministic} if it succeeds exactly one time
without leaving a \g{choice point}.

    \glossitem{dynamic [predicate]}\index{dynamic predicate}\index{predicate,dynamic}%
A \g{dynamic} predicate is a predicate to which \g{clauses} may be
\g{assert}ed and from which \g{clauses} may be \g{retract}ed while
the program is running.  See also \g{update view}.

    \glossitem{exported [predicate]}\index{exported predicate}\index{predicate,exported}%
A \g{predicate} is said to be \g{exported} from a \g{module} if it
appears in the \g{public list}.  This implies that the predicate
can be \g{imported} into another module to make it visible there.
See also use_module/[1,2].

    \glossitem{fact}\index{fact}%
\g{Clause} without a \g{body}. This is called a fact because, interpreted
as logic, there is no condition to be satisfied. The example below
states \const{john} is a person.

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

    \glossitem{fail}
A \g{goal} is said to have failed if it could not be \g{proven}.

    \glossitem{float}
Computer's crippled representation of a real number.  Represented as
`IEEE double'.

    \glossitem{foreign}
Computer code expressed in languages other than Prolog.  SWI-Prolog can
only cooperate directly with the C and C++ computer languages.

    \glossitem{functor}\index{functor}%
Combination of name and \g{arity} of a \g{compound} term.  The term
\term{foo}{a, b, c} is said to be a term belonging to the functor
\nopredref{foo}{3}. \nopredref{foo}{0} is used to refer to the \g{atom}
\const{foo}.

    \glossitem{goal}\index{goal}\index{query}%
Question stated to the Prolog engine.  A \g{goal} is either an \g{atom}
or a \g{compound} term. A \g{goal} either succeeds, in which case the
\g{variables} in the \g{compound} terms have a \g{binding}, or it \g{fails}
if Prolog fails to prove it.

    \glossitem{hashing}\index{hashing}%
\g{Indexing} technique used for quick lookup.

    \glossitem{head}\index{head}%
Part of a \g{clause} before the \g{neck} operator (\const{:-}).   This is an \g{atom}
or \g{compound} term.

    \glossitem{imported [predicate]}%
\index{imported predicate}\index{predicate,imported}%
A \g{predicate} is said to be \g{imported} into a \g{module} if it is
defined in another \g{module} and made available in this \g{module}.
See also \chapref{modules}.

    \glossitem{indexing}\index{indexing}%
Indexing is a technique used to quickly select candidate \g{clauses} of
a \g{predicate} for a specific \g{goal}. In most Prolog systems,
indexing is done (only) on the first \g{argument} of the \g{head}. If
this argument is instantiated to an \g{atom}, \g{integer}, \g{float} or
\g{compound} term with \g{functor}, \g{hashing} is used to quickly select
all \g{clauses} where the first argument may \g{unify} with the first
argument of the \g{goal}. SWI-Prolog supports just-in-time and
multi-argument indexing.  See \secref{jitindex}.

    \glossitem{integer}\index{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 \prologflag{bounded}, \prologflag{max_integer} and \prologflag{min_integer}.

    \glossitem{interpreted}\index{interpreted}%
As opposed to \g{compiled}, interpreted means the Prolog system attempts
to prove a \g{goal} by directly reading the \g{clauses} rather than
executing instructions from an (abstract) instruction set that is not
or only indirectly related to Prolog.

    \glossitem{instantiation [of an argument]}\index{instantiation}%
To what extend a term is bound to a value.  Typical levels are
`unbound' (a \g{variable}), `ground' (term without variables) or
`partially bound' (term with embedded variables).

    \glossitem{meta-predicate}\index{meta-predicate}%
A \g{predicate} that reasons about other \g{predicates}, either by
calling them, (re)defining them or querying \g{properties}.

    \glossitem{mode [declaration]}\index{mode}%
Declaration of an argument \g{instantiation} pattern for a
\g{predicate}, often accompanied with a \g{determinism}.

    \glossitem{module}\index{module}%
Collection of predicates.  Each module defines a name-space for
predicates.  \g{built-in} predicates are accessible from all modules.
Predicates can be published (\g{exported}) and \g{imported} to make
their definition available to other modules.

    \glossitem{module transparent [predicate]}\index{module transparent}\index{transparent}%
A \g{predicate} that does not change the \g{context module}.  Sometimes
also called a \g{meta-predicate}.

    \glossitem{multi [determinism]}\index{multi}%
A \g{predicate} is said to have \g{determinism} multi if it generates at
\emph{least} one answer.

    \glossitem{multifile [predicate]}
Predicate for which the definition is distributed over multiple
source files.  See multifile/1.

    \glossitem{neck}\index{neck}%
Operator (\const{:-}) separating \g{head} from \g{body} in a \g{clause}.

    \glossitem{nondet}\index{nondet}%
Short for \g{non deterministic}.

    \glossitem{non deterministic}\index{non deterministic}%
A \g{non deterministic} predicate is a predicate that mail fail or
succeed any number of times.

    \glossitem{operator}\index{operator}%
Symbol (\g{atom}) that may be placed before its \g{operand} (prefix),
after its \g{operand} (postfix) or between its two \g{operands} (infix).

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

    \glossitem{operand}\index{operand}%
\g{Argument} of an \g{operator}.

    \glossitem{precedence}\index{precedence}%
The \g{priority} of an \g{operator}.  Operator precedence is used
to interpret \verb$a+b*c$ as \verb$+(a, *(b,c))$.

    \glossitem{predicate}\index{predicate}%
Collection of \g{clauses} with the same \g{functor} (name/\g{arity}).
If a \g{goal} is proved, the system looks for a \g{predicate} with the
same functor, then uses \g{indexing} to select candidate \g{clauses}
and then tries these \g{clauses} one-by-one.  See also \g{backtracking}.

    \glossitem{predicate indicator}\index{predicate indicator}%
Term of the form Name/Arity (traditional) or Name//Arity (ISO
DCG proposal), where Name is an atom and Arity a non-negative integer.
It acts as an \emph{indicator} (or reference) to a predicate or
\g{DCG} rule.

    \glossitem{priority}\index{priority}%
In the context of \g{operators} a synonym for \g{precedence}.

    \glossitem{program}\index{program}%
Collection of \g{predicates}.

    \glossitem{property}\index{property}%
Attribute of an object.  SWI-Prolog defines various {\em *_property}
predicates to query the status of predicates, clauses. etc.

    \glossitem{prove}\index{prove}%
Process where Prolog attempts to prove a \g{query} using the available
\g{predicates}.

    \glossitem{public list}\index{public list}%
List of \g{predicates} exported from a \g{module}.

    \glossitem{query}
See \g{goal}.

    \glossitem{retract}\index{retract}%
Remove a \g{clause} from a \g{predicate}.  See also \g{dynamic},
\g{update view} and \g{assert}.

    \glossitem{semidet}\index{semidet}%
Shorthand for \glossitem{semi deterministic}.

    \glossitem{semi deterministic}\index{semi deterministic}%
A \g{predicate} that is \g{semi deterministic} either fails or
succeeds exactly once without a \g{choice point}.  See also
\g{deterministic}.

    \glossitem{shared}\index{shared}%
Two \g{variables} are called \g{shared} after they are \g{unified}. This
implies if either of them is \g{bound}, the other is bound to the same
value:

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

    \glossitem{singleton [variable]}\index{singleton}%
\g{Variable} appearing only one time in a \g{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 \verb$_$
(see \g{anonymous}).  Rules for naming a variable and avoiding a warning
are given in \secref{singleton}.

    \glossitem{solution}\index{solution}%
\g{Bindings} resulting from a successfully \g{prove}n \g{goal}.

    \glossitem{structure}\index{structure}%
Synonym for \g{compound} term.

    \glossitem{string}
Used for the following representations of text: a packed array
(see \secref{strings}, SWI-Prolog specific), a list of character
codes or a list of one-character \g{atoms}.

    \glossitem{succeed}\index{succeed}%
A \g{goal} is said to have \g{succeeded} if it has been \g{proven}.

    \glossitem{term}\index{term}%
Value in Prolog. A \g{term} is either a \g{variable}, \g{atom}, \g{integer},
\g{float} or \g{compound} term.  In addition, SWI-Prolog also defines the
type \g{string}.

    \glossitem{transparent}
See \g{module transparent}.

    \glossitem{unify}\index{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).
A = a,
B = b.
\end{code}

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

    \glossitem{update view}\index{update view}\index{view,update}%
How Prolog behaves when a \g{dynamic} \g{predicate} is changed while
it is running.  There are two models.  In most older Prolog systems the
change becomes immediately visible to the \g{goal}, in modern systems
including SWI-Prolog, the running \g{goal} is not affected.  Only
new \g{goals} `see' the new definition.

    \glossitem{variable}\index{variable}%
A Prolog variable is a value that `is not yet bound'.  After \g{binding}
a variable, it cannot be modified.  \g{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.
false.

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

See also \g{unify}.

\end{description}