# Extension of almost everywhere convergent sequence of functions

I remember (or misremember) the following theorem and I am looking for a reference and/or proof: (More or slightly different conditions may be needed than I have specified)

Let $$X$$ and $$Y$$ be metric spaces such that $$X$$ is a dense subset of $$Y$$.

Let $$f_n : Y \rightarrow \mathbb{R}$$, and $$f: X \rightarrow \mathbb{R}$$ be sequence of functions where $$n \in \mathbb{N}$$ and $$f_n \rightarrow f$$ pointwise on $$X$$.

Let $$g, g_n : Y \rightarrow \mathbb{R}$$, be sequence of functions where $$n \in \mathbb{N}$$ and $$g_n \rightarrow g$$ uniformly on $$Y$$.

Also $$f_n \rightarrow g$$ pointwise on $$X$$. In other words, $$g(x) = f(x)$$ on $$X$$.

Then $$f_n \rightarrow g$$ on $$Y$$ pointwise (does it?)

Has anyone seen this or similar theorem? If yes, I am looking for the name of the theorem and/or book reference. If this is not provable and I am misremembering, let me know.

I have a counter example. Let $$X$$ be ($$0, 1$$) and $$Y$$ be [$$0, 1$$] and the metric for both of them are just the usual one in $$\mathbb{R}$$. Let $$f_n = x^n$$ defined on [$$0, 1$$], f(x) = $$0$$ when $$x \in [0, 1)$$ but $$1$$ when $$x = 1$$. Let $$g_n = \frac{1}{n(1 + x^2)}$$ defined in $$[0, 1], g = 0$$ (the zero constant function) defined in [$$0, 1$$].
Now in $$X$$, $$g = f, \sup|g_n - g| \to 0, f_n \to g$$ pointwise and $$f_n \to f$$ pointwise. However, $$f_n(1) = 1 \forall n \in \mathbb{N}$$ but $$g(1) = 0$$.