Measurable function from $[0,1]$ to $[0,1]$, mapping each sub interval onto $[0,1]$ Could anybody give a hint me how to construct a measurable function $f:[0,1]\rightarrow [0,1]$ such that:
$$\forall_{0\leq a < b \leq 1}: f((a,b))=[0,1]$$
I tried to define a sequence of linear functions $g_n$ that would "vertically cover" more and more of $[0,1]$ like so:
$g_0(x)=x$
$g_1(x) = \begin{cases}2x \text{, for } x\in[0,\frac{1}{2}]\\
 2x-1 \text{, for } x\in[\frac{1}{2},1]\end{cases}$
$...$
$g_n(x) = \begin{cases}2^nx \text{, for } x\in[0,\frac{1}{2^n}]\\
 2^nx-1 \text{, for } x\in[\frac{1}{2^n},\frac{2}{2^n}]\\
...\\
2^nx - (2^n-1)\text{, for } x\in[\frac{2^n-1}{2^n},1]\end{cases}$
Then I hoped for such a sequence, of clearly measurable functions, to converge pointwise, so that I could define $f(x)=\lim_{n\rightarrow\infty}g_n(x)$. It seems however, that $g_n$ will not converge and I am stuck looking for a different sequence. Or perhaps my approach is flawed from the very beginning? I will be gratefull for any inights or suggestions.
 A: I think I found such a function $f$.
This function has some similarities to your idea.
However, a detailed proof would require a lot of work to write down,
so I will not provide all the details.
Construction of $f$:
First, let $a_n(x)$ denote the $n$-th binary digit of $x$,
i.e. $a_n(x) \in \{0,1\}$ such that $x = \sum_{n=1}^\infty\frac{a_n(x)}{2^n}$
(we agree that we avoid binary representations ending in $11111\dots$
in order to make the functions $a_n$ well-defined).
Then we define $f$ via
$$
f(x) = \limsup_{n\to\infty} \frac1n \sum_{k=1}^n a_k(x).
$$
In a sense, the function $f$ is a limit ($\limsup$) of other weird piecewise functions, similar to your idea.
Measurability of $f$:
One can show that each of the functions $a_n$ is measurable.
Since the limsup of measurable functions is measurable, it follows that $f$ is measurable
arguments for the property $f((a,b))=[0,1]$:
(Some details are ommited, and a much more rigorous solution would make this answer too long in my opinion)
Let $a,b,s\in[0,1]$ with $a<b$ be given
and we want to show that $s\in f((a,b))$ holds.
Thus, we need to find a point $c\in(a,b)$ with $f(c)=s$.
The idea is to choose a point $c$ such that the ratio of the binary digits
who are $1$ is equal to $s$.
First, we can find numbers $k,m$ such that the half-open interval
$I:=[k2^{-m},(k+1)2^{-m})$ is contained in $(a,b)$.
Note that the first $m$ binary digits of points in $I$ are all the same,
which we will denote by $b_1,\ldots,b_m$.
Then we continue this sequence $b_n$ such that
$\limsup_{n\to\infty} \frac1n \sum_{k=1}^n b_n = s$.
This is always possible, and it is even possible to
avoid the case that $b_n=1$ for all sufficiently large $n$.
we then can construct the point $c\in I$ via
$$
c:= \sum_{n=1}^\infty \frac{b_n}{2^n}.
$$
Then it can be shown that $c\in I\subset (a,b)$ and that $f(c)=s$.
A: Let $I_1,I_2,I_3,\dots$ enumerate all subintervals of $[0,1]$ with rational endpoints. Construct a sequence $A_1,A_2,A_3,\dots$ of pairwise disjoint sets so that $A_n$ is similar to the Cantor set and $A_n\subseteq I_n$. For each $n$ define a continuous surjection $f_n:A_n\to[0,1]$. Define $f:[0,1]\to[0,1]$ so that $f(x)=f_n(x)$ if $x\in A_n$ and $f(x)=0$ if $x\in[0,1]\setminus\bigcup_nA_n$.
Then $f$ maps each subinterval of $[0,1]$ onto $[0,1]$ because each subinterval contains an $A_n$, and $f$ is Borel measurable because, for each closed set $S$, the set $f^{-1}(S)$ is the union of an $F_\sigma$ set and a $G_\delta$ set.
P.S. To define a continuous surjection from the Cantor set to $[0,1]$, note that each element of the Cantor set can be expressed uniquely in the form $\sum_{k=1}^\infty\frac{2a_k}{3^k}$ with $a_k\in\{0,1\}$, and that the map $\sum_{k=1}^\infty\frac{2a_k}{3^k}\mapsto\sum_{k=1}^\infty\frac{a_k}{2^k}$ is continuous.
A: HINT:
An example of a measurable function from $\{0,1\}^{\mathbb{N}}$ to $\{0,1\}^{\mathbb{N}}$ with the required property:
Define $f((a_n))= (a_{2k+1})_{k\ge k_0}$, if $k_0$ is the smallest number such that $a_{2k}=0$ for all $k\ge k_0$.  If no such number $k_0$ exists then define $f((a_n)) = (0)$ ( $0$ sequence).  Notice that $f$ is $0$ a.e.
