I have this code in Z3 python:
x = Bool('x')
y = Bool('y')
z = Bool('z')
z == (x xor y)
s = Solver()
s.add(z == True)
print s.check()
But this code reports below error when running:
c.py(4): error: invalid syntax
If I replace xor with and, there is no problem. So this means XOR is not supported?
You should use
Xor(a, b). Moreover, to create the Z3 expression that represents the formulaa and b, we must useAnd(a, b). In Python, we can’t overload the operatorsandandor.Here is an example with the
Xor(available online at rise4fun).