set(maxrec,2). Sets the maximum number of recursions allowed with arguments of a size smaller or same.
set(max_depth,4). Sets the maximum number of layers that a term is searched for different structures in the loop prevention test. At this level only comparisons of the size of the terms are performed.
set(maxfinite,7). In the loop prevention test recursion is allowed if the arguments of a are elements from a finite set. This option determines which subset of the integers that are considered finite. The integer N belongs to the finite set iff abs(N)<maxfinite.
set(quickpe,0). If set to 1 a very quick partial evaluation is done as recursive calls are never unfolded. The flags maxrec, maxleading and maxfinite are not used at all if quickpe is set to 1. In effect, when a quick partial evaluation is done, most of the power of Mixtus is turned off, so don't use this option unless you have to.
set(maxnondeterm,10). If a predicate generated has more
than maxnondeterm clauses, it will not be unfolded.
maxnondeterm=10 is a reasonable value for interpreters being
partially evaluated, whereas maxnondeterm=1 might be good for
general programs as it guarantees that no indexing will be lost.
unset(delayoutput). Terms in the head of clause that cannot cause the unification to fail are moved right in the clause.
set(unfold_cut). If set, calls to clauses containing a cut will
sometimes be unfolded as if the following two rules are
satisfied. The first rule is that a goal is never unfolded in the
test-part of an if-then-else-construct if that would lead to an
introduction of cut into the test. The other rule can be
satisfied in two ways. The goal p will be unfolded in the clause
head :- g1, p, g2.
if that clause is the last in the predicate definition and g1
cannot create any choice-points. Also, the goal p will be
unfolded in any clause of the form
head :- g, !, g1, p, g2.
if g1 cannot create any choice-points.
unset(unfold_cut2).
Unfolding is done for a very special case for clauses containing
cut.
head :- g1, p, g2, !, g3.
p :- g4, !, g5.
p :- g6, !, g7.
The goal p is unfolded if:
- the goals between the call to p and cut (g2) cannot fail
- for each clause defining p having a cut the goals after the cut
cannot fail (i.e. the goals g5 and g7 cannot fail above).
Note that this optimization is seldom applicable, and that it is
normally turned off.
unset(if2cut). If set, the if-then-
else-construct
(Test -> Then; Else)
is converted into
(Test, !, Then; Else)
The conditions when this is done is identical to the conditions
for unfolding a predicate containing a cut, as described for the
parameter unfold_cut above.
set(maxpropleft,3). Sets the maximum number of times a binding may propagate left into the same predicate call. The should normally be no need to change this value.
set(maxlevel,0). Determines how many times the
following rewrite is allowed in a clause:
(Test -> Then; Else), Goals ---> (Test -> Then,Goals; Else,Goals)
For implementation reasons, this rewrite is never done within the
test-part of an if-then-else construct.
unset(preserve_loops). Normally nonproductive loops followed by a failure are replaced by just a failure. If this switch is set, all loops are preserved.
unset(tracing). Sets a tracing mode so that the current goal-stack is printed on the terminal (vt100 compatible).
unset(tracegoalstack). Almost like tracing, but
lists the goals in the goal-stack where recursive calls are
indented. (Does not need vt100 compatibility.)
Never have tracing and tracegoalstack set at the same time.
set(comments). Comments are included in the program produced, relating the original predicates with the newly produced predicates.
unset(print_settings). If set, the settings of these parameters is printed just before the generated code.
set(arithopt). If set, some transformations of arithmetic expressions may not preserve the type. For example X*0 is simplified into 0 although it is 0.0 if X is a float.
unset(functor_logical). If set, the built-in predicate functor/3
is considered logical although functor(X,F,N),X=a fails, whereas
functor(a,F,N) succeeds. If functor/3 is never called so that it
is meant to fail due to insufficient instantiations, the code
produced may be improved if this parameter is set.
For SICStus Prolog version 2.1 or later, functor/3 generates an
error message when called insufficiently instantiated and is
therefore always considered logical, and the parameter cannot be
unset.
unset(arg_logical). If set, the built-in predicate
arg/3 is considered logical although arg(N,f(a),_),N=1 fails,
whereas arg(1,f(a),_) succeeds.
For SICStus Prolog version 2.1 or later, arg/3 generates an error
message when called insufficiently instantiated and is therefore
always considered logical, and the parameter cannot be unset.
set(handle_freeze). If unset, freeze and dif are not handled and the execution of Mixtus is slightly faster.
set(cyclic). All unifications are checked for cyclic structures. If unset, Mixtus execution is faster but may crash!
set(indexargs) Normally Mixtus will not rearrange the order of the variables in the newly generated predicates, but if the flag indexargs is set, arguments which are known to be unbound at calling time are put last. This will facilitate indexing in some cases.
Mixtus will always terminate with a correct program for all settings of all parameters except arithopt, functor_logical, arg_logical, handle_freeze, and cyclic.
Declaring a predicate as executable will most probably result in incorrect code or a nonterminating execution of Mixtus unless the predicate meets the following requirements:
An Automatic Partial Evaluator for Full Prolog , Dan Sahlin, SICSDissertation Series. To make Mixtus behave exactly as described in the thesis unset the parameter unfold_cut .
The Mixtus Approach to Automatic Partial Evaluation of Full Prolog ,Dan Sahlin, In proceedings of the North American Conference on Logic Programming 1990, MIT Press.