# Thomae Function is Continuous at Irrational Numbers/Lemma

## Lemma for Thomae Function is Continuous at Irrational Numbers

In the following it is to be understood that all rational numbers expressed in the form $\dfrac p q$ are in canonical form.

Let $x \in \R \setminus \Q$.

Let $\Q$ be ordered in the following way:

- $\dfrac {p_1} {q_1} \prec \dfrac {p_2} {q_2} \iff \begin {cases} q_1 < q_2 & : q_1 \ne q_2 \\ p_1 < p_2 & : q_1 = q_2 \end {cases}$

and so we can denote $\Q$ with this ordering as $\struct {\Q, \prec}$

Let $q \in \Z_{>0}$ be a positive integer.

Let $S \subseteq \struct {\Q, \prec}$ defined as:

- $S = \set {z \in \Q: z \prec \dfrac 1 q}$

That is, $S$ is the set of all rational numbers whose denominators are all less than or equal to $q$.

Let $a$ be the supremum of the set:

- $\set {z \in S: z < x}$

Let $b$ be the infimum of the set:

- $\set {z \in S: x < z}$

Then we have that the open interval:

- $C = \openint a b$

contains $x$ and no rational numbers whose denominators are less than $q$.

## Proof

Let $F := \floor x$ be the floor of $x$.

Let $C := \ceiling x$ be the ceiling of $x$.

Consider the interval:

- $I = \closedint F C$

As $x$ is irrational, we have that:

- $F < x < C$

and so:

- $x \in I$

Because $F$ and $C$ are integers by definition, they can be expressed as:

- $F = \dfrac F 1$

- $C = \dfrac C 1$

and so $F, C \in S$

Let $r \le q$.

Consider the set $S_r$:

- $S_r = \set {F, F + \dfrac 1 r, F + \dfrac 2 r, \ldots, F + \dfrac {r - 1} r, C}$

which is a finite set of rational numbers.

We have that:

- $I = S_1 \cup S_2 \cup S_3 \cup \cdots \cup S_{q - 1} \cup S_q$

and so it follows that $I$ is itself finite.

Then we have that:

\(\ds a = \sup \set {z \in S: z < x}\) | \(=\) | \(\ds \sup \set {z \in I: z < x}\) | ||||||||||||

\(\ds b = \inf \set {z \in S: x < z}\) | \(=\) | \(\ds \inf \set {z \in I: x < z}\) |

But as $I$ is finite, then so are $\set {z \in I: z < x}$ and $\set {z \in I: x < z}$.

Because $F \in \set {z \in I: z < x}$ and $C \in \set {z \in I: x < z}$ we have that neither $\set {z \in I: z < x}$ nor $\set {z \in I: x < z}$ are empty.

Hence from Finite Subset of Ordered Set contains Supremum:

- $a \in \set {z \in I: z < x}$

and from Finite Subset of Ordered Set contains Infimum:

- $b \in \set {z \in I: x < z}$

Hence $\exists a, b, \in S: a < x < b$

It follows from the construction that there are no elements of $S$ in \openint a b$. $\blacksquare$