Interpretation of Heine-Borel Theorem in $\mathbb{R}$ I'm preparing for my next semester, in which I'm following the course " Introduction to Analysis". I was wondering if anyone could tell if my interpretation of the first part of Heine-Borel's theorem in $\mathbb{R}$ is more or less correct. I've put my thoughts in \footnotes{}, and some in the text. Maybe it's completely wrong, but then I would like you to correct me. Thank you in advance.
Theorem [Heine-Borel]:
A subset $S$ of $\mathbb{R}$ is compact iff $S$ is closed and bounded.
First part of the proof:
Suppose that $S$ is compact. For each $n\in\mathbb{N}$, let ${I_n=N(0;n)=(-n,n)}$. Then each $I_n$ is open and $S\subseteq \bigcup_{n=1}^{\infty}I_n$. Thus $\{I_n:n\in\mathbb{N}\}$ is an open cover of $S$. Since $S$ is compact, there exists finitely many integers $n_1,\ldots,n_k$ such that
\begin{align*}
S\subseteq (I_{n_1} \cup \cdots \cup I_{n_k}) = I_m,
\end{align*}
where $m=\mathrm{max}\{n_1,\ldots,n_k\}$. It follows\footnote{By definition of an upper bound.} that $|x|<m, \forall x\in S$. That is, $S$ is bounded.
To show that $S$ must be closed, we suppose that it is not. Then there would exist a point $p\in\mathrm{cl}(S)\setminus S$\footnote{This is the same as saying $p\in\mathrm{bd}(S)$. And since $S$ is not closed, then $\mathrm{bd}(S)\notin S$.}. For each $n\in\mathbb{N}$, let ${U_n=\mathbb{R}\setminus [p-\frac{1}{n},p+\frac{1}{n}]}$\footnote{Every $U_n$ is an open set, because it is the complement of the closed set ${[p-\frac{1}{n},p+\frac{1}{n}]}$.}. Now we have
\begin{align*}
\bigcup_{n=1}^{\infty}U_n=\mathbb{R}\setminus\bigcap_{n=1}^{\infty}\bigg[p-\frac{1}{n},p+\frac{1}{n}\bigg]=\mathbb{R}\setminus\{p\}\supseteq S
\end{align*}
Thus $\{U_n:n\in\mathbb{N}\}$ is an open cover of $S$ by definition of compact sets. Since $S$ is compact, there exist $n_1 < n_2 < \cdots < n_k$ in $\mathbb{N}$ such that ${S\subseteq\bigcup_{i=1}^{k}U_{n_i}}$. All these $U_n$'s are nested. That is, $U_m\subseteq U_n$ if $m\leq n$. This shows the existence of a finite subcover. It follows that $S\subseteq U_{n_k}$. But then $S \cap N(p;1/n_k)=\emptyset$\footnote{This is true because $N(p;1/n_k)$ is the complement of $\mathbb{R}\setminus [p-\frac{1}{n_k},p+\frac{1}{n_k}]$.}, contradicting our choice of $p\in\mathrm{cl}(S)\setminus S$ because open sets only consists of interior points, and neighborhoods of interior points is a subset of the original set. Thus $p\in\mathrm{cl}(S)$ which shows that $S$ is closed.
 A: It’s generally correct, but I do have a few comments on the last paragraph:

Thus $\{U_n:n\in\mathbb{N}\}$ is an open cover of $S$ by definition of compact sets. 

No, $\{U_n:n\in\Bbb N\}$ is an open cover of $S$ because $S\subseteq\bigcup_{n\in\Bbb N}U_n$, and each $U_n$ is an open set; compactness doesn’t enter into it.

