How do I calculate attributed values?
Here’s an example:
(declare-fun x () bool)
(declare-fun y () bool)
(declare-fun z () bool)
(assert (AND x (OR y z)))
With this I would get 2 models:
x=true and y=true
x=true and z=true
Now, what I want is something like this:
(declare-fun x () bool)
(declare-fun y () bool)
(declare-fun z () bool)
(declare-fun x.val () Int)
(declare-fun y.val () Int)
(declare-fun z.val () Int)
(assert (= x.val 2))
(assert (= y.val 3))
(assert (= z.val 5))
(assert (AND x (OR y z)))
(assert (> sum 6))
So, I would like to get the model where the sum of the attributes is larger than 6:
x=true and z=true
Maybe working with arrays is a way to achieve this…
I’m not sure if I understood your question correctly.
It seems you want to associate an (integer) attribute to each Boolean variable.
So, each variable is a pair: a Boolean value, and an integer attribute.
I’m assuming that by
sum, you meant the sum of the attributes of the variables assigned to true.If that is the case, you can model it in Z3 in the following way: