I have 7 cups which contains some water. I need to program these cups to have different amounts of water. Once this is done I need to measure the cup which has the highest amount of water and then remove some quantity (say 2 units of water).
c implementations:
float c1=2.0, c2= 2.6, c3 = 2.8, c4=4.4 , c5 = 2.4, c6 = 2.1, c7 = 5.8;
if((c1 > c2) && (c1 > c3) && (c1 > c4) && (c1 > c5) && (c1 > c6) && (c1 > c7)); c1=c1-2;
if((c2 > c1) && (c2 > c3) && (c2 > c4) && (c2 > c5) && (c2 > c6) && (c2 > c7)); c2=c2-2;
if((c3 > c2) && (c3 > c1) && (c3 > c4) && (c3 > c5) && (c3 > c6) && (c3 > c7)); c3=c3-2;
if((c4 > c2) && (c4 > c3) && (c4 > c1) && (c4 > c5) && (c4 > c6) && (c4 > c7)); c4=c4-2;
if((c5 > c2) && (c5 > c3) && (c5 > c4) && (c5 > c1) && (c5 > c6) && (c5 > c7)); c5=c5-2;
if((c6 > c2) && (c6 > c3) && (c6 > c4) && (c6 > c5) && (c6 > c1) && (c6 > c7)); c6=c6-2;
if((c7 > c2) && (c7 > c3) && (c7 > c4) && (c7 > c5) && (c7 > c6) && (c7 > c1)); c7=c7-2;
This will give an answer as c7 = 3.8
I was trying to implement this in z3 and I assigned the values to c1....c7
ite( (and((> c1 c2) (> c1 c3) (> c1 c4) (> c1 c5) (> c1 c6) (> c1 c7))) (= c1_1 (- c1 2) (= c1_1 c1))
.
.
.repeated till c7_1
and when I get the model values it should give c7_1 as 3.8
Is it possible to define this in z3? When I am using the and's of different conditions in if condition (in ite) its giving me an error. Can it not be defined like this? Is there someway around this?
Thanks in advance
[problem description][1]
I am experimenting with the Z3 tool, It was easy to get he first part However for the second part is being a bit difficult.