Since $S$ is compact, there exist $n_1 < n_2 < \cdots < n_k$ in $\mathbb{N}$ such that ${S\subseteq\bigcup_{i=1}^{k}U_{n_i}}$. All these $U_n$'s are nested. That is, $U_m\subseteq U_n$ if $m\leq n$. This shows the existence of a finite subcover. It follows that $S\subseteq U_{n_k}$. But then $S \cap N(p;1/n_k)=\emptyset$\footnote{This is true because $N(p;1/n_k)$ is the complement of $\mathbb{R}\setminus [p-\frac{1}{n_k},p+\frac{1}{n_k}]$.}, 

Not quite: $N(p:1/n_k)=\left(p-\frac1{n_k},p+\frac1{n_k}\right)\subsetneqq\left[p-\frac1{n_k},p+\frac1{n_k}\right]$. That is, $N(p:1/n_k)$ is contained in the complement of $\Bbb R\setminus\left[p-\frac1{n_k},p+\frac1{n_k}\right]$.

contradicting our choice of $p\in\mathrm{cl}(S)\setminus S$ because open sets only consists of interior points, and neighborhoods of interior points is a subset of the original set. 

This is a bit confusing, and unnecessary besides: a point $x$ is in the closure of $S$ if and only if $S\cap N(x;\epsilon)\ne\varnothing$ for each $\epsilon>0$, and you’ve found that if $\epsilon\le\frac1{n_k}$, then $S\cap N(p;\epsilon)=\varnothing$; from this it’s immediate that $p\notin\operatorname{cl}S$, contradicting the choice of $p$.

Thus $p\in\mathrm{cl}(S)$ which shows that $S$ is closed.

