<s>[INST] Identity with the floor function I'm struggling to complete proof of the following identity:
$$
\Bigl\lfloor \frac{m+ n}{2} \Bigr\rfloor +  \Bigl\lfloor \frac{m - n +1}{2} \Bigr\rfloor =m,
$$
where $m$ and $n$ are both integer.
By definition of floor function, $x-1 < \lfloor x \rfloor \leq x$.
Then
\begin{align}
\frac{m+n}{2} -1 <  & \Bigl\lfloor \frac{m+ n}{2}\Bigr\rfloor  \leq  & \frac{m+n}{2} \\
\frac{m-n + 1}{2} -1 < & \Bigl\lfloor \frac{m+ n}{2}\Bigr\rfloor  \leq & \frac{m-n +1}{2}.
\end{align}
By adding member to member, we obtain the following result:
$$
 m +\frac{1}{2} -2 <   \Bigl\lfloor \frac{m+ n}{2}\Bigr\rfloor + \Bigl\lfloor \frac{m- n +1}{2}\Bigr\rfloor  \leq  m +\frac{1}{2}.
$$
Which implies
$$
 -1.5 < \Bigl\lfloor \frac{m+ n}{2} \Bigr\rfloor + \Bigl\lfloor \frac{m- n +1}{2}  \Bigr\rfloor -m   \leq  .5
$$
This results in
$$
\Bigl\lfloor \frac{m+ n}{2}\Bigr\rfloor + \Bigl\lfloor \frac{m- n +1}{2}\Bigr\rfloor \in \left\{0,1\right\}.
$$
How to decide that the result is $0$?
Any help is welcome.
 [/INST] If $m+n$ is even, then $\Bigl\lfloor \frac{m+ n}{2}\Bigr\rfloor = \frac{m+n}{2}$ and as $m-n=m+n -2m$ is also even, $\Bigl\lfloor \frac{m- n+1}{2}\Bigr\rfloor = \frac{m-n-1}{2}$.
So $\Bigl\lfloor \frac{m+ n}{2}\Bigr\rfloor + \Bigl\lfloor \frac{m- n +1}{2}\Bigr\rfloor = m$
If $m+n$ is odd, then $\Bigl\lfloor \frac{m+ n}{2}\Bigr\rfloor = \frac{m+n-1}{2}$ and as $m-n=m+n -2m$ is also odd, $\Bigl\lfloor \frac{m- n+1}{2}\Bigr\rfloor = \frac{m-n}{2}$.
So $\Bigl\lfloor \frac{m+ n}{2}\Bigr\rfloor + \Bigl\lfloor \frac{m- n +1}{2}\Bigr\rfloor = m$
</s>