Restriction of Non-Continuous Mapping on Metric Space to Subspace may be Continuous

Theorem
Let $M_1 = \left({A_1, d_1}\right)$ and $M_2 = \left({A_2, d_2}\right)$ be a metric spaces.

Let $f: A_1 \to A_2$ be a mapping.

Let $Y \subseteq A_1$.

Let $f {\restriction_Y}: Y \to A_2$ be the restriction of $f$ to $Y$.

Let $f {\restriction_Y}$ be $\left({d_Y, d_2}\right)$-continuous.

Then it is not necessarily the case that $f$ is also $\left({d_1, d_2}\right)$-continuous.

Proof
Proof by Counterexample:

Let $f: \R \to \R$ be given by:


 * $f \left({x}\right) = \begin{cases}

0 & : x \in \Q \\ 1 & : x \in \R \end{cases}$

where $\Q$ is the set of rational numbers.

Then $f {\restriction_\Q}: \Q \to \R$ is the constant function $f_0$ with value $0$.

By Constant Mapping is Continuous, $f {\restriction_\Q}$ is continuous at every point.

However, $f$ is not continuous at any point on $\R$.