# Properties which are native to analyzers

Author(s): Francisco Bueno, Manuel Hermenegildo, Pedro López, Edison Mera.

This library contains a set of properties which are natively understood by the different program analyzers of ciaopp. They are used by ciaopp on output and they can also be used as properties in assertions.

## Documentation on exports

PROPERTY
clique(X)

X is a set of variables of interest, much the same as a sharing group but X represents all the sharing groups in the powerset of those variables. Similar to a sharing group, a clique is often translated to ground/1, indep/1, and indep/2 properties.

Usage: clique(X)

• Description: The clique pattern is X.
• The following properties should hold globally:
(native/2)This predicate is understood natively by CiaoPP as clique(X).

PROPERTY
clique_1(X)

X is a set of variables of interest, much the same as a sharing group but X represents all the sharing groups in the powerset of those variables but disregarding the singletons. Similar to a sharing group, a clique_1 is often translated to ground/1, indep/1, and indep/2 properties.

Usage: clique_1(X)

• Description: The 1-clique pattern is X.
• The following properties should hold globally:
(native/2)This predicate is understood natively by CiaoPP as clique_1(X).

PROPERTY
constraint(C)

C contains a list of linear (in)equalities that relate variables and int values. For example, [A < B + 4] is a constraint while [A < BC + 4] or [A = 3.4, B >= C] are not.

Usage: constraint(C)

• Description: C is a list of linear equations
• The following properties hold globally:
(native/1)This predicate is understood natively by CiaoPP.

PROPERTY
covered(X)

For any call of the form X there is at least one clause whose test succeeds (i.e., all the calls of the form X are covered) [DLGH97].

Usage: covered(X)

• Description: All the calls of the form X are covered.

PROPERTY
covered(X,Y)

All variables occuring in X occur also in Y.

Usage: covered(X,Y)

• Description: X is covered by Y.
• The following properties hold globally:
(native/1)This predicate is understood natively by CiaoPP.

PROPERTY

Meta-predicate with arguments: exception(goal).

Usage: exception(Goal)

• Description: Calls of the form Goal throw an exception.

PROPERTY

Meta-predicate with arguments: exception(goal,?).

Usage: exception(Goal,E)

• Description: Calls of the form Goal throw an exception that unifies with E.

PROPERTY
fails(X)

Calls of the form X fail.
Meta-predicate with arguments: fails(goal).

Usage: fails(X)

• Description: Calls of the form X fail.
• The following properties hold globally:
(native/1)This predicate is understood natively by CiaoPP.

PROPERTY
finite_solutions(X)

Calls of the form X produce a finite number of solutions [DLGH97].
Meta-predicate with arguments: finite_solutions(goal).

Usage: finite_solutions(X)

• Description: All the calls of the form X have a finite number of solutions.

PROPERTY

Meta-predicate with arguments: have_choicepoints(goal).

Usage: have_choicepoints(X)

• Description: A call to X creates choicepoints.

PROPERTY

Usage: indep(X)

• Description: The variables in pairs in X are pairwise independent.
• The following properties hold globally:
(native/2)This predicate is understood natively by CiaoPP as indep(X).

PROPERTY

Usage: indep(X,Y)

• Description: X and Y do not have variables in common.
• The following properties hold globally:
(native/2)This predicate is understood natively by CiaoPP as indep([[X,Y]]).

PROPERTY
is_det(X)

All calls of the form X are deterministic, i.e., produce at most one solution, or do not terminate. In other words, if X succeeds, it can only succeed once. It can still leave choice points after its execution, but when backtracking into these, it can only fail or go into an infinite loop.
Meta-predicate with arguments: is_det(goal).

Usage: is_det(X)

• Description: All calls of the form X are deterministic.

PROPERTY
linear(X)

X is bound to a term which is linear, i.e., if it contains any variables, such variables appear only once in the term. For example, [1,2,3] and f(A,B) are linear terms, while f(A,A) is not.

Usage: linear(X)

• Description: X is instantiated to a linear term.
• The following properties hold globally:
(native/1)This predicate is understood natively by CiaoPP.

PROPERTY
mshare(X)

X contains all sharing sets [JL88,MH89b] which specify the possible variable occurrences in the terms to which the variables involved in the clause may be bound. Sharing sets are a compact way of representing groundness of variables and dependencies between variables. This representation is however generally difficult to read for humans. For this reason, this information is often translated to ground/1, indep/1 and indep/2 properties, which are easier to read.

Usage: mshare(X)

