Floor equals Ceiling iff Integer

Theorem
Let $x \in \R$ be a real number.

Let $\floor x$ denote the floor of $x$, and $\ceiling x$ denote the ceiling of $x$.

Then:
 * $\floor x = \begin {cases}

\ceiling x & : x \in \Z \\ \ceiling x - 1 & : x \notin \Z \\ \end {cases}$

or equivalently:
 * $\ceiling x = \begin {cases}

\floor x & : x \in \Z \\ \floor x + 1 & : x \notin \Z \\ \end {cases}$

where $\Z$ is the set of integers.

Proof
From Real Number is Integer iff equals Floor:
 * $x \in \Z \implies x = \floor x$

From Real Number is Integer iff equals Ceiling:
 * $x \in \Z \implies x = \ceiling x$

So:
 * $x \in \Z \implies \floor x = \ceiling x$

Now let $x \notin \Z$.

From the definition of the floor function:


 * $\floor x = \map \sup {\set {m \in \Z: m \le x} }$

From the definition of the ceiling function:


 * $\ceiling x = \map \inf {\set {m \in \Z: m \ge x} }$

Thus:
 * $\floor x < x < \ceiling x$

Hence the result, from the definition of $\inf$ and $\sup$.