# 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 by hypothesis 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:

 $\displaystyle f \left({x}\right)$ $=$ $\displaystyle \left \lfloor{f \left({x}\right)}\right \rfloor$ Real Number is Integer iff equals Floor $\displaystyle$ $=$ $\displaystyle \left \lfloor{f \left({\left \lfloor{x}\right \rfloor}\right)}\right \rfloor$ by hypothesis

Aiming for a contradiction, suppose $x \notin \Z$.

 $\displaystyle \left \lfloor{x}\right \rfloor$ $<$ $\displaystyle x$ Floor of Non-Integer $\displaystyle \leadsto \ \$ $\displaystyle f \left({\left \lfloor{x}\right \rfloor}\right)$ $<$ $\displaystyle f \left({x}\right)$ as $f$ is strictly increasing $\displaystyle \leadsto \ \$ $\displaystyle \left \lfloor{f \left({\left \lfloor{x}\right \rfloor}\right)}\right \rfloor$ $<$ $\displaystyle \left \lfloor{f \left({x}\right)}\right \rfloor$ as $\left \lfloor{f \left({x}\right)}\right \rfloor = f \left({x}\right)$ by Real Number is Integer iff equals Floor $\displaystyle \leadsto \ \$ $\displaystyle \left \lfloor{f \left({\left \lfloor{x}\right \rfloor}\right)}\right \rfloor$ $\ne$ $\displaystyle \left \lfloor{f \left({x}\right)}\right \rfloor$ which contradicts $\left \lfloor{f \left({x}\right)}\right \rfloor = \left \lfloor{f \left({\left \lfloor{x}\right \rfloor}\right)}\right \rfloor$

$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:

 $\displaystyle f \left({x}\right)$ $=$ $\displaystyle \left \lceil{f \left({x}\right)}\right \rceil$ Real Number is Integer iff equals Ceiling $\displaystyle$ $=$ $\displaystyle \left \lceil{f \left({\left \lceil{x}\right \rceil}\right)}\right \rceil$ by hypothesis

Aiming for a contradiction, suppose $x \notin \Z$.

 $\displaystyle \left \lceil{x}\right \rceil$ $>$ $\displaystyle x$ Ceiling of Non-Integer $\displaystyle \leadsto \ \$ $\displaystyle f \left({\left \lceil{x}\right \rceil}\right)$ $>$ $\displaystyle f \left({x}\right)$ as $f$ is strictly increasing $\displaystyle \leadsto \ \$ $\displaystyle \left \lceil{f \left({\left \lceil{x}\right \rceil}\right)}\right \rceil$ $>$ $\displaystyle \left \lceil{f \left({x}\right)}\right \rceil$ as $\left \lceil{f \left({x}\right)}\right \rceil = f \left({x}\right)$ by Real Number is Integer iff equals Ceiling $\displaystyle \leadsto \ \$ $\displaystyle \left \lceil{f \left({\left \lceil{x}\right \rceil}\right)}\right \rceil$ $\ne$ $\displaystyle \left \lceil{f \left({x}\right)}\right \rceil$ which contradicts $\left \lceil{f \left({x}\right)}\right \rceil = \left \lceil{f \left({\left \lceil{x}\right \rceil}\right)}\right \rceil$

$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)$

$\Box$

### Sufficient Condition

Let $f$ be such that:

$f \left({x}\right) \in \Z \implies x \in \Z$

Aiming for a contradiction, suppose 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.

$\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$

$\Box$

Aiming for a contradiction, suppose, 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.

$\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$

$\Box$

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.

$\blacksquare$

## Source of Name

This entry was named for Robert James McEliece.

## Historical Note

Donald E. Knuth reports in The Art of Computer Programming that this generalisation of Conditions for $\left\lfloor{\log_b x}\right\rfloor$ to equal $\left\lfloor{\log_b \left\lfloor{x}\right\rfloor}\right\rfloor$ was established by Robert James McEliece.

Knuth refers to it (in passing) as McEliece's Theorem.

Whiile this name for it is not backed up in the literature, it is convenient for $\mathsf{Pr} \infty \mathsf{fWiki}$, because of its unwieldy nature, to refer to it thus.