• Description: The sharing pattern is X.
• The following properties should hold globally:
(native/2)This predicate is understood natively by CiaoPP as sharing(X).

PROPERTY
mut_exclusive(X)

For any call of the form X at most one clause succeeds, i.e., clauses are pairwise exclusive.
Meta-predicate with arguments: mut_exclusive(goal).

Usage: mut_exclusive(X)

• Description: For any call of the form X at most one clause succeeds.

PROPERTY

Meta-predicate with arguments: no_choicepoints(goal).

Usage: no_choicepoints(X)

• Description: A call to X does not create choicepoints.

PROPERTY

Meta-predicate with arguments: no_exception(goal).

Usage: no_exception(Goal)

• Description: Calls of the form Goal do not throw any exception.

PROPERTY

Meta-predicate with arguments: no_exception(goal,?).

Usage: no_exception(Goal,E)

• Description: Calls of the form Goal do not throw exception E.

PROPERTY

Meta-predicate with arguments: no_signal(goal).

Usage: no_signal(Goal)

• Description: Calls of the form Goal do not send any signal.

PROPERTY

Meta-predicate with arguments: no_signal(goal,?).

Usage: no_signal(Goal,E)

• Description: Calls of the form Goal do not send the signal E.

PROPERTY
non_det(X)

All calls of the form X are non-deterministic, i.e., produce several solutions.
Meta-predicate with arguments: non_det(goal).

Usage: non_det(X)

• Description: All calls of the form X are non-deterministic.

PROPERTY

Usage: nonground(X)

• Description: X is not ground.
• The following properties should hold globally:
(native/2)This predicate is understood natively by CiaoPP as not_ground(X).

PROPERTY
not_covered(X)

There is some call of the form X for which there is no clause whose test succeeds [DLGH97].

Usage: not_covered(X)

• Description: Not all of the calls of the form X are covered.

PROPERTY
not_fails(X)

Calls of the form X produce at least one solution, or do not terminate [DLGH97].
Meta-predicate with arguments: not_fails(goal).

Usage: not_fails(X)

• Description: All the calls of the form X do not fail.
• The following properties hold globally:
(native/1)This predicate is understood natively by CiaoPP.

PROPERTY
not_mut_exclusive(X)

For calls of the form X more than one clause may succeed. I.e., clauses are not disjoint for some call.
Meta-predicate with arguments: not_mut_exclusive(goal).

Usage: not_mut_exclusive(X)

• Description: For some calls of the form X more than one clause may succeed.

PROPERTY

Usage 1: num_solutions(X,N)

• Description: All the calls of the form X have N solutions.
• If the following properties should hold at call time:
X is a term which represents a goal, i.e., an atom or a structure.
(int/1)N is an integer.

Usage 2: num_solutions(Goal,Check)

• Description: For a call to Goal, Check(X) succeeds, where X is the number of solutions.
• If the following properties should hold at call time:
Goal is a term which represents a goal, i.e., an atom or a structure.
Check is a term which represents a goal, i.e., an atom or a structure.

PROPERTY

Usage: solutions(Goal,Sols)

• Description: Goal Goal produces the solutions listed in Sols.
• If the following properties should hold at call time:
Goal is a term which represents a goal, i.e., an atom or a structure.
(list/1)Sols is a list.

PROPERTY
possibly_fails(X)

Non-failure is not ensured for any call of the form X [DLGH97]. In other words, nothing can be ensured about non-failure nor termination of such calls.
Meta-predicate with arguments: possibly_fails(goal).

Usage: possibly_fails(X)

• Description: Non-failure is not ensured for calls of the form X.

PROPERTY
possibly_nondet(X)

Non-determinism is not ensured for all calls of the form X. In other words, nothing can be ensured about determinacy nor termination of such calls.

Usage: possibly_nondet(X)

• Description: Non-determinism is not ensured for calls of the form X.

PROPERTY
relations(X,N)

The goal X produces N solutions. In other words, N is the cardinality of the solution set of X.
Meta-predicate with arguments: relations(goal,?).

Usage: relations(X,N)

• Description: Goal X produces N solutions.

PROPERTY

Meta-predicate with arguments: sideff_hard(goal).

Usage: sideff_hard(X)

• Description: X has hard side-effects, i.e., those that might affect program execution (e.g., assert/retract).

PROPERTY

Meta-predicate with arguments: sideff_pure(goal).

Usage: sideff_pure(X)

• Description: X is pure, i.e., has no side-effects.

PROPERTY

Meta-predicate with arguments: sideff_soft(goal).

Usage: sideff_soft(X)

