I'm trying to prove the following proposition that is a mini version of the Heine-Cantor theorem:
If $f:\mathbb{R}\to \mathbb{R}$ is continuous on a closed interval $[a, b]$ then $f$ is uniformly continuous $[a, b]$.
Here's the proof:
We'll partition $[a, b]$ into finite closed sub-intervals such that for $x, y$ in each interval $|f(x)-f(y)|\lt \epsilon/4$. Starting with $a_0=a$, then we'll choose a number $a_1$ such that $a_0\lt a_1\le b$ that is closest to $a_0$ such that $f(a_1)=f(a)+\epsilon/4$ or $f(a_1)=f(a)-\epsilon/4$.
Update: We'll show that such $a_1$ exists. If $f(a_1)+\epsilon/4\gt \max_{x\in[a_0, b]} f(x)$ and $f(a_1)-\epsilon/4\lt \min_{x\in[a_0, b]} f(x)$ choose $a_1=b$. Otherwise, by the Intermediate Value theorem, at least one point $a_1\in (a_0, b)$ exists such that $a_1=f(a_0)+\epsilon/4$ or $a_1=f(a_0)-\epsilon/4$. If for all such $a_1$'s, no point nearest to $a_0$ is found, then there exists a strictly decreasing sequence $(x_n)$ in $(a_0, b)$ that converges to $c\in[a, b)$ such that $|f(x_n)-f(a_0)|=\epsilon/4$ and $|f(c)-f(a_0)|\ne \epsilon/4$. The last two equalities show that $f(x_n)\ne f(c)$ which implies that $f$ is discontinuous at $c$ which is a contradiction.
From there, we repeat this proceed to choose $a_2$ (such that $a_1\lt a_2 \le b$ and is closest to $a_1$ and $f(a_2)=f(a_1)+\epsilon/4$ or $f(a_2)=f(a_1)-\epsilon/4$), then $a_3$, $a_4$, etc.
Next, we'll show that after a finite steps, this process has to end. To see why, suppose the process continues forever. Since $[a, b]$ is bounded, this can only happen if the sequence $(d_n)_{n=0}^{\infty}=|a_{n} - a_{n+1}|$ converges to $0$. So for any $\delta\gt0$, exist $a_k, a_{k+1}\in [a, b]$ such that $|a_{k}-a_{k+1}|\lt\delta$ and $|f(a_{k})-f(a_{k+1})|=\epsilon/4$. But this contradicts with the hypothesis that $f$ is continuous on $[a, b]$ and thus continuous at $a_k$. Therefore, the process is finished within a finite number of steps.
Now we can choose $\delta = \min_{n\lt\infty}\{d_n\}$, the partition of $[a, b]$ above shows that if $x, y$ in two consecutive intervals $[a_{k-1}, a_k]$ and $[a_{k}, a_{k+1}]$ respectively, then $|f(x)-f(y)|\le|f(x)-f(a_k)|+|f(y)-f(a_k)|\le\epsilon/4+\epsilon/4=\epsilon/2$. This implies that for any $\epsilon\gt 0$, there exists $\delta\gt 0$ such that if $x, y\in[a, b]$ and $|x-y|\lt\delta$ then $|f(x)-f(y)|\le \epsilon/2\lt\epsilon$. Which concludes the proof.
Is there any problem with the above proof?
This is an interesting approach, but there are definite issues with the proof.
First, there is an issue with the recursive definition of $a_{n+1}$ in terms of $a_n$. You are ensuring that $|f(a_n) - f(x)| < \frac{\varepsilon}{4}$ for all $x \in [a_n, a_{n+1})$, but it doesn't quite follow that $|f(x) - f(y)| \le \frac{\varepsilon}{4}$ for all $x, y \in [a_n, a_{n+1}]$. What if the function, say, dips down to $f(a_n) - \frac{\varepsilon}{4}$ plus a tiny positive amount, before rising to $f(a_n) + \frac{\varepsilon}{4}$ further along the interval (at the point we are told to call $a_{n+1}$)? We could have $x$ and $y$ in $[a_n, a_{n+1}]$ such that $|f(x) - f(y)|$ is close to $\frac{\varepsilon}{2}$.
Of course, this is easy enough to rectify: simply replace $\frac{\varepsilon}{4}$ with $\frac{\varepsilon}{8}$. You should probably prove this in some detail, since the fact that $\frac{\varepsilon}{4}$ is insufficient escaped your notice.
Secondly, and more crucially, your contradiction does not contradict continuity, rather it contradicts uniform continuity. You say,
This implies the negation of uniform continuity, not continuity (which, of course, you absolutely may not assume). You conclude that $f$ is not continuous at $a_k$, but let me ask you: which $k$? At which point $a_k$ is $f$ supposedly discontinuous?
You define the $k$ in terms of the $\delta$, so that $|a_k - a_{k+1}| < \delta$, so that $k$ may grow larger and larger as $\delta$ shrinks to $0$, but there doesn't appear to be a fixed $a_k$ such that, for all $\delta > 0$, there exists some $\delta$-close $x$ such that $|f(a_k) - f(x)| \ge \frac{\varepsilon}{4}$. This is, I think, the most serious issue with the proof.
Here's another way to think about it: where have you used the fact that interval is closed? What if you took the interval $[-10, 0)$, with the function $f(x) = \sin(1/x)$? The function is continuous, and bounded, and you can define intervals as you've done previously. However, there will be infinitely many such intervals (and yes, their lengths grow arbitrarily small). Your argument would appear to conclude that a discontinuity exists at one of the endpoints, which is simply incorrect.
Here is how I would fix this second issue. Suppose that the sequence $(a_n)$ is infinite. It is a bounded sequence (existing in $[a, b]$) and monotone increasing. As such, it must have a limit $a_\infty$. By continuity, $f(a_n) \to f(a_\infty)$, in particular, $f(a_n)$ is a Cauchy sequence. But, $|f(a_k) - f(a_{k+1})| = \frac{\varepsilon}{4}$ (or, $\frac{\varepsilon}{8}$, if you correct the first issue), which contradicts Cauchiness.