# Intersection of open and compact

In a metric space let $A$ be compact and $B$ - open, dense everywhere. Does it mean that $$\overline{A} = \overline{A\cap B}$$ or there are counterexamples?

-
Note that compact sets in Hausdorff spaces are closed, so the left-hand side of your equation can be replaced by A. – Dan Ramras Jun 30 '11 at 16:18
Metric spaces are Hausdorff, so compact sets are closed. Therefore, $\overline{A}=A$. I know what "dense" and what "nowhere dense" mean. What does "dense everywhere" mean? – Arturo Magidin Jun 30 '11 at 16:19
I think you might need the interior of $A$ to be non-empty. – Joel Cohen Jun 30 '11 at 16:24
Even with non-empty interior the statement is false - take $A = [0,1] \cup \{2\}$ and $B = \mathbb{R} - \{2\}$. You could ask that $A$ is equal to the closure of its interior, but then the statement is trivial. – MartianInvader Jun 30 '11 at 16:47
Thanks for the post; it reminds me to not jump to the conclusion that $\overline{A\cap B}$=$\overline{A}\cap\overline{B}$, and examples like A$=(0,1)$ and B=$(1,2)$ – gary Jun 30 '11 at 17:48

What about $A=\{0\}$ and $B=\mathbb R\setminus\{0\}$?
Perhaps this result is worth mentioning in this context: If $A$ is dense in $X$, then for every open $U\subset X$ we have $\overline U=\overline{U\cap A}$.