Approximating indicator function on open set continuous functions

Given some polish space $X$ and a probability measure $P$ on $X$ is it true that for any open set $A$ in $X$ one can construct a sequence of bounded continuous functions $\{f_{n}(x)\}_{n}$ such that $f_{n}$ converges in probability to the indicator function on $A$, $I_{A}$?


Yes. We can choose a compatible metric $d$ on $X$ such that $0 \leq d \leq 1$.

For a non-empty set $C \subset X$ let $d(x,C) = \inf_{c \in C} d(x,c).$ If $C$ is empty, set $d(x,C) = 1$ for all $x$. Then $x \mapsto d(x,C)$ is continuous since $\lvert d(x,C) - d(y,C)\rvert \leq d(x,y)$.

Assume that $A$ is a proper open subset. Let $F_n = \{x \in X \mid d(x, X \setminus A) \geq \frac1n\}$. Then $F_n \subseteq F_{n+1} \subseteq A$ and $A = \bigcup_{n=1}^{\infty} F_n$. The continuous functions $$ f_n(x) = \frac{d(x,X\setminus A)}{d(x,X \setminus A)+d(x,F_n)} $$ satisfy $0 \leq f_n \leq 1$ and converge point-wise everywhere and monotonically to $I_A$.

In particular, $f_n \to I_A$ in probability for every probability measure $P$, thus answering the OP's question.

Notice that $f_n(x) = 0$ for $x \in X \setminus A$ and that $f_n(x) = 1$ if and only if $x \in F_n$.