McEliece's Theorem (Integer Functions)

Theorem
Let $f: \R \to \R$ be a continuous, strictly increasing real function defined on an interval $A$.

Let:
 * $\forall x \in A: \left \lfloor{x}\right \rfloor \in A, \left \lceil{x}\right \rceil \in A$

where:
 * $\left \lfloor{x}\right \rfloor$ denotes the floor of $x$
 * $\left \lceil{x}\right \rceil$ denotes the ceiling of $x$

Then:
 * $\forall x \in A: \left \lfloor{f \left({x}\right)}\right \rfloor = \left \lfloor{f \left({\left \lfloor{x}\right \rfloor}\right)}\right \rfloor \iff \left \lceil{f \left({x}\right)}\right \rceil = \left \lceil{f \left({\left \lceil{x}\right \rceil}\right)}\right \rceil \iff \left(f \left({x}\right) \in \Z \implies x \in \Z)\right)$

Proof
Let $x \in A$.

Hence we have that both $\left \lfloor{x}\right \rfloor \in A$ and $\left \lceil{x}\right \rceil \in A$.

Necessary Condition
Let $f \left({x}\right) \in \Z$.

Let:
 * $\left \lfloor{f \left({x}\right)}\right \rfloor = \left \lfloor{f \left({\left \lfloor{x}\right \rfloor}\right)}\right \rfloor$

Then:

$x \notin \Z$.

Thus by Proof by Contradiction:
 * $x \in \Z$

Similarly, let:
 * $\left \lceil{f \left({x}\right)}\right \rceil = \left \lceil{f \left({\left \lceil{x}\right \rceil}\right)}\right \rceil$

Then:

$x \notin \Z$.

Thus by Proof by Contradiction:
 * $x \in \Z$

Thus:
 * $\forall x \in A: \left \lfloor{f \left({x}\right)}\right \rfloor = \left \lfloor{f \left({\left \lfloor{x}\right \rfloor}\right)}\right \rfloor \implies \left(f \left({x}\right) \in \Z \implies x \in \Z)\right)$

and:
 * $\forall x \in A: \left \lceil{f \left({x}\right)}\right \rceil = \left \lceil{f \left({\left \lceil{x}\right \rceil}\right)}\right \rceil \implies \left(f \left({x}\right) \in \Z \implies x \in \Z)\right)$

Sufficient Condition
Let $f$ be such that:
 * $f \left({x}\right) \in \Z \implies x \in \Z$

there exists $x \in A$ such that:
 * $\left \lfloor{f \left({x}\right)}\right \rfloor \ne \left \lfloor{f \left({\left \lfloor{x}\right \rfloor}\right)}\right \rfloor$

We have by definition of the floor function that $x \ge \left \lfloor{x}\right \rfloor$.

As $f$ is strictly increasing, it cannot be the case that $\left \lfloor{f \left({x}\right)}\right \rfloor < \left \lfloor{f \left({\left \lfloor{x}\right \rfloor}\right)}\right \rfloor$.

So it must be that:
 * $\left \lfloor{f \left({\left \lfloor{x}\right \rfloor}\right)}\right \rfloor < \left \lfloor{f \left({x}\right)}\right \rfloor$

Because $f$ is continuous:
 * $\exists y \in A: \left \lfloor{x}\right \rfloor < y \le x$

such that $f \left({y}\right) \in \Z$

But by definition of the floor function, $y$ cannot be an integer.

Thus by Proof by Contradiction:


 * $\left({f \left({x}\right) \in \Z \implies x \in \Z}\right) \implies \left \lfloor{f \left({x}\right)}\right \rfloor = \left \lfloor{f \left({\left \lfloor{x}\right \rfloor}\right)}\right \rfloor$

, similarly, that there exists $x \in A$ such that:
 * $\left \lceil{f \left({x}\right)}\right \rceil \ne \left \lceil{f \left({\left \lceil{x}\right \rceil}\right)}\right \rceil$

We have by definition of the ceiling function that $x \le \left \lceil{x}\right \rceil$.

As $f$ is strictly increasing, it cannot be the case that $\left \lceil{f \left({x}\right)}\right \rceil > \left \lceil{f \left({\left \lceil{x}\right \rceil}\right)}\right \rceil$.

So it must be that:
 * $\left \lceil{f \left({\left \lceil{x}\right \rceil}\right)}\right \rceil > \left \lceil{f \left({x}\right)}\right \rceil$

Because $f$ is continuous:
 * $\exists y \in A: \left \lceil{x}\right \rceil > y \ge x$

such that $f \left({y}\right) \in \Z$

But by definition of the ceiling function, $y$ cannot be an integer.

Thus by Proof by Contradiction:


 * $\left({f \left({x}\right) \in \Z \implies x \in \Z}\right) \implies \left \lceil{f \left({x}\right)}\right \rceil = \left \lceil{f \left({\left \lceil{x}\right \rceil}\right)}\right \rceil$

Thus we have:
 * $\left({f \left({x}\right) \in \Z \implies x \in \Z}\right) \iff \left \lfloor{f \left({x}\right)}\right \rfloor = \left \lfloor{f \left({\left \lfloor{x}\right \rfloor}\right)}\right \rfloor$

and
 * $\left({f \left({x}\right) \in \Z \implies x \in \Z}\right) \iff \left \lceil{f \left({x}\right)}\right \rceil = \left \lceil{f \left({\left \lceil{x}\right \rceil}\right)}\right \rceil$

Hence the result.