Module Checker__Location.ConstrSet
the ConstrSet
submodule provides a data type for tracking constraints on abstract locations. Let l1
, l2
be two location
s. Here l2
must start with an abstract location, hence represents a set of locations. Now constraints are of the form l1 in l2
, meaning that the set of locations denoted by l2
must contain l1
. l2
is called the superset and l1
is called the subset in the constraint
type constr
= location * abstract_loc
the type for constraints, every constraint
subset in supset
is represented as a(subset, supset)
pair.
val empty : t
an empty constraint set
val singleton : sub:location -> sup:abstract_loc -> t
create a constraint set with only one constraint. The superset must be a plain
abstract_loc
without any path
val add : sub:location -> sup:abstract_loc -> t -> t
add a new constraint to a constraint set The superset must be a plain
abstract_loc
without any path
val merge : t -> t -> t
merge t1 t2
mergest1
andt2
. The resulting constraint set is equivalent to the union of the constraints int1
andt2
.
val find_supsets : location -> t -> (path * location) Stdlib.Seq.t
find_supsets loc t
calculates all supersets ofloc
, i.e. all locationsloc'
that satisfyloc in loc'
w.r.t. the constraints int
, taking transitivity (ifl1 in l2
andl2 in l3
, thenl1 in l3
) and closure property (ifl1 in l2
, thenl1.field in l2.field
) of constraints into account.Every pair
(path, sup)
in the result indicates that a constraintloc.path < sup
is deducible fromt
val find_subsets : abstract_loc -> t -> location Stdlib.Seq.t
find_subsets loc t
calculates all subsets ofloc
, i.e. all locationsloc'
that satisfyloc' in loc
w.r.t. the constraints int
, taking transitivity (ifl1 in l2
andl2 in l3
, thenl1 in l3
) and closure property (ifl1 in l2
, thenl1.field in l2.field
) of constraints into account
val simplify : wrt:abstract_loc list -> t -> t
simplify ~wrt:abs_locs t
creates a simplified constraint set fromt
that only contains constraint about the abstract locations inabs_locs
. The new constraint set is equivalent tot
on relations between locations starting withabs_locs
.Constraints not containing
abs_locs
may affect the simplified constraint set via transitivity. For example, ifabs_locs = [l1, l2]
, withl1 in l3
andl3 in l2
int
, thensimplify ~wrt:abs_locs t
will containl1 in l2
.