Probably it is a very simple solution and I am just dumb, but I cant find the invariant for this while loop. For proving (a+b) <= 2x you can take (x+y>a+b), so probably this is the first part of the invariant, but for the second part, so to prove 2x<= (a+b+1)... what the hell do you do here? I tried everything and lost two hours doing that.
I feel like it should be obvious, I just cant see it.
I understand the theory regarding proving partial correctness. I just cannot find the loop-invariant, so just the invariant would be much appreciated, no need to explain the theory.
Prove partial correctness of the following program
{a<b}
x = a;
y = b;
while x < y do
x = x+1;
y = y-1;
done;
{(a+b) <= 2x <= (a+b+1)}