<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] Notice that $\forall x \in \mathbb Z, \left\lfloor \frac x2   \right\rfloor = \frac x2 - \left\lfloor \frac{x \mod 2}{2}\right\rfloor$, therefore
$$\left\lfloor \frac{m+n}{2}\right\rfloor + \left\lfloor \frac{m-n+1}{2}\right\rfloor\\
=\frac{m+n}{2}  - \left\lfloor \frac{m+n \mod 2}{2}\right\rfloor + \frac{m-n+1}{2}- \left\lfloor \frac{m-n+1 \mod 2}{2} \right\rfloor$$
$$= m + \frac 12 - \left\lfloor \frac{m+n \mod 2}{2}\right\rfloor - \left\lfloor \frac{m-n+1 \mod 2}{2} \right\rfloor\tag1$$
Since $m+n$ and $m-n$ have the same parity, the last two terms in $(1)$ sum to $-\frac 12$, and we are done.
</s>