Given a non-constant analytic function $f(x)$ on a domain $D \subseteq \mathbb{R}^n$. I want to prove that
$\mathcal{Z} = \{x \in \mathcal{D} |f(x) = 0 \}$
is closed nowhere dense.
I originally wanted to prove this by contradiction as follows using the identity theorem.
"Assume that $\mathcal{Z}$ is not a closed nowhere dense set, then $\mathcal{Z}$ must contain a limit point", which shows that $f(x)$ is constant zero by the identity theorem and thus contradicts that $f(x)$ is non-constant.
However, I am not sure if the following statement is true:
"Assume that $\mathcal{Z}$ is not a closed nowhere dense set, then $\mathcal{Z}$ must contain a limit point"
If it is true, could you provide one reference?
If not, is $\mathcal{Z}$ closed nowhere dense, and how can I prove it?
Indeed, more is true. It is enough to assume that $\mathcal Z$ is not nowehere dense to show that it has a limit point.
To see it, recall that a set is nowhere dense, by definition, if and only if its closure has empty interior. Then if $\mathcal Z$ is not nowhere dense, its closure has nonempty interior. Any of these points is a limit point of $\mathcal Z$.
EDIT: As Conrad points out in reply to Shi James' comment, to complete the proof for the given $\mathcal Z$, which is a zero set of an analytic (hence continuous) function, we need to notice first that $\mathcal Z$ is necessarily closed.