Beispiel #1
0
    def is_EE_closure(self, to_close, close_with):
        if to_close in self._NE_may:
            close_with = [
                cl for cl in close_with
                if cl.get_id() not in self._NE_may[to_close]
            ]

        def exists_subset(_n_over):
            if to_close not in _n_over.keys():
                return False
            candidates = (op[0] for op in _n_over[to_close]
                          if subset_abs(c_idx, op[1]) and op[0] is not None)
            return next(candidates, False)

        c_idx = abstract_states_to_int(close_with)
        if to_close in self._E_may_over.keys() and any(
            [subset_abs(c, c_idx) for c in self._E_may_over[to_close]]):
            return True

        subset_res = exists_subset(self._NE_may_over)
        if subset_res:
            return subset_res

        closure_result = Z3Utils.is_EE_closed(to_close, close_with)

        if closure_result is True:
            self.add_E_may_over(to_close, close_with)
        else:
            self.add_NE_may_over(to_close, (closure_result, close_with))

        return closure_result
Beispiel #2
0
 def add_NE_may_over(self, src, _dst):
     val = abstract_states_to_int(_dst[1])
     if src in self._NE_may_over.keys(
     ):  # tuple of (violation, non-closers)
         self._NE_may_over[src] = {
             ent
             for ent in self._NE_may_over[src]
             if not subset_abs(ent[1], val)
         }
     init_dict_by_key(self._NE_may_over, src, (_dst[0], val))
     return self
Beispiel #3
0
def exists_superset_for_key(_dict, key, superset_of):
    if key not in _dict.keys():
        return False
    val = abstract_states_to_int(superset_of)
    return any([subset_abs(val, _e) for _e in _dict[key]])
Beispiel #4
0
 def add_E_may_over(self, src, abs_states):
     val = abstract_states_to_int(abs_states)
     init_dict_by_key(self._E_may_over, src, val)
     return self
Beispiel #5
0
 def add_must_hyper(self, src, abs_states):
     val = abstract_states_to_int(abs_states)
     init_dict_by_key(self._E_must, src, val)
     return self