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.
 A: 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$
A: hint
Observe that
$$\frac{m-n+1}{2}=\frac{m+n+1}{2}-n$$
So, you just need to prove that
$$\lfloor a\rfloor +\lfloor a+\frac 12\rfloor=2a$$
where $ a=\frac{m+n}{2}$.
There are two cases
$$a\in \Bbb N \implies \lfloor a\rfloor +\lfloor a+\frac 12\rfloor=a+a$$
$$a\notin \Bbb N \implies a+\frac 12\in \Bbb N$$
$$\implies \lfloor a\rfloor +\lfloor a+\frac 12\rfloor=$$
$$a+\frac 12-1+a+\frac 12=2a$$
Done.
A: 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.
