-
Notifications
You must be signed in to change notification settings - Fork 84
Description
Links
In my attempt to understand the Hoare powerset domain (SetDomain.Hoare) used for path-sensitivity I happened upon the following:
- some slides from Miné (slide 20),
- and referred from those: Bagnara et al. Widening Operators for Powerset Domains.
Issue
Our current widening is implemented as follows:
analyzer/src/domains/setDomain.ml
Lines 623 to 628 in 08316c5
| let product_widen op a b = match a,b with (* assumes b to be bigger than a *) | |
| | All, _ | _, All -> All | |
| | Set a, Set b -> | |
| let xs,ys = S.elements a, S.elements b in | |
| List.map (fun x -> List.map (fun y -> op x y) ys) xs |> List.flatten |> fun x -> reduce (Set (S.union b (S.of_list x))) | |
| let widen = product_widen (fun x y -> if B.leq x y then B.widen x y else B.bot ()) |
This corresponds exactly to Definition 7 from the latter paper. However, it is only called an "extrapolation heuristics" and not "widening" because it doesn't guarantee the ascending chain condition. So we don't do true widening there.
Possible fix
The same paper also presents three different generic proper widening operators for such a domain using the inner domain's widening. Implementing any of them might not be straightforward though because they all require some kind of additional operator.
Merging in Hoare domains
The paper also discusses merging of elements in a Hoare set. Therefore such notion seems closely related but Goblint has multiple different Hoare powerset domains with quite different characteristics:
- Path-sensitivity lifter (
PathSensitive2) domain is defined throughSetDomain.Hoarewith additional joining of elements wrapped around injoin_reducethroughshould_joins from innerSpecs. AddressSetdomain is defined throughSetDomain.HoarePObut the partitioning of elements into joined sets is deeply encoded intoHoarePOthrough questionable means. It assumes the inner domain's operators (e.g.join) only act on elements which should be joined and raiseLattice.Incomparableon anything else. From what I understand, this just encodes ashould_join-like query through exceptions while making no sense as a lattice (two elements can always be joined).- EDIT:
PartitionDomain.SetandPartitionDomain.Makealso use Hoare ordering and seem to use a specialcollapsefunction to do joining. This ends up in region analysis domain. - EDIT:
PartitionDomain.SetSetseems to largely duplicate the behavior of the above partition domains although doesn't explicitly contain a merging function (or it is implicit). This ends up in vareq analysis domain. - EDIT:
SetDomain.SensitiveConfis some old and unused path-sensitivity domain that also uses Hoare ordering. - EDIT: Historically
PathSensitive2was directly implemented as a Hoare-like domain before 5f5d8f8.
If the should_join-like operator is passed to a hoare powerset domain functor and the merging of elements by equivalence is moved to a single place, a single implementation should do. It would remove the need for exception-based control flow hacks while allowing an optimized bucket-based Hoare domain implementation to still be used.