Suppose $D\subset \mathbb{R}^d$ is a path-connected compact (closed and bounded) domain. Let $C\subset D$ be a compact subset.
If the restriction $f|_C$ of a funciton $f: D\to \mathbb{R}$ is continuous w.r.t the subspace topology of $C$. Does it always exist a continuous $g\in C(D)$ such that $f|_C=g|_C$?
Background. I'm trying to understand a result in real analysis called "Luzin's criterion":
finitely-valued function $f: D\to \mathbb{R}$ is measurable iff, for every $\epsilon>0$, there exists a continuous function $g\in C(D)$ such that $m\left(\left\{f(x)\neq g(x)\right\}\right)<\epsilon$.
But the usual formulation of "Luzin's theorem" only states
If $f: D\to \mathbb{R}$ is measurable then, for every $\epsilon>0$, there exists a compact subset $C_\epsilon\subset D$ such that the restriction $f|_{C_\epsilon}$ is continuous on $C_\epsilon$ and $m\left(D\setminus C_\epsilon\right)<\epsilon$.
It is claimed the two results are equivalent. But I can't seem to find a proof for this. If my question has an affirmative answer, it seems their equivalence is easy to establish. But perhaps my question claim isn't true, and their equivalence is proved alternatively. Thanks in advance.
Yes. This is a special case of the Tietze extension theorem.