Following this example in (found here: z3py) I can compare c
to e.g. Color.green
.
Color = Datatype('Color')
Color.declare('red')
Color.declare('green')
Color.declare('blue')
Color = Color.create()
# Let c be a constant of sort Color
c = Const('c', Color)
# Then, c must be red, green or blue
prove(Or(c == Color.green,
c == Color.blue,
c == Color.red))
In my application I have to compare c
to a python-string:
I would like something like this:
c = Const('c', Color)
solve(c == "green") # this doesn't work, but it works with Color.green
The approach works e.g. for IntSort
(see below), but not for my own Datatype.
i = Int("i")
solve(i < 10)