def eq(self, conv, other):
     # Problems: Z3 catches fire if we apply __eq__ to something of tuple
     # sort, because apparently we contain DatatypeRef's, not ExprRef's.
     # Therefore, we have to use our own eq facility.
     eq = z3.Z3_mk_eq(conv.ctx.ctx, self.ast.ast, other.ast.ast)
     ref = z3.BoolRef(eq, conv.ctx)
     new_ast = Z3ast(ref, self.conv, self.conv.bool_sort)
     self.conv.store_ast(new_ast)
     return new_ast
Пример #2
0
 def walk_bv_comp(self, formula, args, **kwargs):
     cond = z3.Z3_mk_eq(self.ctx.ref(), args[0], args[1])
     z3.Z3_inc_ref(self.ctx.ref(), cond)
     then_ = z3.Z3_mk_numeral(self.ctx.ref(), "1", self.z3BitVecSort(1).ast)
     z3.Z3_inc_ref(self.ctx.ref(), then_)
     else_ = z3.Z3_mk_numeral(self.ctx.ref(), "0", self.z3BitVecSort(1).ast)
     z3.Z3_inc_ref(self.ctx.ref(), else_)
     z3term = z3.Z3_mk_ite(self.ctx.ref(), cond, then_, else_)
     z3.Z3_inc_ref(self.ctx.ref(), z3term)
     # De-Ref since this is handled internally by Z3
     z3.Z3_dec_ref(self.ctx.ref(), cond)
     z3.Z3_dec_ref(self.ctx.ref(), then_)
     z3.Z3_dec_ref(self.ctx.ref(), else_)
     return z3term
Пример #3
0
def my_eq(x, y):
    ctx = z3.main_ctx()
    return z3.BoolRef(z3.Z3_mk_eq(ctx.ref(), x.as_ast(), y.as_ast()), ctx)
Пример #4
0
def my_eq(x, y):
    ctx = z3.main_ctx()
    #    print "my_eq: {} = {}".format(x,y)
    return z3.BoolRef(z3.Z3_mk_eq(ctx.ref(), x.as_ast(), y.as_ast()), ctx)
Пример #5
0
 def _make_fast_eq(self, x, y):
     return z3.BoolRef(z3.Z3_mk_eq(self._ctx.ref(), x.as_ast(), y.as_ast()),
                       self._ctx)
Пример #6
0
def Eq(arg1, arg2):
    if arg2 is None:
        return False
    a, b = z3._coerce_exprs(arg1, arg2)
    return z3.BoolRef(z3.Z3_mk_eq(arg1.ctx_ref(), a.as_ast(), b.as_ast()),
                      arg1.ctx)