Continuous $f\colon [0,1]\to \mathbb{R}$ all of whose nonempty fibers are countably infinite?

I have been told it is possible to construct a continuous function $f\colon [0,1]\to \mathbb{R}$ such that $f^{-1}(x)$ is either empty or has cardinality $\aleph_0$ for every $x\in \mathbb{R}$. I've thought about this for a while but can't seem to cook up an example. Does anyone know such a construction?


This appears to be a special case of the result in the paper:

Kwiatkowska, A. Continuous functions taking every value a given number of times. Acta Math. Hungar. 121 (2008), no. 3, 229–242. MathSciNet | arXiv

The indicatrix of a function $F$ is $f(y) := |F^{-1}(y)|$, where $f$ takes values in the set $\{0, 1, 2, \dots, \omega, \mathfrak{c}\}$ (where $\omega$ is your $\aleph_0$). Kwiatkowska's paper gives necessary and sufficient conditions for a function $f$ to be the indicatrix of some continuous function $F : [0,1] \to [0,1]$. It appears that $f \equiv \omega$ satisfies those conditions.

I skimmed the proof and it seems to be constructive, so it should be possible to use it to explicitly produce the corresponding function $F$, but I didn't take the time to do this. It would be interesting to see what it looks like.


Begin with the Cantor function. Each horizontal segment in its graph has length $3^{-n}$. The endpoints of this segment are $(a,y_0)$ and $(b,y_0)$ where $b-a=3^{-n}$ and $y_0$ is a dyadic rational. Replace this segment with a zigzag that reaches $2^{-n}$ above and below: e.g., $y_0+2^{-n}\sin (2\pi \frac{x-a}{b-a})$ will work.

This new function $f$ attains each value in $[0,1]$ countably many times. Indeed, each $y\in [0,1]$ belongs to countably many dyadic intervals $[k/2^n,(k+1)/2^n]$, $n=0,1,2\dots$. Each dyadic interval is precisely the image under $f$ of an interval of length $3^{-n-1}$ (i.e., of a gap in the Cantor set).


I'll define a convergent sequence of functions $f_n: [0,1] \to [0,1]$, which will be piecewise linear, starting with $f_0(x)=x$. For each $k \in \{0, 1, \ldots, 2^n - 1\}$ a particular segment of the graph of $f_n$, call it $L_k$, will go from $y = k/2^n$ to $y = (k+1)/2^n$. For $f_{n+1}$ we replace each $L_k$ by a "zigzag" with the same starting and ending points, first going from $y=k/2^n$ to $(k+1/2)/2^n$, then back down to $k/2^n$, up to $(k+1/2)/2^n$ and then $(k+1)/2^n$, down to $(k+1/2)/2^n$ and up to $(k+1)/2^n$. The distinguished segments of the graph of $f_{n+1}$ corresponding to the intervals $[k/2^n, (k+1/2)/2^n]$ and $[(k+1/2)/2^n, (k+1)/2^n]$ are the rightmost segments of this zigzag with $y$ in those intervals. For example, here is the graph of $f_2$, with the four distinguished segments in red:

enter image description here

Then $f_n$ converges uniformly to a continuous function $f$ which has the desired properties.


This is a more or less explicit example of a function satisfying a similar condition, where $\aleph_0$ is substituted by $\mathfrak{c}$.

Let $\gamma\colon[0,1]\to[0,1]\times[0,1]$ be a space filing curve, that is, a continuous function such that $\gamma([0,1])=[0,1]\times[0,1]$, and let $\gamma(t)=(\alpha(t),\beta(t))$. Then $\alpha\colon[0,1]\to\mathbb{R}$ is continuous and the cardinality of $\alpha^{-1}(x)$ is $\mathfrak{c}$ for all $x\in[0,1]$.