You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
377 B
26 lines
377 B
#!/usr/bin/python
|
|
from z3 import *
|
|
|
|
x = BitVec('x', 32)
|
|
y = BitVec('y', 32)
|
|
|
|
s = Solver()
|
|
s.add(Distinct(((y & x)* -2) + (y + x), x^y))
|
|
|
|
result = s.check()
|
|
print(result)
|
|
if result == sat:
|
|
print(s.model())
|
|
|
|
|
|
### A 'different' way ###
|
|
|
|
s = Solver()
|
|
l = (y & x)*-2 + (y+x)
|
|
r = x^y
|
|
s.add(Distinct(l, r))
|
|
|
|
result = s.check()
|
|
print(result)
|
|
if result == sat:
|
|
print(s.model())
|