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: \floor x \in A \text { and } \ceiling x \in A$

where:
 * $\floor x$ denotes the floor of $x$
 * $\ceiling x$ denotes the ceiling of $x$

Then:
 * $\forall x \in A: \paren {\map f x \in \Z \implies x \in \Z} \iff \floor {\map f x} = \floor {\map f {\floor x} }$
 * $\forall x \in A: \paren {\map f x \in \Z \implies x \in \Z} \iff \ceiling {\map f x} = \ceiling {\map f {\ceiling x} }$

Proof
Let $x \in A$.

Hence we have that both $\floor x \in A$ and $\ceiling x \in A$.

Necessary Condition
Let $\map f x \in \Z$.

Let:
 * $\floor {\map f x} = \floor {\map f {\floor x} }$

Then:

$x \notin \Z$.

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

Similarly, let:
 * $\ceiling {\map f x} = \ceiling {\map f {\ceiling x} }$

Then:

$x \notin \Z$.

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

Thus:
 * $\forall x \in A: \floor {\map f x} = \floor {\map f {\floor x} } \implies \paren {\map f x \in \Z \implies x \in \Z}$

and:
 * $\forall x \in A: \ceiling {\map f x} = \ceiling {\map f {\ceiling x} } \implies \paren {\map f x \in \Z \implies x \in \Z}$

Sufficient Condition
Let $f$ be such that:
 * $\map f x \in \Z \implies x \in \Z$

there exists $x \in A$ such that:
 * $\floor {\map f x} \ne \floor {\map f {\floor x} }$

We have by definition of the floor function that $x \ge \floor x$.

As $f$ is strictly increasing, it cannot be the case that $\floor {\map f x} < \floor {\map f {\floor x} }$.

So it must be that:
 * $\floor {\map f {\floor x} } < \floor {\map f x}$

Because $f$ is continuous:
 * $\exists y \in A: \floor x < y \le x$

such that $\map f y \in \Z$

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

Thus by Proof by Contradiction:


 * $\paren {\map f x \in \Z \implies x \in \Z} \implies \floor {\map f x} = \floor {\map f {\floor x} }$

, similarly, that there exists $x \in A$ such that:
 * $\ceiling {\map f x} \ne \ceiling {\map f {\ceiling x} }$

We have by definition of the ceiling function that $x \le \ceiling x$.

As $f$ is strictly increasing, it cannot be the case that $\ceiling {\map f x} > \ceiling {\map f {\ceiling x} }$.

So it must be that:
 * $\ceiling {\map f {\ceiling x} } > \ceiling {\map f x}$

Because $f$ is continuous:
 * $\exists y \in A: \ceiling x > y \ge x$

such that $\map f y \in \Z$

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

Thus by Proof by Contradiction:


 * $\paren {\map f x \in \Z \implies x \in \Z} \implies \ceiling {\map f x} = \ceiling {\map f {\ceiling x} }$

Thus we have:
 * $\paren {\map f x \in \Z \implies x \in \Z} \iff \floor {\map f x} = \floor {\map f {\floor x} }$

and
 * $\paren {\map f x \in \Z \implies x \in \Z} \iff \ceiling {\map f x} = \ceiling {\map f {\ceiling x} }$

Hence the result.