$\begingroup$Yes. It means that the number of steps is finite so it will terminate as you have written.$\endgroup$
– James SmithDec 3 '18 at 10:31

$\begingroup$It is supposed to be $(a+1)$ != $b$ (is not equal)$\endgroup$
– James SmithDec 3 '18 at 10:32

1

$\begingroup$You should be able to prove that, if $b-a > 1$, then after one iteration the difference $b-a$ decreased. This is because one of those endpoints was moved to $p$ which lies in the middle. So, eventually $b-a=1$ (since the difference is always positive, according to your invariant) and the loop stops.$\endgroup$
– chiDec 3 '18 at 11:33