general topology – Set inclusion for reals

Statement: $K subset mathbb R$ is compact implies $K$ is closed.

Proof: Suppose $K$ is compact. Consider the collection of open sets $displaystyle{O_{k_{in mathbb N}} = left{x in mathbb R: |x – a| > frac 1kright}}$. Then $color{green}{displaystyle{bigcup_{k=1}^infty O_k = mathbb R setminus {a}}}$ and so $displaystyle{K subsetbigcup_{k=1}^infty O_k}$. Since $K$ is compact, $displaystyle{K subsetbigcup_{j=1}^m O_{k_j}}$. Let $N = max{k_i}_{i=1}^m$. Then $displaystyle{K subsetbigcup_{j=1}^m O_{k_j} = left{x in mathbb R: |x – a| > frac 1Nright}}$. By taking complements, we have $displaystyle{left{x in mathbb R: |x – a| < frac 1Nright} subset left{x in mathbb R: |x – a| color{red}{le} frac 1Nright} color{blue}{subset} K^c}$ meaning $a$ is an interior point of $K^c$ implying $K^c$ is open which to say $K$ is closed.

I’d like to prove the relations in $color{green}{text{green}}$ and $color{blue}{text{blue}}$ and give a reason for the one in $color{red}{text{red}}$ above. Please, see if what I typed below works. Thanks.


Statement: $color{green}{displaystyle{bigcup_{k=1}^infty O_k = mathbb R setminus{a}}}$.

Proof:

Note, $a not in O_k$ because $|a – a| not > frac 1k$ for any $k$.

Suppose $displaystyle{x in bigcup_{k=1}^infty O_k}$. Then $x in O_k$ for some $k$ and so $x in mathbb R setminus {a}$ by definition of $O_k$. Now assume $x in mathbb R setminus {a}$. By Archimedes, there’s some $K in mathbb N$ s.t. $displaystyle{K > frac{1}{|x – a|} iff frac 1K < |x – a|}$ and so $x in O_K$ meaning $displaystyle{x in bigcup_{k=1}^infty O_k}$.


Statement: $color{blue}{displaystyle{left{x in mathbb R: |x – a| le frac 1N right} subset K^c.}}$

Proof:

Since $K subset mathbb R$, we have that $K^c = mathbb R setminus K.$ Suppose $displaystyle{s in left{x in mathbb R: |x – a| le frac 1N right}}$. Then $displaystyle{|s – a| le frac 1N}$. Since $displaystyle{K subset bigcup_{j=1}^mO_{k_j}}$, every element $t in K$ has the property $displaystyle{|t – a| > frac 1k}$ and so $s ne t$ meaning $s not in K$ implying $s in K^c$.


We need $displaystyle{left{x in mathbb R: |x – a| le frac 1N right} subset K^c}$ instead of $displaystyle{left{x in mathbb R: |x – a| < frac 1N right} subset K^c}$ because $O_k^c = displaystyle{left{x in mathbb R: |x – a| le frac 1k right}}$ by trichotomy law for reals.