3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-27 10:55:50 +00:00

address ubuntu warning and add shortcuts for maxsat

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2016-10-03 16:22:13 -07:00
parent 186afe7d10
commit e3f0aff318
6 changed files with 56 additions and 12 deletions

View file

@ -7548,11 +7548,11 @@ def Sum(*args):
a__0 + a__1 + a__2 + a__3 + a__4
"""
args = _get_args(args)
if __debug__:
_z3_assert(len(args) > 0, "Non empty list of arguments expected")
if len(args) == 0:
return 0
ctx = _ctx_from_ast_arg_list(args)
if __debug__:
_z3_assert(ctx is not None, "At least one of the arguments must be a Z3 expression")
if ctx is None:
return _reduce(lambda a, b: a + b, args, 0)
args = _coerce_expr_list(args, ctx)
if is_bv(args[0]):
return _reduce(lambda a, b: a + b, args, 0)
@ -7560,6 +7560,7 @@ def Sum(*args):
_args, sz = _to_ast_array(args)
return ArithRef(Z3_mk_add(ctx.ref(), sz, _args), ctx)
def Product(*args):
"""Create the product of the Z3 expressions.
@ -7573,11 +7574,11 @@ def Product(*args):
a__0*a__1*a__2*a__3*a__4
"""
args = _get_args(args)
if __debug__:
_z3_assert(len(args) > 0, "Non empty list of arguments expected")
if len(args) == 0:
return 1
ctx = _ctx_from_ast_arg_list(args)
if __debug__:
_z3_assert(ctx is not None, "At least one of the arguments must be a Z3 expression")
if ctx is None:
return _reduce(lambda a, b: a * b, args, 1)
args = _coerce_expr_list(args, ctx)
if is_bv(args[0]):
return _reduce(lambda a, b: a * b, args, 1)