Dirichlet Function is Periodic

Theorem
Let $D: \R \to \R$ be a Dirichlet function:
 * $\forall x \in \R: \map D x = \begin{cases} c & : x \in \Q \\ d & : x \notin \Q \end{cases}$

Then $D$ is periodic.

Namely, every non-zero rational number is a periodic element of $D$.

Proof
Let $x \in \R$.

Let $L \in \Q$.

If $x \in \Q$, then:

If $x \notin \Q$, then:

Combining the above two shows that:
 * $\forall x \in \R: \map D x = \map D {x + L}$

Hence the result.