A.41 library(prolog_call_cycles): Find recursion in the static call graph
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
      • The SWI-Prolog library
        • library(prolog_call_cycles): Find recursion in the static call graph
          • call_graph/2
          • call_graph_sccs/2
          • call_graph_sccs/3
          • left_transparent/1
          • left_recursion/2
          • left_recursion/3
    • Packages
Availability::- use_module(library(prolog_call_cycles)).(can be autoloaded)
Source[det]call_graph_sccs(-SCCs:list(dict), +Options)
[det]call_graph_sccs(+Graph, -SCCs:list(dict), +Options)
Compute the strongly connected components of the call graph that contain at least one cycle, i.e., that have more than one member or a single member that calls itself. Each SCC is a dict with the keys below. The first form computes the graph using call_graph/2 from Options.
members
Sorted list of predicate indicators in the SCC.
edges
List of edges between members of the SCC. Each edge is a dict as described with call_graph/2, extended with the keys below.
left
true if the call is in left position and may take part in a loop (see module header). Note that a call with a subterm, computed or distinct argument is never in left position.
args
List of argument abstractions for the call. Each element is one of fresh (a variable that does not appear earlier in the clause), pass (a variable from the head), bound_earlier (a variable that appears in an earlier goal of the body), ground (a ground term), subterm (a proper subterm of a head argument, also if obtained using arg/3 or =../2), computed (the result of an arithmetic operation on a head argument that differs from its input, such as N-1), distinct (a value that is tested to differ from a head argument, e.g., using X \== Y) or constructed (a term with variables that is not a subterm of a head argument, e.g., an accumulator). If the call could not be analysed, this is unknown.
decreasing
true if this is a call to the same predicate and some argument is a proper subterm of the same argument in the head.
pruned
true if a cut can prune the call: a cut after the call in its clause, the cut of the if-then-else whose condition holds the call, \+/1, once/1, ignore/1 or forall/2. If the callee is tabled and part of the same SCC, such a cut raises a permission error.
barrier
none or the predicate through whose goal argument the call is made if that is a barrier for shift/1: findall/3 and the other predicates that collect all solutions, aggregate_all/3, foldall/4 and predicates defined in C. A tabled goal cannot suspend through a barrier to wait for an incomplete table.

If the option locations(true) is given (default), the location of the edges in the SCCs is refined by walking the involved clauses with source information.