如果有条件,z3py 中的多个约束
multiple constraints in z3py if conditional
让我们假设我们有 2 个函数(funcA
和 funcB
)在 Z3 的当前上下文中构建一些约束。
我想守护Z3 if 格挡中的那些。在 z3py 中,你会写:
t = If(some_condition, funcA(), funcB())
这取决于 funcA
和 funcB
return 某些 z3 表达式。如果我想将它们表示为构建一堆约束而不是 returning 表达式的函数调用,那么更简单的方法是什么?
我会把它们变成 (pseduo-code):
for c in funcA():
s.add(Implies(some_condition, c))
for c in funcB():
s.add(Implies(Not(some_condition), c))
让我们假设我们有 2 个函数(funcA
和 funcB
)在 Z3 的当前上下文中构建一些约束。
我想守护Z3 if 格挡中的那些。在 z3py 中,你会写:
t = If(some_condition, funcA(), funcB())
这取决于 funcA
和 funcB
return 某些 z3 表达式。如果我想将它们表示为构建一堆约束而不是 returning 表达式的函数调用,那么更简单的方法是什么?
我会把它们变成 (pseduo-code):
for c in funcA():
s.add(Implies(some_condition, c))
for c in funcB():
s.add(Implies(Not(some_condition), c))