I'm practicing my proof-writing and was hoping you could let me know if this proof looks good. I would like to know if the proof is incorrect, if there are parts that are overly wordy/complicated, or if I'm missing some element of a proof that is helpful to see, if not strictly necessary.
The Prompt:
Every rational $x$ can be written in the form $x = \frac{m}{n}$, where $n > 0$, and $m$ and $n$ are integers without any common divisors. When $x = 0$, we take $n = 1$. Consider the function $f$ defined on $\mathbb{R}^1$ by
$f(x) = 0$ if $x$ is irrational
$f(x) = \frac{1}{n}$ where $x = \frac{m}{n}$
Prove that $f$ is continuous at every irrational point, and that $f$ has a simple discontinuity at every rational point.
My Proof:
Suppose $p \in \mathbb{R}^1$ is irrational, so $f(p) = 0$. Now choose an arbitrary $\epsilon >0$. $f$ is bounded from above at $1$, so for all $x \in \mathbb{R}^1$, $f(x) \in [0,1]$, and so if $\epsilon > 1$ then $d(f(x),f(p)) < \epsilon$ if $d(x,p) < \delta$ for $\delta = 1$ (any number would do). Now suppose $\epsilon \in (0,1]$. We then choose a rational number q such that $0 < q \le \epsilon$, $\lfloor p \div q \rfloor \neq 0$, and $p$ mod $q \neq 0$, which we use to define $\delta$:
$\delta =$ min $(|x - q \times \lfloor x \div q \rfloor|,|x - q \times \lfloor (x+ q) \div q \rfloor|)$
where $\lfloor$ $\rfloor$ represents floor division. Note that $q \times \lfloor x \div q \rfloor = mq$ and $q \times \lfloor (x+q) \div q \rfloor = (m+1)q$ for some integer $m$, and $mq \le x \le (m+1)q$. Since $q$ is rational, both $mq$ and $(m+1)q$ are ratios of integers. $f(mq) \ge f(q)$ and $f((m+1)q)) \ge f(q)$ (potentially greater than since $mq$ may not be the most reduced form of the fraction), but for any $z \in (mq,(m+1)q)$, $f(z) < f(q)$. Therefore, $d(f(x),f(p)) < q \le \epsilon$ for all values $x$ where $d(x,p) < \delta$, so $f$ is continuous at $p$.
Now let $p \in \mathbb{R}^1$ be a rational number such that $p = \frac{a}{b}$ for $a,b$ integers without any common divisors. Define $\{y_i\} = \{y \in \mathbb{R}^1 | \frac{a}{b} - \frac{1}{bi}\}$ and $\{z_i\} = \{z \in \mathbb{R}^1 | \frac{a}{b} + \frac{1}{bi}\}$, so that $lim_{i \to \infty}(y_i) = f(x-)$ and $lim_{i \to \infty}(z_i) = f(x+)$. We can see:
$lim_{i \to \infty} f(y_i) = lim_{i \to \infty} f(\frac{a}{b} - \frac{1}{bi}) = 0$
$lim_{i \to \infty} f(z_i) = lim_{i \to \infty} f(\frac{a}{b} + \frac{1}{bi}) = 0$
while $f(x) = \frac{1}{b}$ (which is always nonzero), so $f(x-)$ and $f(x+)$ exist, but neither equals $f(x)$ so $f$ has a simple discontinuity at every rational point.