Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
from z3 import * x = Int('x') #declaration y = Int('y') #declaration solve((x ^ y)==2) #solving
我无法使用python在z3中执行异或运算。如果我做错了,请帮助告诉我正确的写作方式是什么,否则建议其他一些方式。请尽快回复。
您可以^在 Python 中使用整数:
^
>>> 2^3 1
但是,z3 不使用整数,而是使用自己的 Int 对象,并且不支持异或。你必须使用BitVec类型。
BitVec
x = BitVec('x', 32) y = BitVec('y', 32) solve(x^y==2, show=True)