- export
- A module exports a procedure by making that procedure
public, so that other modules can import it.
- fact
- (Also called a unit clause.) 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.
- first-order logic
- A system of logic in which the values of variables may range
over the data items in the domain. In Prolog these data items are terms.
For comparison, in zero-order logic (also known as propositional logic)
there are no variables, and in second-order logic the values of variables
are allowed to range both over data items and over functions and relations.
- functors
- The name and arity of a structure. For example, the structure
'foo(a, b)' is said to have "the functor foo of arity two", which
is generally written foo/2.
- garbage collection
- The freeing up of space for computation by making the space occupied
by terms which are no longer available for use by the Prolog system.
- goals
- A procedure call. When called, it will either succeed or fail.
A goal typed at the top level is called a query.
- head
- 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.
- Horn clause
- See clause.
- import
- Public procedures in a module can be imported
by other modules. Once a procedure has been imported by a module, it can
be called as if it were defined in that module. There are two kinds of
importation: procedure-importation, in which only specified procedures
are imported from a module; and module-importation, in which all the predicates
made public by a module are imported.
- instantiation
- A variable is instantiated if it is bound to a non-variable
term; that is, to an atomic term (see constant) or
a compound term.
- interpret
- Load a program or set of clauses into Prolog through
the interpreter (also known as consulting). Interpreted code runs
much more slowly than compiled code, but more extensive facilities
are available for debugging interpreted code.
- leap
- What the debugger does in debug mode. The debugger shows only
the ports of procedures that have spypoints on them.
It then prompts you for input, at which time you may leap again to the
next spypoint. See {manual(e-1-3-2)}.
- leashing
- 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."
- list
- A list is written as a set of zero or more terms between square
brackets. If there are no terms in a list, it is said to be empty, and
is written as []. In this first set of examples, all members of each list
are explicitly stated.
[aa, bb,cc] [X, Y] [Name] [[x, y], z]
In the second set of examples, only the first several members of each
list are explicitly stated, while the rest of the list is represented by
a variable on the right-hand side of the "rest of" operator,
'|':
[X | Y] [a, b, c | Y] [[x, y] | Rest]
'|' is also known as the "list constructor." The first element
of the list to the left of '|' is called the head of the list. The
rest of the list, including the variable following '|' (which represents
a list of any length), is called the tail of the list. For example,
list head tail
[X | Y] X Y
[a, b, c | y] a [b, c | y]
[[X, Y] | Rest] [X, Y] Rest
- load
- To compile or consult a Prolog clause or set of
clauses.
- meta-predicates
- A meta-predicate is one which calls one or more of its arguments;
more generally, any predicate which needs to assume some module
in order to operate is called a meta-predicate. A meta-predicate declaration
is a term in a module-file which is associated with a given
functor, sharing its name and arity, but having each
of its arguments replaced either by one of the mode annotations
'+', '-', '*', '+-', '+*', or by ':' or a non-negative integer. ':' or
a non-negative integer signifies that the corresponding argument requires
module name expansion.
- mode line
- The information line at the bottom of each Emacs window that
is one line long and the width of the screen; often shown in reverse video.
The mode line at the bottom of the Prolog window says "Quintus Prolog"
plus other information such as the state of the debugger if it is activated.
The mode line of the text window(s) states the buffername, the filename,
the editor mode ("Prolog" for a file ending in '.pl'), and the
percentage of the file that precedes the cursor.
- module
- A module is a set of procedures in a module-file. Some
procedures in a module are public. The default module is 'user'.
- module-files
- A module-file is a file that is headed with a module declaration
of the form
:- module(ModuleName, PublicPredList).
which must appear as the first term in the file.
- multifile predicate
- 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 the first file containing clauses for it.
- name clash
- A name clash occurs when a module attempts to define or import
a procedure that it has already defined or imported.
- object code
- The machine-executable, as opposed to the human-readable, representation
of a program.
- operator
- 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, 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
which 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. {manual(g-1-4-4)}
contains a list of built-in operators.
- parent
- The parent of the current goal is a goal which, in its
attempt to obtain a successful solution to itself, is calling the current
goal.
- port
- One of the four key points of interest in the execution of a Prolog
procedure. There are four ports: the Call port, representing the
initial invocation of the procedure; the Exit Port, representing a successful
return from the procedure; the Redo port, representing reinvocation of
the procedure through backtracking; and the Fail port, representing
an unsuccessful return due to the failure of the initial goal of
the procedure.
- precedence
- 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 the syntax chapter ({manual(g-1)}).
- predicates
- 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.
- procedure
- 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 procedure connects/3.
- program
- A set of procedures designed to perform a given task.
- public
- A procedure in a module is public if it can be imported
by other modules. The public predicates of a module are listed in the module
declaration (see module-file).
- QOF files
- a fully general way of storing arbitrary Prolog facts and rules in
a form that can be quickly and easily used. QOF files contain a machine
independent representation of both compiled and dynamic Prolog predicates.
This means they are completely portable between different platforms running
Quintus Prolog.
- query
- -- simple query: A query is a question put by the user to
the Prolog system. A simple query is written as a goal followed
by a full-stop in response to the Prolog system prompt. For example,
| ?- father(edward, ralph).
refers to the predicate father/2. If a query has no variables
in it, the system will respond either "yes" or "no."
If a query contains variables, 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 ";". --
compound query: A compound query consists of two or more simple
queries connected by commas. For a compound query to be true, all of its
goals must be true simultaneously. For example, the following compound
query will find Ralph's grandfather (G):
| ?- father(G, F), father(F, ralph).
F is a shared variable which is constrained by unification
to have the same value in each of the two subgoals.
- recursion
- The process in which a running procedure calls itself, presumably
with different arguments and for the purpose of solving some subset
of the original problem.
- region
- The text between the cursor and a previously-set mark in an
Emacs buffer.
- rule
- 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.
- saved-states
- A snapshot of the state of Prolog saved in a file by save_program/1,
save_modules/2, or save_predicates/2. save_program/1
saves the whole Prolog data base, save_modules/2 and save_predicates
save a list of modules and predicates respectively.
- semantics
- The relation between the set of Prolog symbols and their combinations
(as Prolog terms and clauses), and their meanings. Compare
syntax.
- side-effects
- A predicate which produces a side-effect is one which has any
effect on the "outside world" (the user's terminal, a file, etc.),
or which changes the Prolog data base.
- simple term
- see constant.
- source code
- The human-readable, as opposed to the machine-executable, representation
of a program.
- spypoints
- A flag placed on a predicate by the command spy/1 and
removed by nospy/1 that tells the debugger to stop execution and
allow user interaction at goals for that predicate. Any number of
predicates can have spypoints set on them.
- static predicate
- A predicate that can be modified only by being reloaded via
the consult or compile facility or by being abolished.
(See dynamic predicate.)
- stream
- An input/output channel.
- structures
- (Also called a compound term.) A structure is a functor
together with zero or more arguments. For example, in the structure
father(X)
father/1 is the functor, and X is the first and only argument. The argument
to a structure can be another structure, as in
father(father(X))
- syntax
- The part of Prolog grammar dealing with the way in which symbols are
put together to form legal Prolog terms. Compare semantics.
- term
- A basic data object in Prolog. A term can be a constant, a variable,
or a structure.
- trace
- A mode of program execution in which the debugger single-steps
to the next port and prints the goal.
- unbound
- A variable is unbound if it has not yet been instantiated.
- unification
- 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. A goal unifies with the
head of a clause if 1) they have the same functor, and 2) all of
the argument terms can be unified. The rules governing the
unification of terms are:
- Two constants unify with one another if they are identical.
- A variable unifies with a constant or a structure.
As a result of the unification, the variable is instantiated to
the constant or structure.
- A variable unifies with another variable. As a result of the unification,
they become the same variable.
- A structure unifies with another structure if they have the same functor
and if all of the arguments can be unified.
- unit clause
- See fact.
- variable
- Logical variable. 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 (see instantiation).
A logical variable may be unified (see unification) with a constant,
a structure, or another variable. Variables become uninstantiated
when the procedure they occur in backtracks (see backtracking) past
the point at which they were instantiated. A variable is written as a single
word (with no intervening spaces) beginning either with a capital letter
without quotes, or with the character "_". Examples:
X Y Z Name Position _c _305 One_stop
- volatile
- Predicate property. The clauses of a volatile predicate are not saved
by in QOF files by the Prolog 'save' predicates. However, they are saved
by qpc.
- window
- Under the Emacs interface, a region of the terminal screen. There are
two types of window: the Prolog window, of which there is exactly one,
and the the text window, of which there are one or more. Each window has
a mode line at the bottom, and each text window displays the contents
of one file.