I am looking for a cutoff function.


The Urysohn's Lemma says


Let $X$ be a $T\_{4}$ space and $A,B \subset X$ be two closed and disjoint subsets of $X$. Then there exists a continuous function $f:X \to \mathbb{R}$ such that $f=0$ on $A$ and $f=1$ on $B$.


In Dirichlet space (for example $W^{1,2}(\mathbb{R}^{d})$, (1,2)-Sobolev space on $\mathbb{R}^{d}$), I am looking for a function as described above.


Can we construct a function $f \in W^{1,2}(\mathbb{R}^{d})$ such that $f=0$ on $dx$-a.e. on $A$ and $f=1$ on $dx$-a.e. on $B$, where $A,B$ are two closed and disjoined subsets of $\mathbb{R}^{d}$ ?


**ADD** we assume that Lebesgue measure of $B$ is finite.


If you know the related results, please tell me.



Urysohn type cut off function
No. Let B be an infinite union of disjoint closed balls $B\_n$, and let the complement of A be the union of open balls $C\_n$, where each $C\_n$ is slightly larger than $B\_n$. If the gap between $C\_n$ and $B\_n$ shrinks fast enough as $n\to\infty$, this will preclude $f$ from being in $W^{1,2}$.


On the other hand, if you assume $B$ is compact, then a positive answer is well known.


