In Z3 (Python), imagine I get a model with the following shape:
[c_0 = True, c_3 = False, c_1 = False, c_2 = False]
How can I order the variables, so that the assignment is alphabetically ordered?
[c_0 = True, c_1 = False, c_2 = False, c_3 = False]How can I access any element of the model? I mean, if I do:
m = s.model() #equivalent to [c_0 = True, c_3 = False, c_1 = False, c_2 = False]
a = m[0]
print(a)
I get c_0, and not the expected c_0 = True.
I put no more code in order to keep this post as simple as possible, the c variables are just examples.
My final objective is a method that, given [c_0 = True, c_3 = False, c_1 = False, c_2 = False] returns an array a=[True, False, False, False], where a[0] corresponds to the value of c_0, a[1] corresponds to the value of c_1, etc.
EDIT
For (1), I tried sorted(m, key=str.lower), but I get the following error: descriptor 'lower' requires a 'str' object but received a 'FuncDeclRef'. This means I should convert each element to str, which I do not want.
I prefer a 'native' method of Z3 that yields no modification in the type of the variables.