Let $C$ be a compact set, and $A$ an open set, with $C \subset A$. Show that there exists a $\delta > 0$ such that if $x \in C$ and $|y-x| < \delta$ then $y \in A$
If I assume $A$ to be bounded, then it can be expressed as an enumerable union of open disjoint intervals, $A = \bigcup I_\lambda$. So let $x \in C$ then $x \in I_{\lambda_0}$ for some $I_{\lambda_0}$ in $\bigcup I_\lambda$. Let $\alpha_1=\inf I_{\lambda_0}$, and $\beta_1 = \sup I_{\lambda_0}$, and let $\alpha_2$ be the smallest element of $C$ in $I_{\lambda_0}$, and $\beta_2$ the largest element of $C$ in $I_{\lambda_0}$. (Since $C$ is closed, $\alpha_1\neq\alpha_2$ and $\beta_1\neq\beta_2$) Now, if $0<\delta=\min\{|\alpha_1-\alpha_2|,|\beta_1-\beta_2|\}$ and $|y-x| < \delta$, then $\alpha_1<y<\beta_1$, that is, $y\in I_{\lambda_0}$.
Now if $A$ is unbounded, with $A\neq \mathbb R$, and $x \in C$ happens to be in an unbounded interval $I_{\lambda_0}$, just take $\delta = |a-\alpha_2|$ if $I_{\lambda_0} = (a, +\infty)$ or $\delta = |a-\beta_2|$, if $I_{\lambda_0} = (-\infty, a)$
Is this proof correct?, or is there a better $\delta$ that guarantees more $y$ elements in $A$?
Your $\delta$ depends on $\lambda$. There is an easier argument using the definition of compact set that applies to any metric space, not just $\Bbb R$: