Given c == a + 4
and t == c + b
, if b == -4
, then t == a
. I am trying to do the opposite, meaning given the above 2 equations and t == a
, I try to find value of b
.
This is pretty similar to the related question, but this time I only switch a
and b
, and I am really confused that the code returns different result.
Following the code posted at above link, I have below code (similar, only a
and b
swiched):
#!/usr/bin/python
from z3 import *
a, b, c, t = BitVecs('a b c t', 32)
g = True
g = And(g, c == (a + 4))
g = And(g, t == (c + b))
s = Solver()
s.add(ForAll([t, a, c], Implies(t == a, g)))
if s.check() == sat:
print s.model()[b]
else:
print 'Unsat'
However, on Ubuntu, running the above code returns unexpected result Unsat, but not value -4 (or 0xfffffffc)
Any idea why this is wrong?
Thanks so much.