Previous: Det Options, Up: The Determinacy Checker [Contents][Index]
As mentioned earlier, it is not in general possible to find exactly which places in a program will lead to nondeterminacy. The determinacy checker gives predicates the benefit of the doubt: when it is possible that a predicate will be determinate, it will not be reported. The checker will only report places in your program that will be nondeterminate regardless of which arguments are bound. Despite this, the checker catches most unwanted nondeterminacy in practice.
The determinacy checker looks for the following sources of nondeterminacy:
fail/0
,
false/0
, or raise_exception/1
. First argument
indexing is not considered for multifile predicates,
because another file may have a clause for this predicate
with the same principal functor of its first argument.
fail/0
, false/0
, or
raise_exception/1
in each arm of the disjunction but the
last, or where the whole disjunction is followed by a cut,
fail/0
, false/0
, or raise_exception/1
.
fail/0
,
false/0
, or raise_exception/1
, or where it appears in the
condition of an if-then-else construct. Known nondeterminate
predicates include hooks and those declared
nondeterminate or dynamic (since they can be modified,
dynamic predicates are assumed to be nondeterminate),
plus the following built-in predicates:
absolute_file_name/3
, when the options list contains
solutions(all)
.
atom_concat/3
, when the first two arguments are
variables not appearing earlier in the clause (including the
clause head).
bagof/3
, when the second argument contains any
variables not appearing earlier in the clause (including the
clause head).
clause/[2,3]
.
current_op/3
, when any argument contains any
variables not appearing earlier in the clause (including the
clause head).
current_key/2
, when the second argument contains any
variables not appearing earlier in the clause (including the
clause head).
current_predicate/2
, when the second argument contains any
variables not appearing earlier in the clause (including the
clause head).
length/2
, when both arguments are variables not
appearing earlier in the clause (including the clause
head).
predicate_property/2
, when either argument contains any
variables not appearing earlier in the clause (including the
clause head).
recorded/3
.
repeat/0
.
retract/1
.
setof/3
, when the second argument contains any
variables not appearing earlier in the clause (including the
clause head).
source_file/[1,2]
when the last argument contains any
variables not appearing earlier in the clause (including the
clause head).
sub_atom/5
, when at least two of the second, fourth and fifth
arguments are variables not appearing earlier in the
clause (including the clause head).