For a homework assignment, I recently solved the following problem in Folland's real analysis text.
Folland's Question: If $X$ is a Locally Compact Hausdorff space, and $K \subset X$ is a compact $G_{\delta}$ set, show there exists some $f \in C_{c}(X,[0,1])$ such that $f^{-1}(\{1\}) = K$.
(spoiler's with solution to Folland's question)
My Question(s):
(1) What is an example of a compact set that is not $G_{\delta}$,
and if necessary
(2) What is an example of a compact set in a Locally Compact Huasdorff space that is not $G_{\delta}$?
Other related (and potentially interesting) examples
Any unbounded or non-closed $G_{\delta}$ set is an example non-compact $G_{\delta}$ set, for instance $[0,1)$ or $\mathbb{R}$.
A common, example of a non- $G_{\delta}$ set is the set of rational numbers. Hints as to why are here.
Unfortunately, something like considering $\mathbb{Q} \cap [0,1]$ is not compact because it is not closed.
Bonus capstone question: I have been considering a slight generalization of the question which may be able to give more insight and/or simultaneously answer the above questions, so I will go ahead and ask it as well.
Does there exist an example of a nested family of sets $\{ E_{\rho}\}_{\rho \in \mathbb{R}^{+}}$ such that $$ \bigcap_{\rho > 0} E_{\rho} \neq \bigcap_{\rho \in \mathbb{Q}^{+}} E_{\rho}. $$
The requirement "nested" can be replaced with whatever you find necessary to prevent considering something uninteresting along the lines of the family of sets being $E_{\pi} = \emptyset$ and $E_{\rho} = [0,1]$ for all $\rho \neq \pi$.
Thanks!
Every closed set in a metric space is $G_\delta$, since $\overline{A}=\bigcap_n B_{1/n}(A)$ for any subset $A$ in a metric space. So to find a counterexample, you're going to have to look at a reasonably nasty space. As a not-too-hard example, you can take $X=[0,1]^I$ for any uncountable set $I$ and let $K\subset X$ be any singleton set. Then any neighborhood of $K$ can restrict only finitely many coordinates, so a countable intersection of neighborhoods of $K$ can only restrict countably many coordinates. That is, if $A$ is any $G_\delta$ set containing $K=\{x\}$, then there must be a countable subset $J\subset I$ such that $A$ contains all points $y$ such that $y(j)=x(j)$ for all $j\in J$.
For your final question, if you define "nested" to mean $E_\rho\subseteq E_\sigma$ if $\rho\leq\sigma$, then no such family can exist. Indeed, if $x\in E_\rho$ for all rational $\rho>0$, then for any $\sigma\in\mathbb{R}^+$, we can choose some rational $\rho$ such that $0<\rho<\sigma$, and then $x\in E_\rho\subseteq E_\sigma$.