module Fixpoint:Fixpoint analysis of an equation systemsig
..end
'vertex
: type of vertex/variable (identifier) in the hypergraph
describing the equation system;'hedge
: type of hyperedge/function (identifier) in the hypergraph
describing the equation system;'abstract
: type of abstract values associated to vertices/variables;'arc
: type of information associated to hyperedges/functions;'vertex
indicates to which vertex the result of the function is
associated (useful when abstract values are typed by an
environment, for instance)print_fmt
;dot_fmt
.type('vertex, 'hedge, 'abstract, 'arc)
manager =('vertex, 'hedge, 'abstract, 'arc) FixpointType.manager
= {
|
mutable bottom : |
(* | Create a bottom value | *) |
|
mutable canonical : |
(* | Make an abstract value canonical | *) |
|
mutable is_bottom : |
(* | Emptiness test | *) |
|
mutable is_leq : |
(* | Inclusion test | *) |
|
mutable join : |
|||
|
mutable join_list : |
(* | Binary and n-ary join operation | *) |
|
mutable widening : |
(* | Apply widening at the given point, with the two arguments. Widening will always be applied with first argument being included in the second one. | *) |
|
mutable odiff : |
(* | Sound approximation of set difference (optional) | *) |
|
mutable abstract_init : |
(* | Return the non-bottom initial value associated to the given vertex | *) |
|
mutable arc_init : |
(* | Initial value for arcs | *) |
|
mutable apply : |
(* | Apply the function indexed by hedge to the array of arguments.
It returns the new abstract value, but also a user-defined information that will be associated to the hyperedge in the result. | *) |
|
mutable print_vertex : |
|||
|
mutable print_hedge : |
|||
|
mutable print_abstract : |
|||
|
mutable print_arc : |
(* | Printing functions | *) |
|
mutable accumulate : |
(* | If true, during ascending phase, compute the union of old reachable value with growing incoming hyperedges. If false, recompute all incoming hyperedges. | *) |
|
mutable print_fmt : |
(* | Typically equal to Format.std_formatter | *) |
|
mutable print_analysis : |
|||
|
mutable print_component : |
|||
|
mutable print_step : |
|||
|
mutable print_state : |
|||
|
mutable print_postpre : |
|||
|
mutable print_workingsets : |
(* | Printing Options | *) |
|
mutable dot_fmt : |
(* | Some fmt enables DOT output. You can set dummy
values to the fields below if you always set None
and you do not want DOT output. | *) |
|
mutable dot_vertex : |
(* | Print vertex identifiers in DOT format | *) |
|
mutable dot_hedge : |
(* | Print hyperedge identifiers in DOT format (vertices and hyperedges identifiers should be different, as they are represented by DOT vertices | *) |
|
mutable dot_attrvertex : |
(* | Print the displayed information in boxes | *) |
|
mutable dot_attrhedge : |
(* | Print the displayed information for hyperedges | *) |
PSHGraph.t
, see Fixpoint.analysis_std
and Fixpoint.analysis_guided
type('vertex, 'hedge)
equation ='vertex -> ('hedge, 'vertex array * 'vertex) PMappe.t
equation vertex
returns a map hat associates to each
successor hyperedge a pair of composed of the set of
predecessor vertices, and the successor vertex.typestrategy_iteration =
FixpointType.strategy_iteration
= {
|
mutable widening_start : |
(* | Nb of initial steps without widening in the current strategy | *) |
|
mutable widening_descend : |
(* | Maximum nb. of descending steps in the current strategy | *) |
|
mutable ascending_nb : |
(* | For stats | *) |
|
mutable descending_nb : |
(* | For stats | *) |
|
mutable descending_stable : |
(* | For stats | *) |
type('vertex, 'hedge)
strategy_vertex =('vertex, 'hedge) FixpointType.strategy_vertex
= {
|
mutable vertex : |
|||
|
mutable hedges : |
(* | Order in which the incoming hyperedges will be applied | *) |
|
mutable widen : |
(* | Should this vertex be a widening point ? | *) |
vertex
.hedges
is a list of incoming hyperedges. The effect of hyperedges are
applied "in parallel" and the destination vertex is updated. Be cautious:
if an incoming hyperedge is forgotten in this list, it won't be taken
into account in the analysis.widen
specifies whether the vertex is a widening point or not.type('vertex, 'hedge)
strategy =(strategy_iteration, ('vertex, 'hedge) strategy_vertex)
Ilist.t
[1; [2;3]; 4;
[5]; 6]
means:1
;2
then 3
, and loop until stabilization;4
;5
and loop until stabilization;6
and ends the analysis.strategy_iteration
, which indicates when to
start the widening, and the maximum number of descending
iterations.
Some observations on this example:
6
to 2
, the loop will not be iterated.[1; [2;
[3;4]; [5]]; 6]
, where the loop [3;4]
needs to be (temporarily stable)
before going on with 5
.typestat_iteration =
FixpointType.stat_iteration
= {
|
mutable nb : |
|
mutable stable : |
typestat =
FixpointType.stat
= {
|
mutable time : |
|
mutable ascending : |
|
mutable descending : |
type('vertex, 'hedge, 'abstract, 'arc)
output =('vertex, 'hedge, 'abstract, 'arc, stat) PSHGraph.t
val make_strategy_default : ?depth:int ->
?widening_start:int ->
?widening_descend:int ->
?priority:'hedge PSHGraph.priority ->
vertex_dummy:'vertex ->
hedge_dummy:'hedge ->
('vertex, 'hedge, 'e, 'f, 'g) PSHGraph.t ->
'vertex PSette.t -> ('vertex, 'hedge) strategy
(1 2 (3 4 5)
6 (7 8) 9)
where 1, 2, 6, 9
are SCC by themselves. A higher value
defines a more recursive behavior, like (1 2 (3 (4 5)) 6 (7 (8)) 9)
.(0,1)
.priority h >= 0
and the widening points, and also indicates
which hyperedge should be explored first at a point of choice.val analysis_std : ('vertex, 'hedge, 'abstract, 'arc) manager ->
('vertex, 'hedge, 'e, 'f, 'g) PSHGraph.t ->
'vertex PSette.t ->
('vertex, 'hedge) strategy ->
('vertex, 'hedge, 'abstract, 'arc) output
analysis_std manager graph sinit strategy
takes a graph
giving the structure of the equation system, a manager
indicating how to interpret the equation system, a
(super)set sinit
of the variables to be initialized to a
non-empty value, and an iteration strategy strategy
.
val analysis_guided : ('vertex, 'hedge, 'attr, 'arc) manager ->
('vertex, 'hedge, 'e, 'f, 'g) PSHGraph.t ->
'vertex PSette.t ->
(('hedge -> bool) -> ('vertex, 'hedge) strategy) ->
('vertex, 'hedge, 'attr, 'arc) output
Fixpoint.analysis_std
, but with the technique of
Gopan and Reps published in Static Anlaysis Symposium,
SAS'2007.
analysis_guided manager graph sinit make_strategy
:
compared to Fixpoint.analysis_std
, instead of providing a
strategy, one provides a function make_strategy
generating strategies, which takes as input a function
filtering the edges to be considered. A typical value for
the argument make_strategy
is (fun p ->
make_strategy_default ~priority:(PSHGraph.Filter p) vdummy
hdummy graph sinit)
.
val equation_of_graph : ?filter:('hedge -> bool) ->
('vertex, 'hedge, 'attr, 'arc, 'e) PSHGraph.t ->
('vertex, 'hedge) equation
('vertex,
'hedge) equation
or dynamically exploring the graph. The
filter
function allows to select a part of the graph.val graph_of_equation : ('vertex, 'hedge) PSHGraph.compare ->
?filter:('hedge -> bool) ->
make_attrvertex:('vertex -> 'attr) ->
make_attrhedge:('hedge -> 'arc) ->
info:'e ->
('vertex, 'hedge) equation ->
'vertex PSette.t -> ('vertex, 'hedge, 'attr, 'arc, 'e) PSHGraph.t
make_attrvertex
, make_attrhedge
and info
.val analysis_dyn : ('a, 'b) SHGraph.compare ->
guided:bool ->
('a, 'b, 'c, 'd) manager ->
('a, 'b) equation ->
'a PSette.t ->
(('a, 'b, 'c, 'd) FixpointType.graph -> ('a, 'b) strategy) ->
('a, 'b, 'c, 'd) output
val print_strategy_vertex : ('a, 'b, 'c, 'd) manager ->
Format.formatter -> ('a, 'b) strategy_vertex -> unit
print_strategy_vertex man fmt sv
prints an object of type
strategy_vertex
, using the manager man
for printing vertices and
hyperedges. The output has the form (boolean,vertex,[list of list of
hedges])
.val print_strategy : ('a, 'b, 'c, 'd) manager ->
Format.formatter -> ('a, 'b) strategy -> unit
print_strategy_vertex man fmt sv
prints an object of type
strategy
, using the manager man
for printing vertices and
hyperedges.val print_stat : Format.formatter -> stat -> unit
val print_output : ('vertex, 'hedge, 'attr, 'arc) manager ->
Format.formatter -> ('vertex, 'hedge, 'attr, 'arc) output -> unit