• Description: X has soft side-effects, i.e., those not affecting program execution (e.g., input/output).

PROPERTY

Meta-predicate with arguments: signal(goal).

Usage: signal(Goal)

• Description: Calls of the form Goal throw a signal.

PROPERTY

Meta-predicate with arguments: signal(goal,?).

Usage: signal(Goal,E)

• Description: A call to Goal sends a signal that unifies with E.

PROPERTY

Meta-predicate with arguments: signals(goal,?).

Usage: signals(Goal,Es)

• Description: Calls of the form Goal can generate only the signals that unify with the terms listed in Es.

PROPERTY

Usage: size(X,Y)

• Description: Y is the size of argument X, for any approximation.

PROPERTY

Usage: size(A,X,Y)

• Description: Y is the size of argument X, for the approximation A.

PROPERTY
size_lb(X,Y)

The minimum size of the terms to which the argument Y is bound is given by the expression Y. Various measures can be used to determine the size of an argument, e.g., list-length, term-size, term-depth, integer-value, etc. [DL93,LGHD96b].

Usage: size_lb(X,Y)

• Description: Y is a lower bound on the size of argument X.

PROPERTY

Usage: size_o(X,Y)

• Description: The size of argument X is in the order of Y.

PROPERTY
size_ub(X,Y)

The maximum size of the terms to which the argument Y is bound is given by the expression Y. Various measures can be used to determine the size of an argument, e.g., list-length, term-size, term-depth, integer-value, etc. [DL93,LGHD96b].

Usage: size_ub(X,Y)

• Description: Y is a upper bound on the size of argument X.

PROPERTY

Meta-predicate with arguments: size_metric(goal,?,?).

• Description: Metric is the metric of the variable Var, for any approximation.

PROPERTY

Meta-predicate with arguments: size_metric(goal,?,?,?).

• Description: Metric is the metric of the variable Var, for the approximation Approx. Currently, Metric can be: int/1, size/1, length/1, depth/2, and void/1.

PROPERTY
steps(X,Y)

The time (in resolution steps) spent by any call of the form X is given by the expression Y
Meta-predicate with arguments: steps(goal,?).

Usage: steps(X,Y)

• Description: Y is the cost (number of resolution steps) of any call of the form X.

PROPERTY
steps_lb(X,Y)

The minimum computation time (in resolution steps) spent by any call of the form X is given by the expression Y [DLGHL97,LGHD96b]
Meta-predicate with arguments: steps_lb(goal,?).

Usage: steps_lb(X,Y)

• Description: Y is a lower bound on the cost of any call of the form X.

PROPERTY

Meta-predicate with arguments: steps_o(goal,?).

Usage: steps_o(X,Y)

• Description: Y is the complexity order of the cost of any call of the form X.

PROPERTY
steps_ub(X,Y)

The maximum computation time (in resolution steps) spent by any call of the form X is given by the expression Y [DL93,LGHD96b].
Meta-predicate with arguments: steps_ub(goal,?).

Usage: steps_ub(X,Y)

• Description: Y is a upper bound on the cost of any call of the form X.

PROPERTY
tau(Types)

Types contains a list with the type associations for each variable, in the form V/[T1,..,TN]. Note that tau is used in object-oriented programs only

Usage: tau(TypeInfo)

• Description: Types is a list of associations between variables and list of types
• The following properties hold globally:
(native/1)This predicate is understood natively by CiaoPP.

PROPERTY
terminates(X)

Calls of the form X always terminate [DLGH97].
Meta-predicate with arguments: terminates(goal).

Usage: terminates(X)

• Description: All calls of the form X terminate.

PROPERTY

Meta-predicate with arguments: test_type(goal,?).

Usage: test_type(X,T)

• Description: Indicates the type of test that a predicate performs. Required by the nonfailure analyisis.

PROPERTY

Meta-predicate with arguments: throws(goal,?).

Usage: throws(Goal,Es)

• Description: Calls of the form Goal can throw only the exceptions that unify with the terms listed in Es.

PROPERTY

Meta-predicate with arguments: user_output(goal,?).

Usage: user_output(Goal,S)

• Description: Calls of the form Goal write S to standard output.

PROPERTY

Usage: instance(Term1,Term2)

• Description: Term1 is an instance of Term2.
• The following properties hold globally:
(native/1)This predicate is understood natively by CiaoPP.

## Known bugs and planned improvements

• A missing property is succeeds (not_fails = succeeds or not_terminates. -- EMM
• run-time check for throws/2 unimplemented yet.
• run-time check for signals/2 unimplemented yet.