I can't figure out where the following reasoning fails:
Define a function $h:[0,1] \to [0,1]$ by letting $h(0)=0$ and $h(1)=1$, and $h(0.d_1d_2d_3d_4\ldots)=0.d_1d_1d_2d_2d_3d_3d_4d_4d_5d_5\ldots$
The function repeats each decimal in the decimal expansion of numbers in $(0,1)$ twice. For instance $h(0.5)=0.55$, $h(0.111111\ldots)=0.111111\ldots$, $h(0.37)=0.3377$, etc. I'm taking finite expansions like 0.5 instead of 0.49999999.... where necessary, so decimal expansions of numbers are unique.
This function is not surjective/onto because there is no way to generate 0.1 or any other number the decimal expansion of which does not consist of pairs of equal decimals lined up. So it cannot be continuous, because then the intermediate value theorem would ensure surjectivity. I need help finding the flaw in the following 'proof' of continuity:
To prove that $h$ is continuous at $a=0.a_1a_2a_3a_4\ldots$, let $\epsilon>0$ be such that the decimal expansion of $\epsilon$ starts with $k$ zeroes. We must find $\delta>0$ such that $|h(a)-h(b)|<\epsilon$ whenever $|a-b|<\delta$. Now to make $|h(a)-h(b)|<\epsilon$ it is sufficient that the decimal expansions of $h(a)$ and $h(b)$ agree up to decimal number $k+1$, and by the construction of $h$ this will follow if the decimal expansions of $a$ and $b$ agree up to $m=\lceil \frac {k+1} 2 \rceil$ decimals. This means the decimal expansion of $\delta$ must start with $m$ zeroes. So let $\delta=10^{-m-1}$ or some even smaller number, like $\epsilon$ itself for that matter. QED (except I know it's false).
Let's consider $h(0.5) = 0.55$. If we try $h(0.499999) = 0.449999999999$, we see that we can find a sequence $x_n$ converging $0.5$ for which $h(x_n)$ converges to $0.45 \neq 0.55 = h(0.5)$. How does this case square with your attempted proof? (work through the steps and see which one breaks down)