My problem is that I have to get all possible models for an array of the form as-array
. The code I have done for this is the following:
s = Solver()
check = s.check()
while (str(check) == "sat"):
mod = s.model()
block = []
for var in mod.decls():
block.append(var() != mod[var])
s.add(Or(block))
check = s.check()
var
can take values of type as-array
among others and when I run the line s.add(Or(block))
, the next time I run the line check = s.check
it returns unknown
Is there any other way to do it?
------- Edit -------
I have found a way to get all possible models for an array of the form as-array
that was the previous problem, the way I have done it is to create a variable that represents the size of the array and from i = 0 to i = n (where n is the size), make a[i]!= x
being "a" the array and "x" the value that takes "a[i]".
My problem now is that I have a datatype of the form "mk-pair" whose first argument is an array of the form as-array
and an Integer that indicates the size of the array.
When I get a model I have it in the form mk-pair(as-array, 30)
(for example), being 30 the size of the array.
The problem is that I can't find a way to obtain all the possible models, since if I deny the type of data (a != x, assuming that "a" is the datatype and "x" its value), it returns me unknown and if I do the first (as-array[0] != x), what I am really denying is as-array
, not the variable "a"(which is of the form mk-pair(as-array, Int) ) and when I ask for models several times I get duplicate results.
Any way to do this?