Can we generalize the result of Urysohn's lemma to countable collection of pairwise disjoint closed subsets of a normal space..?

Suppose $X$ is a normal topological space. Suppose some metric space for example. If $\{A_n\}_{n=1}^{\infty}$ is a collection of pairwise disjoint closed subsets of $X$, can we find a continuous function on $X$ such that it takes the constant value $n$ on $A_n$?

-
I think you should modify the question. It is too easy to give counterexamples. What about: does there exist a continuous function $f$ from $X$ to $[0,1]$ which is constant equal to $a_n$ on each $A_n$, with $a_n\neq a_m$ for all $n\neq m$? Brian M. Scott's answer gives a sufficient condition for this to hold. – 1015 Mar 17 '13 at 20:16

You need the collection $\mathscr{A}=\{A_n:n\in\Bbb Z^+\}$ to be discrete, meaning that each $x\in X$ has an open nbhd $U$ that meets at most one of the sets $A_n$. Then it’s possible to find a discrete collection $\mathscr{U}=\{U_n:n\in\Bbb Z^+\}$ of pairwise disjoint open sets such that $A_n\subseteq U_n$ for each $n\in\Bbb Z^+$.

Proof. For $n\in\Bbb Z^+$ let $B_n=\bigcup_{k>n}A_k$; since $\mathscr{A}$ is discrete, each $B_n$ is closed. $X$ is normal, so there are disjoint open sets $G_1$ and $H_1$ such that $A_1\subseteq G_1$ and $B_1\subseteq H_1$. Similarly, there are disjoint open sets $G_2$ and $H_2$ such that $A_2\subseteq G_2$ and $B_2\subseteq H_2$, and we may clearly assume that $G_2\cup H_2\subseteq H_1$. Continue in the same fashion: at stage $n>1$ choose disjoint open sets $G_n$ and $H_n$ such that $A_n\subseteq G_n\subseteq H_{n-1}$ and $B_n\subseteq H_n\subseteq H_{n-1}$. Then $\{G_n:n\in\Bbb Z^+\}$ is a pairwise disjoint family of open sets such that $A_n\subseteq G_n$ for each $n\in\Bbb Z^+$.

Now let $C=X\setminus\bigcup_{n\in\Bbb Z^+}G_n$ and $A=\bigcup_{n\in\Bbb Z^+}A_n$; $A$ and $C$ are disjoint closed sets in $X$. If $C=\varnothing$, $\{G_n:n\in\Bbb Z^+\}$ is an open partition of $X$ and hence a discrete collection, so we just set $U_n=G_n$. Assume, then, that $C\ne\varnothing$, and let $V$ and $W$ be disjoint open sets such that $A\subseteq V$ and $C\subseteq W$. For each $n\in\Bbb Z^+$ let $U_n=G_n\cap V$; I claim that $\mathscr{U}=\{U_n:n\in\Bbb Z^+\}$ is discrete.

To see this, suppose that $x\in X$. If $x\in C$, then $W$ is an open nbhd of $x$ that meets none of the sets in $\mathscr{U}$, so suppose that $x\notin C$. Then $x\in G_n$ for some $n\in\Bbb Z^+$, and $U_n$ is the only member of $\mathscr{U}$ that $G_n$ meets. Thus, every point of $X$ has an open nbhd meeting at most one member of $\mathscr{U}$, which is therefore a discrete family. $\dashv$

For each $n\in\Bbb Z^+$ let $f_n:X\to[0,1]$ be a continuous function such that $f_n(x)=1$ if $x\in A_n$, and $f_n(x)=0$ if $x\in X\setminus U_n$. Now let $f=\sum_{n\in\Bbb Z^+}nf_n$, and verify that $f$ has the desired properties; continuity follows from the fact that the family $\mathscr{U}$ is discrete.

If $\mathscr{A}$ is not discrete, there is an $p\in X$ such that every open nbhd of $p$ meets infinitely many members of $\mathscr{A}$, and it’s clear that if a function $f$ satisfies $f(x)=n$ for $x\in A_n$ for all $n\in\Bbb Z^+$, then $f$ cannot be continuous at $p$.

-
Ok, let me try again. What if we simply ask, more generally, that there exists $f=\sum_{n\geq}f(n)1_{A_n}$ injective with values in $[0,1]$ that extends continuously to $X$? I think that would be a proper generalization of Urysohn. I couldn't find a counterexample. Any suggestion? – 1015 Mar 17 '13 at 20:05