z3 无法证明传递身份
z3 cannot prove transitive identity
我正在尝试 z3 它能做什么。
到目前为止一切顺利,但我注意到 z3 在非常琐碎的表达式上失败了:
from z3 import *
a = Int("a")
b = Int("b")
c = Int("c")
prove(((a == b) and (b == c)) == ((a == c) and (c == b)))
$ python p.py
counterexample
[c = 1, b = 0, a = 0]
Python 的 and
不是符号感知的。相反,使用 z3
的 And
方法:
from z3 import *
a = Int("a")
b = Int("b")
c = Int("c")
prove(And(a == b, b == c) == (And(a == c, c == b)))
这会打印:
proved
我正在尝试 z3 它能做什么。 到目前为止一切顺利,但我注意到 z3 在非常琐碎的表达式上失败了:
from z3 import *
a = Int("a")
b = Int("b")
c = Int("c")
prove(((a == b) and (b == c)) == ((a == c) and (c == b)))
$ python p.py
counterexample
[c = 1, b = 0, a = 0]
Python 的 and
不是符号感知的。相反,使用 z3
的 And
方法:
from z3 import *
a = Int("a")
b = Int("b")
c = Int("c")
prove(And(a == b, b == c) == (And(a == c, c == b)))
这会打印:
proved