The definition of Thomae function is $$f(x) = \begin{cases} \dfrac{1}{q}, & \text{if $x=\dfrac{p}{q}$} \\[2ex] 0, & \text{if $x$ is irrational} \end{cases}$$ where $p\in \mathbb{Z}, q\in \mathbb{Z}^+$ and $\gcd(p,q)=1.$
The conclusion is $\lim_{x \to P}f(x)=0$ for any point P of R.
The proof is below. Unfortunately, I don't understand it even from the first sentence.
Proof: 1. Indeed, for each positive number $\epsilon$, the set $(P-1,P) \cup (P,P+1)$ contains only finitely many rational number $p/q$ with $1/q \geq \epsilon$ (namely, $q \leq 1/\epsilon$). Now I understand this. Thanks for @Momo's excellent explanation.
- Let $\delta$ be the distance between P and the closest such rational number. Then for all x satisfying $0<|x-P|<\delta$, we have $|f(x)-0|<\epsilon$.
My understanding is: Since such rational numbers are finite, we can get a minimum of such distances between P and p/q, namely $\delta$. But next? In this very tiny interval $0<|x-P|<\delta$, if x is irrational, then obviously $|f(x)-0|=0<\epsilon$. But what if x is rational in the form of p/q?
My rethinking: this specific $\delta$ can make sure our interval $0<|x-P|<\delta$ does not contain any rational p/q. But it seems wrong, because I know rational number is dense in any interval in R.