Z3 C ++ API表达式谓词运算符重载没有无符号运算

时间:2014-09-09 22:22:42

标签: z3

我正在从以下链接查看Z3 C ++ API的class expr文档 http://research.microsoft.com/en-us/um/redmond/projects/z3/classz3_1_1expr.html

我发现对于谓词运算符,我们“>” ,“> =”和“< =”,对于位向量,它只执行带符号的操作。例如,在运算符“> =”中,源代码是

{
        check_context(a, b);
        Z3_ast r;
        if (a.is_arith() && b.is_arith()) {
            r = Z3_mk_ge(a.ctx(), a, b);
        }
        else if (a.is_bv() && b.is_bv()) {
            r =Z3_mk_bvsge(a.ctx(), a, b);//This statement only did signed version, there actually is a Z3_mk_bvuge in C API
        }
        else {
            assert(false);
        }
        a.check_error();
        return expr(a.ctx(), r);
}

这是否意味着如果我想区分有符号和无符号操作我只能使用C API?

1 个答案:

答案 0 :(得分:1)

z ++ .h文件包含使用无符号位向量操作的定义(简写),例如:

 /**
     \brief unsigned less than or equal to operator for bitvectors.
  */
  inline expr ule(expr const & a, expr const & b) { return to_expr(a.ctx(), Z3_mk_bvule(a.ctx(), a, b)); }