.
The abstract substitution
The abstract substitution of this domain consists in a sorted list of idempotent unification equations (or bottom). For example:
[X=_, Y=g(X)]
is not a proper abstract substitution since
X appears both in the left and the right side. The correct abstract substitution would be:
[X = A, Y = g(A)]
Notice that
X = A does not mean that X is a variable. It means that we do not know anything about
X (i.e., it is top).
How to run the analysis
We can run this analysis by simply calling analyze(depthk) as usual. In that case the depth is set to one. If we want to change the depth paramemter we have to type the follwoing in the CiaoPP top level:
?- set_pp_flag(depthk_k, N).
with
N a natural number (but not 0).
Some examples
Example 1
Consider this predicate:
ex1(X) :-
X = f(a, Y),
Y = g(h(k(a, b, c))).
the result of the analysis with
K = 1 is:
:- true pred ex1(X)
=> instance(X,f(_A,_B)).
Let us check the results with other values of K:
- K = 2 we obtain: instance(X,f(a,g(_A))).
- K = 3 we obtain: instance(X,f(a,g(h(_A)))).
- K = 4 we obtain: instance(X,f(a,g(h(k(_A,_B,_C))))).
- K = 5 we obtain: instance(X,f(a,g(h(k(a,b,c))))).
Larger depths can be more useful when recursion arises (but not to the point of covering the complete recursiomn, as, e.g., a regular type analysis will):
Example 2
Consider the following example:
ex(X) :-
li(Y),
X = g(s(a, Y), Z).
li(f(a, a, f(b,b, f(c,c, nil)))).
li(f(a, a, f(b,b,T))) :-
li(T).
in this case with the default depth we obtain:
:- true pred ex(X)
=> instance(X,g(_A,_B)).
Let us check the results with other values of
K:
- K = 2 we obtain: instance(X,g(s(_B,_C),_A)).
- K = 3 we obtain: instance(X,g(s(a,f(_B,_C,_D)),_A)).
- K = 4 we obtain: instance(X,g(s(a,f(a,a,f(_B,_C,_D))),_A)).
- K = 5 we obtain: instance(X,g(s(a,f(a,a,f(b,b,f(_B,_C,_D)))),_A)).
More in depth
Consider the following example:
r(Y, Z) :-
Y = g(L),
M = f(K),
Z = f(Y).
If we execute the analysis with a raw output (that can be activated typing
set_pp_flag(output_lang, raw). in the toplevel) we get:
r(Y,Z) :-
true(2,[[Y=_,Z=_,L=_,M=_,K=_]]),
'term_basic:='(Y,g(L)),
true(2,[[Y=g(F),Z=_,L=F,M=_,K=_]]),
'term_basic:='(M,f(K)),
true(2,[[Y=g(G),Z=_,L=G,M=f(H),K=H]]),
'term_basic:='(Z,f(Y)),
true(2,[[Y=g(I),Z=f(g(I)),L=I,M=f(J),K=J]]).
In this case we can see that all the program variables are represented in the abstract substitution. Moreover, each variable in the left side of a unification is a program variable. Notice that we do not know if they are free or not with the given information.
Documentation on multifiles
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.
No further documentation available for this predicate.
The predicate is multifile.