New Answer. We attempt a more direct proof. As in the old answer, we may assume that $(a_j, b_j)$ are disjoint.
Claim. If $E \subseteq A$, then $m^*(f(E)) \leq m^*(E)$, where $m^*$ is the outer measure.
Indeed, for each countable family $\{I_i\}$ of intervals covering $E$, let
$$ \tilde{I}_{i,j} = I_i \cap (a_j, b_j). $$
Then we find that
- $\{\tilde{I}_{i,j} \}$ is a countable family of intervals covering $E$,
- $\{f(\tilde{I}_{i,j}) \}$ is a countable family of intervals covering $f(E)$,
- $|f(\tilde{I}_{i,j})| \leq |\tilde{I}_{i,j}|$.
From this, it follows that
$$ m^*(f(E))
\leq \sum_{i,j} |f(\tilde{I}_{i,j})|
\leq \sum_{i,j} |\tilde{I}_{i,j}|
\leq \sum_{i} |I_i|. $$
Taking infimum over all possible $\{I_i\}$ yields the desired inequality and thus completes the proof of the claim. Returning to our problem, for each $0 \leq x_1 \leq x_2 \leq 1$ we have
\begin{align*}
|f(x_2) - f(x_1)|
&= |f([x_1, x_2])| \\
&\leq m^*(f([x_1, x_2]\cap A)) + m^*(f([x_1, x_2]\setminus A)) \\
&\leq m^*([x_1, x_2]\cap A) + 0 \\
&\leq |x_1 - x_2|.
\end{align*}
Old Answer. Without loss of generality, we may assume the followings:
- $f$ is strictly increasing.
- $(a_i, b_i)$ are disjoint.
Also we write $N = [0, 1]\setminus A$ for convenience.
Now for each $0 \leq x_1 < x_2 \leq 1$, notice that $f([x_1, x_2] \cap N)$ is both compact and measure-zero. Thus for each $\epsilon > 0$ there are finitely many open intervals $J_1, \cdots, J_m$ such that
$$\sum_{i=1}^{m} |J_i| < \epsilon, \qquad f([x_1, x_2] \cap N) \subset \bigcup_{i=1}^{m} J_i. $$
We may assume as well that $J_1, \cdots, J_m$ are disjoint and indexed in such a way that $J_i$ lies left to $J_{i+1}$ for each $i = 1, \cdots, m-1$. This allows us to choose points
$$x_1 = p_1 \leq q_1 < p_2 < q_2 < \cdots < q_{m-1} < p_m \leq q_m = x_2$$
such that
\begin{align*}
[f(p_1), f(q_1)) &= J_1 \cap f([x_1,x_2]), \\
(f(p_i), f(q_i)) &= J_i \hspace{2em} \text{for } i = 2, \cdots, m-1, \\
(f(p_m), f(q_m)] &= J_m \cap f([x_1,x_2]).
\end{align*}
Thus for each $i = 1, \cdots, m-1$, we have $[q_i, p_{i+1}] \subset A$ and hence it lies in one of $(a_j, b_j)$. This gives the following estimate:
\begin{align*}
f(x_2) - f(x_1)
&= \sum_{i=1}^{m-1} (f(p_{i+1}) - f(q_i)) + \sum_{i=1}^{m-1} (f(q_{i}) - f(p_i)) \\
&\leq \sum_{i=1}^{m-1} (p_{i+1} - q_i) + \epsilon \\
&\leq (x_2 - x_1) + \epsilon.
\end{align*}
Since $\epsilon$ was arbitrary, letting $\epsilon \to 0^+$ yields $|f(x_2) - f(x_1)| \leq |x_2 - x_1|$.