我有以下限制条件:
# Trying to express these constraints:
# if x == 1:
# y == 2
# else:
# y == 3
# y == 3 || y == 2
x, y = z3.Ints("x y")
goal = z3.Goal()
goal.add(If(x == 1, y == 2, y == 3))
goal.add(Or(y == 2, y == 3))
strat = Then(
"simplify",
"propagate-values",
"split-clause",
"elim-term-ite")
simplified = strat(goal)
print(simplified.as_expr())
# prints the following:
# Or(And(If(x == 1, y == 2, y == 3),
# y == 2),
# And(If(x == 1, y == 2, y == 3),
# y == 3))
我希望z3消除 OR 约束,因为在给定If约束的情况下它是多余的。我有什么战术可以使用或预处理约束来实现?