TITLE: On what kind of condition of a compact set $K$ in the plane, $C(K)$ has a generator?
QUESTION [7 upvotes]: Let $K\subset \Bbb{C}$ be a compact subset of the complex plane, and let $C(K)$ be the space of all complex continuous functions on $K$.
We say that $f\in C(K)$ is a generator of $C(K)$ when the set $\{p(f) \mid p\ \style{font-family:inherit;}{\text{is a polynomial}}\}$ is dense in $C(K)$.
If $K$ is any set consisting of finite points, it is easy to check that $C(K)$ has a generator.
If $K=[0,1]$, then we know that $f(x)=x$ is a generator of $C[0,1]$ by Stone-Weierstrass theorem. It follows that $C(\gamma)$ has a generator whenever $\gamma$ is a not a closed simple curve.
Now if $K=S^1$, the unit circle on the plane, then it has been proved that $C(K)$ does not have a generator. It follows that $C(\gamma)$ does not have a generator for any $\gamma$ that is a simple connected curve.
If $K=\overline{\mathbb{D}}$, the unit disk, then by using invariance of domain, a similar method as in the case $K=S^1$ can be given to prove that $C(\overline{\Bbb{D}})$ does NOT have a generator. Similarly, It can be proved that $C(K)$ does NOT have a generator if $K$ has an interior point in $\Bbb{C}$.
How to solve this problem if $K$ does not have an interior point?

REPLY [3 votes]: I believe Yemon's conjecture is correct: $C(K)$ has a generator in the sense of the question if and only if $K$ has empty interior and $\mathbb{C}\setminus K$ is connected. As he points out, the reverse direction follows from Lavrentiev's theorem. For the forward direction, if $K$ has nonempty interior then Mr. Li has already pointed out that we know $C(K)$ has no generator: this easily follows from David Ullrich's answer to a previous question which says that $C(S^1)$ has no generator, and the fact that $K$ contains a homeomorphic copy of $S^1$.
Now suppose $\mathbb{C}\setminus K$ is disconnected and assume $C(K)$ has a generator $f$. I claim that $K$ has a component $K_0$ such that $\mathbb{C}\setminus K_0$ is disconnected. Granting the claim, $C(K_0)$ also has a generator $f$, namely the restriction to $K_0$ of any generator of $C(K)$. It is obvious that $f$ must be 1-1 on $K_0$, so by a standard fact it is a homeomorphism between $K_0$ and $f(K_0)$. According to the answer to this question, $\mathbb{C}\setminus f(K_0)$ is also disconnected. Then $f(K_0)$ contains the boundary of a bounded open set, namely any bounded component of its complement. But now David Ullrich's argument for $S^1$ carries over verbatim to this setting to yield a contradiction. End of proof, modulo the claim.
To verify the claim, let $U$ be a bounded component of $\mathbb{C}\setminus K$, let $V$ be the unbounded component of $\mathbb{C}\setminus\overline{U}$, and let $K_0 = \partial V$.