In the code below I tried to add some extra information to BitVec variable, then created some condition, and then use get_vars to get back the x variable but it is always different because the output of this little snippet is False. I expected to be the same object but it seems that when x > 3 is executed, BoolRef is created and x is lost. Also, I expected that x.ast would be the same as var.ast but the instances are different.
from z3 import BitVec
from z3.z3util import get_vars
x = BitVec('x', 256)
x.foo = 1
some_cond = x > 3
for var in get_vars(some_cond):
print(var is x)
print(hasattr(var, 'foo'))
I thought to wrap z3.BitVec function in a class that extends z3.BitVecRef but it will be a pain since I need to wrap all the other functions such as z3.If, z3.And, z3.Or, etc.
I can include information in the name of the z3.BitVec but it will be slower since I need to parse that string later.
So, my question is if there is any other way to add information to z3.BitVec and get that information later with or without get_vars?
Thanks!