A: Okay, - I've now put the whole proof together with all of my thoughts. Comments from @Brian M. Scott has been included in the first part. I thought it would be better to seperate this new updated version, from my original one, so one can actually see the difference. Again, - it's my interpretation, and there may be errors. Of course, this is why I seek help, to find them. I've still left some thoughts in \footnotes{} and some in the text. Thank you in advance.
Lemma 1
If S is a nonempty closed bounded subset of $\mathbb{R}$, then S has a maximum and a minimum.
Lemma 2
A point $x$ is in the closure of $S$ iff ${S\cap N(x;\varepsilon)\neq\emptyset}$ for each $\varepsilon > 0$
Lemma 3:
Let $\{A_j:j\in J\}$ be an indexed family of sets, and $B$ be a set.
\begin{align*}
B\setminus \Bigg[\bigcap_{j\in J}A_j \Bigg]=\bigcup_{j\in J}(B\setminus A_j).
\end{align*}
Theorem[Heine-Borel]: A subset $S$ of $\mathbb{R}$ is compact iff $S$ is closed and bounded.
Proof:
Suppose that $S$ is compact. For each $n\in\mathbb{N}$, let ${I_n=N(0;n)=(-n,n)}$. Then each $I_n$ is open and $S\subseteq \bigcup_{n=1}^{\infty}I_n$. Thus $\{I_n:n\in\mathbb{N}\}$ is an open cover of $S$. Since $S$ is compact, there exists finitely many integers $n_1,\ldots,n_k$ such that
\begin{align*}
S\subseteq (I_{n_1} \cup \cdots \cup I_{n_k}) = I_m,
\end{align*}
where $m=\mathrm{max}\{n_1,\ldots,n_k\}$. It follows\footnote{By definition of an upper bound.} that $|x|<m, \forall x\in S$. That is, $S$ is bounded.
To show that $S$ must be closed, we suppose that it is not. Then there would exist a point $p\in\mathrm{cl}(S)\setminus S$. For each $n\in\mathbb{N}$, let ${U_n=\mathbb{R}\setminus [p-\frac{1}{n},p+\frac{1}{n}]}$\footnote{Every $U_n$ is an open set, because its complement is closed.}. By Lemma 3 we have
\begin{align*}
\bigcup_{n=1}^{\infty}U_n=\mathbb{R}\setminus\bigcap_{n=1}^{\infty}[p-1/n,p+1/n]=\mathbb{R}\setminus\{p\}\supseteq S.
\end{align*}
Thus $\{U_n:n\in\mathbb{N}\}$ is an open cover of $S$ because ${S\subseteq\bigcup_{n\in\mathbb{N}}U_{n}}$, and each $U_n$ is open. Since $S$ is compact, there exist $n_1 < n_2 < \cdots < n_k$ in $\mathbb{N}$ such that ${S\subseteq\bigcup_{i=1}^{k}U_{n_i}}$. All these $U_n$'s are nested. That is, $U_m\subseteq U_n$ if $m\leq n$. This shows the existence of a finite subcover. It follows that $S\subseteq U_{n_k}$. But then $S \cap N(p;1/n_k)=\emptyset$\footnote{Because $N(p;1/n_k)$ is contained in the complement of $U_{n_k}=\mathbb{R}\setminus [p-1/n_k,p+1/n_k]$.} for all $\varepsilon\leq\frac{1}{n_k}$, which, by Lemma 2, shows that $p\notin\mathrm{cl}(S)$, contradicting our choice of $p\in\mathrm{cl}(S)\setminus S$. Thus $p\in\mathrm{cl}(S)$ and hence $S$ is closed.
Conversely, suppose that $S$ is closed and bounded. Let $\mathcal{F}$ be an open cover of $S$. For each $x\in\mathbb{R}$ let 
\begin{align*}
S_x=S\cap (-\infty,x]
\end{align*}
and let
\begin{align*}
B=\{x:S_x \ \mathrm{is \ covered \ by \ a \ finite \ subcover \ of} \ \mathcal{F}\}.
\end{align*}
Since $S$ is closed and bounded, Lemma 1 implies that $S$ has a minimum, say $d$. Then $S_d=\{d\}$, and this is certainly covered by a finite subcover of $\mathcal{F}$\footnote{Let $y\neq d$ and $y\in S$, then $S_y$ is a finite subcover $S_d$.}. Thus $d\in B$ and $B$ is nonempty. Suppose that $B$ is not bounded above, then it will contain a number $z>\mathrm{sup}S$. But then ${S_z=S\cap (-\infty,z]=S}$, and since $z\in B$, we conclude that $S$ is compact.\
If we can show that $B$ is not bounded above, $S$ will certainly be compact. In fact suppose that $B$ is bounded above, and let $\mathrm{sup}B<\mathrm{sup}S$, then we don't know if $S$ is compact.\
To this end, we suppose that $B$ is bounded above, and let $m=\mathrm{sup}B$\footnote{That is, $S_m$ is the largest number, such that $S_x$ is compact.}. We shall show that $m\in S$ and $m\notin S$ both leads to contradictions. If $m\in S$, then since $\mathcal{F}$ is an open cover of $S$, there exists ${F_0\in\mathcal{F}:m\in F_0}$. Since $F_0$ is open, there exists an interval $[x_1,x_2]$ in $F_0$ such that
\begin{align}
x_1<m<x_2.
\end{align}
Because $F_0$ is open, we can always choose numbers closer to the boundary of $F_0$, such that the above equation is true. Since $x_1<m$ and $m=\mathrm{sup}B$, there exists $F_1,\ldots F_k$ in $\mathcal{F}$ that cover $S_{x_1}$. But then $F_0,F_1,\ldots F_k$ cover $S_{x_2}$, so that $x_2\in B$. This contradicts $m=\mathrm{sup}B$.
On the other hand, if $m\notin S$, then since $S$ is closed there exists an $\varepsilon > 0$ such that $N(m;\varepsilon) \cap S=\emptyset$. But then $S_{m-\varepsilon} = S_{m+\varepsilon/2}$ and since $m-\varepsilon\in B$, $m+\varepsilon/2$ is also in $B$\footnote{We choose $m+\varepsilon/2$, because we want to make sure that $m+\varepsilon$ is not the boundary of $S$}. This contradict $m=\mathrm{sup}B$ once again. Since the possibility that $B$ is bounded above leads to a contradiction, we conclude that $B$ is not bounded above, and hence $S$ is compact.
