The C API for z3 has functions such as Z3_mk_bvadd_no_overflow, but these do not seem to be available from the Python API. Before I start hacking to solve this I'd just like to verify that this is the case and also request that these be added to the official version.
I'm trying adding things like this to z3.py, but so far haven't managed to get the details right. Suggestions about where I'm going wrong would be appreciated. I'm working on the contrib branch.
def Bvadd_no_overflow(a, b, si, ctx=None):
"""Create a Z3 bvadd_no_overflow expression.
"""
ctx = _get_ctx(_ctx_from_ast_arg_list([a, b], ctx))
# argh can't hard-code the 32
s = BitVecSort(32,ctx)
a = s.cast(a)
b = s.cast(b)
# this function requires a bool as the last argument but is it a python bool, a
# z3 bool, or what?
return BitVecRef(Z3_mk_bvadd_no_overflow(ctx.ref(), a.as_ast(), b.as_ast(), 1), ctx)