Author(s): Daniel Cabeza, Manuel Hermenegildo.
Version: 1.11#222 (2004/5/24, 13:8:7 CEST)
Version of last change: 1.11#166 (2004/2/3, 21:12:16 CET)
This library contains the set of basic properties used by the builtin predicates, and which constitute the basic data types and properties of the language. They can be used both as type testing builtins within programs (by calling them explicitly) and as properties in assertions.
basic_props
)member/2
,
compat/2
,
iso/1
,
not_further_inst/2
,
sideff/2
,
regtype/1
,
native/1
,
native/2
,
eval/1
.
term/1
,
int/1
,
nnegint/1
,
flt/1
,
num/1
,
atm/1
,
struct/1
,
gnd/1
,
constant/1
,
callable/1
,
operator_specifier/1
,
list/1
,
list/2
,
sequence/2
,
sequence_or_list/2
,
character_code/1
,
string/1
,
predname/1
,
atm_or_atm_list/1
.
basic_props
)The most general type (includes all possible terms).
General properties: term(X)
term(X)
is side-effect free
.
(basic_props:sideff/2
)
Usage: term(X)
X
is any term.
basic_props:native/1
)
The type of integers. The range of integers is [-2^2147483616, 2^2147483616)
. Thus for all practical purposes, the range of integers can be considered infinite.
General properties: int(T)
int(T)
is side-effect free
.
(basic_props:sideff/2
)
Usage: int(T)
T
is an integer.
basic_props:native/1
)
The type of non-negative integers, i.e., natural numbers.
General properties: nnegint(T)
nnegint(T)
is side-effect free
.
(basic_props:sideff/2
)
Usage: nnegint(T)
T
is a non-negative integer.
basic_props:native/1
)
The type of floating-point numbers. The range of floats is the one provided by the C double
type, typically [4.9e-324, 1.8e+308]
(plus or minus). There are also three special values: Infinity, either positive or negative, represented as 1.0e1000
and -1.0e1000
; and Not-a-number, which arises as the result of indeterminate operations, represented as 0.Nan
General properties: flt(T)
flt(T)
is side-effect free
.
(basic_props:sideff/2
)
Usage: flt(T)
T
is a float.
basic_props:native/1
)
The type of numbers, that is, integer or floating-point.
General properties: num(T)
num(T)
is side-effect free
.
(basic_props:sideff/2
)
Usage: num(T)
T
is a number.
basic_props:native/1
)
The type of atoms, or non-numeric constants. The size of atoms is unbound.
General properties: atm(T)
atm(T)
is side-effect free
.
(basic_props:sideff/2
)
Usage: atm(T)
T
is an atom.
basic_props:native/1
)
The type of compound terms, or terms with non-zeroary functors. By now there is a limit of 255 arguments.
General properties: struct(T)
struct(T)
is side-effect free
.
(basic_props:sideff/2
)
Usage: struct(T)
T
is a compound term.
basic_props:native/1
)
The type of all terms without variables.
General properties: gnd(T)
gnd(T)
is side-effect free
.
(basic_props:sideff/2
)
Usage: gnd(T)
T
is ground.
basic_props:native/1
)
General properties: constant(T)
constant(T)
is side-effect free
.
(basic_props:sideff/2
)
Usage: constant(T)
T
is an atomic term (an atom or a number).
General properties: callable(T)
callable(T)
is side-effect free
.
(basic_props:sideff/2
)
Usage: callable(T)
T
is a term which represents a goal, i.e., an atom or a structure.
The type and associativity of an operator is described by the following mnemonic atoms:
xfx
xfy
yfx
fx
fy
xf
yf
General properties: operator_specifier(X)
operator_specifier(X)
is side-effect free
.
(basic_props:sideff/2
)
Usage: operator_specifier(X)
X
specifies the type and associativity of an operator.
A list is formed with successive applications of the functor '.'/2
, and its end is the atom []
. Defined as
list([]). list([_1|L]) :- list(L).
General properties: list(L)
list(L)
is side-effect free
.
(basic_props:sideff/2
)
Usage: list(L)
L
is a list.
list(L, T)
L
is a list, and for all its elements, T
holds.
Meta-predicate with arguments: list(?,pred(1))
.
General properties: list(L, T)
list(L,T)
is side-effect free
.
(basic_props:sideff/2
)
Usage: list(L, T)
L
is a list of T
s.
General properties: member(X, L)
member(X,L)
is side-effect free
.
(basic_props:sideff/2
)
Usage: member(X, L)
X
is an element of L
.
A sequence is formed with zero, one or more occurrences of the operator
','/2
. For example, a, b, c
is a sequence of three atoms, a
is a sequence of one atom.
Meta-predicate with arguments: sequence(?,pred(1))
.
General properties: sequence(S, T)
sequence(S,T)
is side-effect free
.
(basic_props:sideff/2
)
Usage: sequence(S, T)
S
is a sequence of T
s.
Meta-predicate with arguments: sequence_or_list(?,pred(1))
.
General properties: sequence_or_list(S, T)
sequence_or_list(S,T)
is side-effect free
.
(basic_props:sideff/2
)
Usage: sequence_or_list(S, T)
S
is a sequence or list of T
s.
General properties: character_code(T)
T
is an integer.
(basic_props:int/1
)
character_code(T)
character_code(T)
is side-effect free
.
(basic_props:sideff/2
)
Usage: character_code(T)
T
is an integer which is a character code.
A string is a list of character codes. The usual syntax for strings "string"
is allowed, which is equivalent to [0's,0't,0'r,0'i,0'n,0'g]
or [115,116,114,105,110,103]
. There is also a special Ciao syntax when the list is not complete: "st"||R
is equivalent to [0's,0't|R]
.
General properties: string(T)
T
is a list of character_code
s.
(basic_props:list/2
)
string(T)
string(T)
is side-effect free
.
(basic_props:sideff/2
)
Usage: string(T)
T
is a string (a list of character codes).
General properties: predname(P)
predname(P)
is side-effect free
.
(basic_props:sideff/2
)
Usage: predname(P)
P
is a Name/Arity structure denoting a predicate name:
predname(P/A) :- atm(P), nnegint(A).
General properties: atm_or_atm_list(T)
atm_or_atm_list(T)
is side-effect free
.
(basic_props:sideff/2
)
Usage: atm_or_atm_list(T)
T
is an atom or a list of atoms.
This property captures the notion of type or
property compatibility. The instantiation or constraint state of the term is compatible with the given property, in the sense that assuming that imposing that property on the term does not render the store inconsistent. For example, terms X
(i.e., a free variable), [Y|Z]
, and [Y,Z]
are all compatible with the regular type
list/1
, whereas the terms f(a)
and [1|2]
are not.
Meta-predicate with arguments: compat(?,pred(1))
.
General properties: compat(Term, Prop)
compat(Term,Prop)
is side-effect free
.
(basic_props:sideff/2
)
Usage: compat(Term, Prop)
Term
is compatible with Prop
General properties: iso(G)
iso(G)
is side-effect free
.
(basic_props:sideff/2
)
Usage: iso(G)
General properties: not_further_inst(G, V)
not_further_inst(G,V)
is side-effect free
.
(basic_props:sideff/2
)
Usage: not_further_inst(G, V)
V
is not further instantiated.
sideff(G, X)
Declares that G
is side-effect free (if its execution has no observable result other than its success, its failure, or its abortion), soft (if its execution may have other observable results which, however, do not affect subsequent execution, e.g., input/output), or hard (e.g., assert/retract).
Meta-predicate with arguments: sideff(goal,?)
.
General properties: sideff(G, X)
basic_props:native/1
)
sideff(G,X)
is side-effect free
.
(basic_props:sideff/2
)
Usage: sideff(G, X)
G
is side-effect X
.
X
is an element of [free,soft,hard]
.
(basic_props:member/2
)
Meta-predicate with arguments: regtype(goal)
.
General properties: regtype(G)
regtype(G)
is side-effect free
.
(basic_props:sideff/2
)
Usage: regtype(G)
Meta-predicate with arguments: native(goal)
.
General properties: native(P)
native(P)
is side-effect free
.
(basic_props:sideff/2
)
Usage: native(Pred)
Meta-predicate with arguments: native(goal,?)
.
General properties: native(P, K)
native(P,K)
is side-effect free
.
(basic_props:sideff/2
)
Usage: native(Pred, Key)
Key
.
A property, defined as follows:
Go to the first, previous, next, last section, table of contents.