123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127(****************************************************************************)(* *)(* This file is part of MOPSA, a Modular Open Platform for Static Analysis. *)(* *)(* Copyright (C) 2017-2019 The MOPSA Project. *)(* *)(* This program is free software: you can redistribute it and/or modify *)(* it under the terms of the GNU Lesser General Public License as published *)(* by the Free Software Foundation, either version 3 of the License, or *)(* (at your option) any later version. *)(* *)(* This program is distributed in the hope that it will be useful, *)(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)(* GNU Lesser General Public License for more details. *)(* *)(* You should have received a copy of the GNU Lesser General Public License *)(* along with this program. If not, see <http://www.gnu.org/licenses/>. *)(* *)(****************************************************************************)(** Lattice of partial inversible maps.
Sets of partial maps M ∈ ℘(𝕂 ⇀ 𝕍) from concrete keys set 𝕂 to
concrete values set 𝕍 are abstracted as a set of partial maps ℳ ∈
𝕂 ⇀ (℘(𝕍) ∪ {⊤}).
*)openMopsa_utilsopenTopopenCore.AllmoduletypeS=sigtypekey(** Keys of the map *)typevalue(** Values of the map *)moduleKeySet:SetExtSig.Swithtypeelt=key(** Set of keys *)moduleValueSet:SetExtSig.Swithtypeelt=value(** Set of values *)typet(** Type of inversible maps *)valbottom:t(** ⊥ element *)valtop:t(** ⊤ element *)valis_bottom:t->bool(** [is_bottom a] checks whether [a] is ⊥ *)valprint:Print.printer->t->unit(** Pretty printer. *)valempty:t(** Singleton of empty map *)valsubset:t->t->bool(** Inclusion test. *)valjoin:t->t->t(** Join two sets of partial maps. *)valmeet:t->t->t(** Intersect to sets of partial maps. *)valwiden:'actx->t->t->t(** Widening operator *)valfind:key->t->ValueSet.twith_top(** [find k a] find the set of values attached to key [k] in
[a]. Raise [Not_found] of the key is not found.
*)valfind_inverse:value->t->KeySet.twith_top(** [find_inverse] finds the set of keys attached to value [v] in [a]. *)valremove:key->t->t(** [remove k a] removes all bindings [(k,-)] in [a] *)valremove_inverse:value->t->t(** [remove_inverse v a] remove all bindings [(-,v)] in [a] *)valfilter:(key->ValueSet.twith_top->bool)->t->t(** [filter f a] keeps all bindings [(k,vs)] in [a] such that [f k vs] is true *)valfilter_inverse:(value->KeySet.t->bool)->t->t(** [filter_inverse f a] keeps all inverse bindings [(v,ks)] in [a] such that [f v ks] is true *)valset:key->ValueSet.twith_top->t->t(** [set k vs a] adds the binding [(k,vs)] to [a]. Previous bindings are overwritten. *)valadd_inverse:value->KeySet.t->t->t(** [add_inverse v ks a] adds the binding [(k,{v} ∪ find k a)] to [a], where [k] ∈ [ks]. *)valrename:key->key->t->t(** [rename k k' a] renames key [k] to [k'] in [a] *)valrename_inverse:value->value->t->t(** [rename k k' a] renames value [v] to [v'] in [a] *)valsingleton:key->value->t(** [singleton k v] createw a map with the singleton binding [(k,{v})] *)valmem:key->t->bool(** [mem k a] check whether a binding [(k,-)] exists in [a] *)valmem_inverse:value->t->bool(** [mem v a] check whether a binding [(_,v)] exists in [a] *)valfold:(key->ValueSet.twith_top->'a->'a)->t->'a->'a(** [fold f a init] folds function [f] over elements [(k,vs)] in [a] *)valmap:(ValueSet.twith_top->ValueSet.twith_top)->t->t(** [map f a] replace bindings [(k,vs)] in [a] with [(k,f vs)] *)end