Module Checker__Location.ConstrSet
the ConstrSet submodule provides a data type for tracking constraints on abstract locations. Let l1, l2 be two locations. 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_locthe type for constraints, every constraint
subset in supsetis represented as a(subset, supset)pair.
val empty : tan empty constraint set
val singleton : sub:location -> sup:abstract_loc -> tcreate a constraint set with only one constraint. The superset must be a plain
abstract_locwithout any path
val add : sub:location -> sup:abstract_loc -> t -> tadd a new constraint to a constraint set The superset must be a plain
abstract_locwithout any path
val merge : t -> t -> tmerge t1 t2mergest1andt2. The resulting constraint set is equivalent to the union of the constraints int1andt2.
val find_supsets : location -> t -> (path * location) Stdlib.Seq.tfind_supsets loc tcalculates all supersets ofloc, i.e. all locationsloc'that satisfyloc in loc'w.r.t. the constraints int, taking transitivity (ifl1 in l2andl2 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 < supis deducible fromt
val find_subsets : abstract_loc -> t -> location Stdlib.Seq.tfind_subsets loc tcalculates all subsets ofloc, i.e. all locationsloc'that satisfyloc' in locw.r.t. the constraints int, taking transitivity (ifl1 in l2andl2 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 -> tsimplify ~wrt:abs_locs tcreates a simplified constraint set fromtthat only contains constraint about the abstract locations inabs_locs. The new constraint set is equivalent toton relations between locations starting withabs_locs.Constraints not containing
abs_locsmay affect the simplified constraint set via transitivity. For example, ifabs_locs = [l1, l2], withl1 in l3andl3 in l2int, thensimplify ~wrt:abs_locs twill containl1 in l2.