*Weak Lusin* vs *Strong Lusin* In a book that I’m reading, the author presents two versions of Lusin’s theorem:
Let $X$ be a topological space with a regular measure $\mu$, and $Y$ to be second countable (i.e., admits a countable family $(B_i)_i$ Of open sets such that for any open set $B \subset Y$, we can represent $B$ as an union of $B_i$’s).
Weak Lusin - Under the above assumptions, if $f: X \to Y$ is measurable, then, for every $\epsilon>0$ there exists a compact set $K\subset X$ s.t $\mu(K^c) <\epsilon$ and $f \mid_K
$ is continuous.
Strong Lusin - Under the same assumptions, if
$f:X\to \mathbb R^d$ measurable, then for every $\epsilon>0$ there exists a compact set $K\subset X$ and a continuous function $g:X\to \mathbb R^d$   s.t $\mu(K^c) <\epsilon$ and $f=g$ on $K$.
The thing is, these two seem very similar to me. I can’t quite comprehend how the existence of a function $g$ coinciding with a function $f$ on $K$, differs from having a continuous function $f$ only on $K$. Is the different mainly due to the fact that exists a function $g$ continuous?
Another different seems to be the change in the space $Y$. The strong version is restricted to $\mathbb R^d$.
Can anyone clarify the difference in this two versions? Perhaps present a counterexample.
 A: To go from your Weak Lusin to Strong Lusin one needs to be able to do the following: if $K\subset X$ is compact, and $f\colon K \to Y$ is continuous, then there is a continuous extension of $f$ to whole of $X$, i.e. there is a continuous $F:X \to Y$ such that $F(x)=f(x)$ whenever $x \in K$. If this is possible then after finding the map $g$ in the Weak Version, throw out the part of $g$ outside $K$. Use this extension to find a new continuous $g$ that agrees with the old $g$ along $K$.
Now is this extension always possible? If $Y$ is a Euclidean space this extension is always possible (Evans and Gariepy measure theory and fine propeties of functions has a proof), in general not.
As for an example of how $f$ being continuous on $K$ differs from having a continuous $F$ that restricted to $K$ equals $f$, consider $E=(-1,0)\cup(0,1) \subset \mathbb{R}$ and the function that assigns $-5$ to all negative $x$ and $+5$ to all positive $x$. Now, $f:E \to \mathbb{R}$ is continuous (!). However, there does not exist any continuous $F:\mathbb{R} \to \mathbb{R}$ so that its restriction to $E$ coincides with $f$ -- you just won't be able to assign anything to $F(0)$ in a continuous way. Notice that necessarily I had to choose noncompact $E$. But my example was to show why the two notions are not the same.
