def refine(self, v): logging.debug("Refining: " + str(v)) if v.location not in self.cfa.panic: return if models(v.label, BoolVal(False)): return v_pi, u_pi = v.ancestors_path, v.transition_path assert (len(v_pi) == len(u_pi) + 1) u_pi_, times = timeshift(u_pi) assert (len(u_pi) == len(u_pi_)) try: a_hat = z3.sequence_interpolant(u_pi_) except z3.ModelRef as model: self.mark_unsafe(v, model) return a_hat.push(BoolVal(False)) assert (len(v_pi) == len(a_hat) + 1) for i in range(len(a_hat)): phi = untimeshift(a_hat[i], times) if not models(v_pi[i + 1].label, phi): for (x, y) in self.covering.copy(): if y == v_pi[i + 1]: self.covering.discard((x, y)) v_pi[i + 1].label = z3.simplify(And(v_pi[i + 1].label, phi))
def sequence_interpolant(self, formulas): self._check_logic(formulas) zf = [self.converter.convert(f) for f in formulas] try: itp = z3.sequence_interpolant(zf) pysmt_res = [self.converter.back(f) for f in itp] except z3.ModelRef: pysmt_res = None return pysmt_res