To abolish a predicate is to retract all the predicate’s clauses and to remove all information about it from the Prolog system, to make it as if that predicate had never existed.
A special case of breakpoint, the advice breakpoint. It is distinguished from spypoints in that it is intended for non-interactive debugging, such as checking of program invariants, collecting information, profiling, etc.
An alphanumeric character is any of the lowercase characters from ‘a’ to ‘z’, the uppercase characters from ‘A’ to ‘Z’, the numerals from ‘0’ to ‘9’, or underscore (‘_’).
An ancestor of a goal is any goal that the system is trying to solve when it calls that goal. The most distant ancestor is the goal that was typed at the top-level prompt.
An anonymous variable is one that has no unique name, and whose value is therefore inaccessible. An anonymous variable is denoted by an underscore (‘_’).
See predicate, structure, and arity.
The arity of a structure is its number of arguments.
For example, the structure customer(jones,85)
has an arity
of 2.
A character sequence used to uniquely denote some entity in the problem domain. A number is not an atom. Examples of legal atoms are:
hello * := '#$%' 'New York' 'don\'t'
See ref-syn-trm-ato. Atoms are recognized by the built-in
predicate atom/1
. Each Prolog atom is represented
internally by a unique integer, represented in C as an SP_atom
.
Synonym for constant.
A collection of information on the control flow of the program, gathered by the debugger. Also the display of this information produced by the debugger. The backtrace includes data on goals that were called but not exited and also on goals that exited nondeterminately.
The process of reviewing the goals that have been satisfied and attempting to resatisfy these goals by finding alternative solutions.
The process of assigning a value to a variable; used in unification.
A goal that is suspended because it is not instantiated enough.
The body of a clause consists of the part of a Prolog clause following the ‘:-’ symbol.
A description of certain invocations in the program where the user wants the debugger to stop, or to perform some other actions. A breakpoint is specific if it applies to the calls of a specific predicate, possibly under some conditions; otherwise, it is generic. Depending on the intended usage, breakpoints can be classified as debugger breakpoints, also known as spypoints, or advice breakpoints, also called advice points; see Advanced Debugging.
A term describing a breakpoint. Composed of a test part, specifying the conditions under which the breakpoint should be applied, and an action part, specifying the effects of the breakpoint on the execution.
A byte list is a list of bytes, i.e. integers in [0,…,255].
A temporary workspace in Emacs that contains a file being edited.
A predicate that comes with the system and that does not have to be explicitly loaded before it is used.
A callable term is either a compound term or an atom.
Callable terms are recognized by the built-in predicate
callable/1
.
A char list is a list of chars, i.e. atoms made up of a single character.
An integer that is the numeric representation of a character in the character code set.
A subset of the set {0, …, 2^31-1} that can be handled in input/output. SICStus Prolog fixes the character code set to a superset of Unicode, which includes the ASCII code set, i.e. codes 0..127, and these codes are interpreted as ASCII characters
SICStus Prolog maintains a character-conversion mapping, which is
used while reading terms and programs. Initially, the
mapping prescribes no character conversions. It can be modified by the
built-in predicate char_conversion(In, Out)
,
following which In will be converted to Out. Character
conversion can be switched off by the char_conversion
Prolog flag.
Please note: the mapping is global, as opposed to being local to the current module, Prolog text, or otherwise.
A function mapping each element of the character code set to one of the character categories (whitespace, letter, symbol-char, etc.), required for parsing tokens.
A memory block representing outstanding choices for some goals or disjunctions.
A fact or a rule. A rule comprises a head and a
body. A fact consists of a head only, and is
equivalent to a rule with the body true
.
A code list is a list of character codes.
Conditionally including or excluding parts of a file at compile time.
Virtual code representation of compiled code. A reasonable
compromise between performance and space requirement. A valid value for
the compiling
Prolog flag.
To load a program (or a portion thereof) into Prolog through the compiler. Compiled code runs more quickly than interpreted code, and provides better precision for execution profiling and coverage analysis. On the other hand, you cannot debug compiled code in as much detail as interpreted code.
A compound term is a term that is an atom together
with one or more arguments. For example, in the term
father(X)
, father
is the name, and X
is the first
and only argument. The argument to a compound term
can be another compound term, as in father(father(X))
.
Compound terms are recognized by the built-in predicate
compound/1
.
A series of goals connected by the connective “and” (that is, a series of goals whose principal operator is ‘,’).
An executable that inherits the standard streams from the process that invoked it, e.g. a UNIX shell or a DOS-prompt.
An integer (for example: 1, 20, -10), a floating-point number (for
example: 12.35), or an atom. Constants are recognized by
the built-in predicate atomic/1
.
To load a program (or a portion thereof) into Prolog through the interpreter. Interpreted code runs more slowly than compiled code, and does not provide as good precision for execution profiling and coverage analysis. On the other hand, you can debug interpreted code in more detail than compiled code.
A built-in predicate that is “part of the language” in the sense that it is treated specially in certain language features. The set of such control structures and language features is enuemrated in ref-sem-ctr.
What the debugger does in trace mode, also known as single-stepping. It goes to the next port of a procedure box and prints the goal, then prompts you for input. See Basic Debug.
The point on the screen at which typed characters appear. This is usually highlighted by a line or rectangle the size of one space, which may or may not blink.
Written as !
. A built-in predicate that succeeds when
encountered; if backtracking should later return to the cut,
then the goal that matched the head of the clause
containing the cut fails immediately.
The Prolog database comprises all of the clauses that have been loaded or asserted into the Prolog system or that have been asserted, except those clauses that have been retracted or abolished.
A compound term denoting a unique reference to a dynamic clause.
Recognized by the built-in predicate db_reference/1
.
A mode of program execution in which the debugger stops to print the current goal only at predicates that have spypoints set on them (see leap).
Interpreted representation of compiled code. A valid value
for the compiling
Prolog flag.
A declaration looks like a directive, but is not executed but rather conveys information about predicates about to be loaded.
A function in a foreign resource that is called prior to unloading the resource.
A predicate is determinate if it can supply only one answer.
A stand-alone executable with the full programming environment,
including top level, compiler, debugger etc. The default
sicstus
executable is a development system; new
development systems containing prelinked foreign resources
can also be created.
A directive is a goal preceded by the prefix operator ‘:-’, whose intuitive meaning is “execute this as a query, but do not print out any variable bindings.”
A series of goals connected by the connective “or” (that is, a series of goals whose principal operator is ‘;’).
A control structure of the form (Iterators do Body)
.
It expresses a simple iteration. See ref-sem-ctr-dol.
A predicate that can be modified while a program is running. The semantics of such updates is described in ref-mdb-bas. A predicate must explicitly be declared to be dynamic or it must be added to the database via one of the assertion predicates.
A sequence of bytes representing a sequence of possibly wide character codes, using the UTF-8 encoding.
A sequence of characters beginning with ‘\’ inside certain syntactic tokens (see ref-syn-syn-esc).
A module exports a predicate so that other modules can import it.
A stand-alone executable. In addition to the normal set of built-in runtime system predicates, extended runtime systems include the compiler. Extended runtime systems require the extended runtime library, available from SICS as an add-on product.
A clause with no conditions—that is, with an empty body. A fact is a statement that a relationship exists between its arguments. Some examples, with possible interpretations, are:
king(louis, france). % Louis was king of France. have_beaks(birds). % Birds have beaks. employee(nancy, data_processing, 55000). % Nancy is an employee in the % data processing department.
An atom or a compound term denoting the name of a file. The rules for mapping such terms to absolute file names are described in ref-fdi.
A query where all unsolved goals are blocked.
A predicate that is defined in a language other than Prolog, and explicitly bound to Prolog predicates by the Foreign Language Interface.
A named set of foreign predicates.
The functor of a compound term is its name and arity.
For example, the compound term foo(a,b)
is said to have
“the functor foo
of arity two”, which is generally
written foo/2
.
The functor of a constant is the term itself paired
with zero. For example, the constant nl
is said to have
“the functor nl
of arity zero”, which is generally
written nl/0
.
The freeing up of space for computation by making the space occupied by terms that are no longer available for use by the Prolog system.
A generalized predicate specification corresponds to the argument type pred_spec_tree (see mpg-ref-aty-ety) and is a term of one of the following forms. It is always interpreted wrt. a given module context:
all predicates called Name no matter what arity, where Name is an atom for a specific name or a variable for all names, or
the predicate of that name and arity, or
specifying a particular module Module instead of the default module, where Module is an atom for a specific module or a variable for all modules, or
the set of all predicates covered by the Specs.
Interface code between the Prolog engine and foreign predicates. Automatically generated by the foreign language interface as part of building a linked foreign resource.
A simple goal is a predicate call. When called, it will either succeed or fail.
A compound goal is a formula consisting of simple goals connected by connectives such as “and” (‘,’) or “or” (‘;’).
A goal typed at the top level is called a query.
A term is ground when it is free of (unbound)
variables. Ground terms are recognized by the
built-in predicate ground/1
.
A clause of the form
Head :- Goals, !, Goals.
The head of a clause is the single goal, which will be satisfied if the conditions in the body (if any) are true; the part of a rule before the ‘:-’ symbol. The head of a list is the first element of the list.
A hook predicate is a predicate that somehow alters or customizes the
behavior of a hookable predicate. Typically, it is undefined
initially, belongs to the user
module, and if defined by the user,
it is best defined as multifile, so that new clases can be added by
different software modules. Please note: any exception
thrown by a hook predicate is caught locally. Then it is either
printed as an error message, or merely ignored.
A hookable predicate is a built-in predicate whose behavior is somehow altered or customized by a hook predicate.
A stream with the interactive
stream property. Certain behavior
of interactive streams are optimized for the case where a human is
at the other end of the stream.
Exported predicates in a module can be imported by other modules. Once a predicate has been imported by a module, it can be called, or exported, as if it were defined in that module.
There are two kinds of importation: predicate importation, in which only specified predicates are imported from a module; and module importation, in which all the predicates exported by a module are imported.
The process of filtering a set of potentially matching clauses of a predicate given a goal.
For both interpreted and compiled code, indexing is done on the principal functor of the first argument. Additionally, for interpreted code only, principal functor filtering is done on each argument, but the filtering done for the first argument is more efficient.
A function in a foreign resource that is called upon loading the resource.
An initialization is a goal that is executed when the file
in which the initialization is declared is loaded. An
initialization is declared as a directive :- initialization Goal
.
They are executed in input order.
A variable is instantiated if it is bound to a non-variable term; that is, to an atomic term or a compound term.
Load a program or set of clauses into Prolog through the interpreter (also known as consulting). Interpreted code runs more slowly than compiled code, does not provide as good precision for execution profiling and coverage analysis. On the other hand, more extensive facilities are available for debugging interpreted code.
Same as procedure box.
A compound term expressing how a do loop should be iterated. See ref-sem-ctr-dol.
An integer that is not a small integer.
In the context of handling line number information for source code, a source term Source gets associated to a layout term Layout, which is one of the following:
[]
, if no line number information is available for Source.
What the debugger does in debug mode. The debugger shows only the ports of predicates that have spypoints on them. It then normally prompts you for input, at which time you may leap again to the next spypoint (see trace).
Determines how frequently the debugger will stop and prompt you for input when you are tracing. A port at which the debugger stops is called a “leashed port”.
A foreign resource that is ready to be installed in an atomic operation, normally represented as a shared object or DLL.
A partial list is either a variable, or a compound term whose
principal functor is the list constructor ('.'/2
) and whose
second argument is a partial list. Often it is implied that the partial
list is not a variable.
A proper list is either the empty list, i.e. the atom
[]
, or a compound term whose principal functor is the list
constructor ('.'/2
) and whose second argument is a proper list.
A partial list or a proper list that is a compound term is said to be non-empty.
In many cases list is used to denote both the case of a proper list and the case of a, most often non-variable, partial list.
A cyclic list is a compound term whose principal functor is the
list constructor ('.'/2
) and whose second argument is a cyclic
list, e.g. what could be constructed using L='.'(a,L)
, or
L=[a,b|L]
. Passing a cyclic list as an argument to a predicate
that expects a partial or proper list should be avoided as not all
predictes are prepared to handle such input.
A list is often written using list syntax, e.g. using
[a,b]
to denote the (proper) list '.'(a,'.'(b,[]))
, or
using [a,b|End]
to denote the (partial) list
'.'(a,'.'(b,End))
.
To load a Prolog clause or set of clauses, in source or binary form, from a file or set of files.
The process of interpreting a callable term as a goal.
This is done e.g. by the built-in predicate call/1
.
A predicate that performs operations that require reasoning about the current instantiation of terms or decomposing terms into their constituents. Such operations cannot be expressed using predicate definitions with a finite number of clauses.
A meta-predicate is one that calls one or more of its arguments; more generally, any predicate that needs to assume some module in order to operate is called a meta-predicate. Some arguments of a meta-predicate are subject to module name expansion.
Every predicate belongs to a module. The name of a module is an atom.
Some predicates in a module are exported. The default module is
user
.
The process by which certain arguments of meta-predicates get prefixed by the source module. See ref-mod-mne.
A module file is a file that is headed with a module declaration of the form:
:- module(ModuleName, ExportedPredList).
which must appear as the first term in the file. When a module file or its corresponding object file is loaded, all predicates defined in the module are removed, and all predicate imported into the module are unimported.
A predicate whose definition is to be spread over more than one file. Such a predicate must be preceded by an explicit multifile declaration in all files containing clauses for it.
A special form of compound term subject to destructive assignment.
See ref-lte-mut. Mutable terms are recognized by the
built-in predicate mutable/1
.
A name clash occurs when a module attempts to define or import a predicate that it has already defined or imported.
A predicate is determinate if it can supply more than one answer.
A test to ensure that binding a variable does not bind it to a term where that variable occurs.
An atom that consists of a single character.
A notational convenience that allows you to express any compound
term in a different format. For example, if likes
in
| ?- likes(sue, cider).
is declared an infix operator, then the query above could be written:
| ?- sue likes cider.
An operator does not have to be associated with a predicate. However, certain built-in predicates are declared as operators. For example,
| ?- =..(X, Y).
can be written as
| ?- X =.. Y.
because =..
has been declared an infix operator.
Those predicates that correspond to built-in operators are written using infix notation in the list of built-in predicates at the beginning of the part that contains the reference pages.
Some built-in operators do not correspond to built-in predicates; for example, arithmetic operators. See ref-syn-ops-bop for a list of built-in operators.
A compound term K-V
. Pairs are used by
the built-in predicate keysort/2
and by many library
modules.
The parent of the current goal is a goal that, in its attempt to obtain a successful solution to itself, is calling the current goal.
One of the seven key points of interest in the execution of a Prolog predicate. See Procedure Box for a definition.
A linked foreign resource that is linked into a stand-alone executable as part of building the executable.
A number associated with each Prolog operator, which is used to disambiguate the structure of the term represented by an expression containing a number of operators. Operators of lower precedence are applied before those of higher precedence; the operator with the highest precedence is considered the principal functor of the expression. To disambiguate operators of the same precedence, the associativity type is also necessary. See ref-syn-ops.
A functor that specifies some relationship existing in the problem
domain. For example, < /2
is a built-in predicate
specifying the relationship of one number being less than another. In
contrast, the functor + /2
is not (normally used as) a
predicate.
A predicate is either built-in or is implemented by a procedure.
A compound term name/arity
or
module:name/arity
denoting a predicate.
A set of clauses in which the head of each clause has the same predicate. For instance, a group of clauses of the following form:
connects(san_francisco, oakland, bart_train). connects(san_francisco, fremont, bart_train). connects(concord, daly_city, bart_train).
is identified as belonging to the predicate connects/3
.
A way of visualizing the execution of a Prolog procedure, A procedure box is entered and exited via ports.
The process of gathering execution statistics of the program, essentially counting the number of times selected program points have been reached.
A set of procedures designed to perform a given task.
A PO (Prolog object) file contains a binary representation of a set of
modules, predicates, clauses and directives.
They are portable between different platforms, except between 32-bit and
64-bit platforms. They are created by save_files/2
,
save_modules/2
, and save_predicates/2
.
A query is a question put by the user to the Prolog system. A query is written as a goal followed by a full stop in response to the top-level prompt. For example,
| ?- father(edward, ralph).
refers to the predicate father/2
. If a query has no
variables in it, then the system will respond either ‘yes’ or
‘no’. If a query contains variables, then the system will
try to find values of those variables for which the query is
true. For example,
| ?- father(edward, X). X = ralph
After the system has found one answer, the user can direct the system to look for additional answers to the query by typing ;.
The process in which a running predicate calls itself, presumably with different arguments and for the purpose of solving some subset of the original problem.
The text between the cursor and a previously set mark in an Emacs buffer.
A clause with one or more conditions. For a rule to be true, all of its conditions must also be true. For example,
has_stiff_neck(ralph) :- hacker(ralph).
This rule states that if the individual ralph
is a hacker,
then he must also have a stiff neck. The constant ralph
is
replaced in
has_stiff_neck(X) :- hacker(X).
by the variable X
. X
unifies with anything,
so this rule can be used to prove that any hacker has a stiff
neck.
A shared object or DLL containing the SICStus virtual machine and other runtime support for stand-alone executables.
A stand-alone executable with a restricted set of built-in predicates and no top level. Stand-alone applications containing debugged Prolog code and destined for end-users are typically packaged as runtime systems.
A snapshot of the state of Prolog saved in a file by
save_program/[1,2]
.
The relation between the set of Prolog symbols and their combinations (as Prolog terms and clauses), and their meanings. Compare syntax.
A clause or directive.
A predicate that produces a side effect is one that has any effect on the “outside world” (the user’s terminal, a file, etc.), or that changes the Prolog database.
A simple term is a constant or a variable.
Simple terms are recognized by the built-in predicate
simple/1
.
A compound term name(arg, …, arg)
or
module:name(arg, …, arg)
denoting a predicate.
An integer in the range [-2^28,2^28-1]
on 32-bit platforms, or
[-2^60,2^60-1]
on 64-bit platforms. The start and end of this
range is available as the value of the Prolog flags
min_tagged_integer
and max_tagged_integer
, respectively.
The human-readable, as opposed to the machine-executable, representation of a program.
The module that is the context of a file being loaded. For module files, the source module is named in the file’s module declaration. For other files, the source module is inherited from the context.
A C type for the internal representation of Prolog atoms. Used in SICStus API functions.
A C type denoting an integer that is large enough to hold a pointer. Used in SICStus API functions.
A C type denoting a “handle” object providing an interface from C to Prolog terms. Used in SICStus API functions.
A special case of breakpoint, the debugger breakpoint, intended for interactive debugging. Its simplest form, the plain spypoint instructs the debugger to stop at all ports of all invocations of a specified predicate. Conditional spypoints apply to a single predicate, but are more selective: the user can supply applicability tests and prescribe the actions to be carried out by the debugger. A generic spypoint is like a conditional spypoint, but not restricted to a single predicate. See Advanced Debugging.
A binary program that can be invoked from the operating system,
containing the SICStus runtime kernel. A stand-alone
executable is a development system (e.g. the default
sicstus
executable), or a runtime system. Both kinds are
created by the application builder. A stand-alone executable does
not itself contain any Prolog code; all Prolog code must be loaded
upon startup.
A predicate that can be modified only by being reloaded or by being abolished. See dynamic predicate.
A predicate is steadfast if it refuses to give the wrong answer even when the query has an unexpected form, typically with values supplied for arguments intended as output.
An input/output channel. See ref-iou.
A name assigned to a stream at the time of opening, which can be
referred to in I/O predicates. Must be an atom. There are
also three predefined aliases for the standard streams:
user_input
, user_output
and user_error
.
Although not a stream alias proper, the atom user
also stands for the standard input
or output stream, depending on context.
A term denoting an open Prolog stream. See ref-iou.
A term representing the current position of a stream. This
position is determined by the current byte, character and line counts
and line position. Standard term comparison on stream
position terms works as expected. When SP1
and SP2
refer to positions in the same stream, SP1@<SP2
if and
only if SP1
is before SP2
in the stream. You should
not otherwise rely on their internal representation.
A term representing the property of an open Prolog stream. The possible forms of this term are defined in ref-iou-sfh-bos.
A special syntactic notation, which, by default, denotes a code list, e.g.:
"SICStus"
By setting the Prolog flag double_quotes
, the meaning of
strings can be changed. With an appropriate setting, a
string can be made to denote a char list, or an atom.
Strings are not a separate data type.
A list of argument positions selecting a subterm within a
term (i.e. the subterm can be reached from the term by
successively selecting the argument positions listed in the
selector). Example: within the term q, (r, s; t)
the
subterm s
is selected by the selector [2, 1, 2]
.
The part of Prolog grammar dealing with the way in which symbols are put together to form legal Prolog terms. Compare semantics.
SICStus Prolog stores some information in named variables called system properties. System properties are used as of release 4.1, where previous releases used environment variables.
The default value for a system property is taken from the corresponding environment variable. Any exceptions to this rule is explicitly mentioned in the documentation. See System Properties and Environment Variables for more information.
A basic data object in Prolog. A term can be a constant, a variable, or a compound term.
A mode of program execution in which the debugger creeps to the next port and prints the goal.
The module that is the context of queries.
A goal that is not blocked any more.
A variable is unbound if it has not yet been instantiated.
The process of matching a goal with the head of a clause during the evaluation of a query, or of matching arbitrary terms with one another during program execution.
The rules governing the unification of terms are:
See fact.
A logical variable is a name that stands for objects that may or may not be determined at a specific point in a Prolog program. When the object for which the variable stands is determined in the Prolog program, the variable becomes instantiated. A logical variable may be unified with a constant, a compound term, or another variable. Variables become uninstantiated when the predicate they occur in backtracks past the point at which they were instantiated.
Variables may be written as any sequence of alphanumeric characters starting with either a capital letter or ‘_’; e.g.:
X Y Z Name Position _c _305 One_stop
See ref-syn-trm-var.
Predicate property. The clauses of a volatile predicate are not saved in saved states.
An executable that pops up its own window when run, and that directs the standard streams to that window.
Same as debug mode, except no debugging information is collected while zipping.