1

I was looking at document of class expr of Z3 C++ API from following link http://research.microsoft.com/en-us/um/redmond/projects/z3/classz3_1_1expr.html.

I found that for predicate operator such us ">" , ">=" and "<=", for bit vector it only performed signed operation. For example in operator ">=", source code is

{
        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);
}

Does this mean if I want to distinguish between signed and unsigned operation I can only use C API?

Min Gao
  • 383
  • 4
  • 16

1 Answers1

1

The z++.h file contains definitions (shorthands) for using the unsigned bit-vector operations, for example:

 /**
     \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)); }
Nikolaj Bjorner
  • 8,229
  • 14
  • 15
  • Just out of curiosity is there any specific concern writing a shortcut in this way while designing the code? – Min Gao Sep 09 '14 at 23:46