Did you know ... Search Documentation:
Pack xlibrary -- prolog/abstract_slicer.pl
PublicShow source

Implements the next abstract domain: find possible matches of output arguments of the given predicate.

 abstract_slice(:Head, +Mode:list, +Options, +State) is multi
Returns on backtracking, the possible instances in the Head of those argument positions marked with a (-) in Mode. State is unified with the result of the predicate abstract_interpreter/4, which is called inside.


consider the next predicate:

popt('option'(A), [])    :- member(A, [1,2,3]).
popt('option 1', Answer) :- append(_,_,Answer).
popt('option 2', Answer) :- member(Answer, [1,2,3]).
popt('option 3', []) :- member(_Answer, [1,2,3]).

If we just execute the predicate with Answer uninstatiated, we will get infinite solutions, but:

?- abstract_slice(popt(A,X),[+,?],[]).
A = option(1) ;
A = option(2) ;
A = option(3) ;
A = 'option 1' ;
A = 'option 2' ;
A = 'option 3'.

Will 'abstract' the execution of popt/2 to get all the matches of A, slicing out X

Undocumented predicates

The following predicates are exported, but not or incorrectly documented.

 abstract_slice(Arg1, Arg2, Arg3)
 apply_mode(Arg1, Arg2, Arg3, Arg4, Arg5)
 slicer_abstraction(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7)