Ask some steps in the proof of compact+upper semicontinuous imply maximum? If X is compact and $f : X → (−\infty, \infty)$ is upper semicontinuous, prove that $f$ attains
its maximum at some point of $X$.
Proof:
The sets $f^{−1}((−\infty, \alpha))$ are open for all $\alpha \in\mathbb{R}$; hence, by compactness, there are finitely
many that cover X, and hence $f$ is bounded.
In particular, we only need to take one such set.
Now let $\alpha = \sup\{f(x) | x ∈ X\}$. Since $f$ is bounded, thus this $\alpha$ must $< \infty$. We claim that $f(x) = \alpha$ for some $x \in X$.
From here, I don't understand the proof.
If not, then we can
find some sequence $\alpha_n$ such that $0 < \alpha−\alpha_n <
1/n$. (Question: is this because X is compact?)
In particular, the sets $f^{−1}((−\infty, \alpha-1/n))$cover
X, (Why?) and there is no finite subcover, which is a contradiction. Hence f attains its maximum at
some point of X.
 A: Here is an alternative proof that may give some light to what you were describing in your posting.
For any $c\in A:=f(X)$ define $F_c=\{x\in X: f(x)\geq c\}$. Since $f$ is upper-semico0ntinuous, $F_c$ is closed (why?) The collection $\{F_c: c\in A\}$ has the finite intersection property; hence, $P:=\bigcup_{c\in A}F_c\neq\emptyset$. Any $z\in P$ is a maximal point of $f$ since for any $x\in X$, and $z\in P$
$$f(x)\leq f(z)$$

Here is a proof along the lines of your posting:
As you pointed out, $U_a:=\{x\in X: f(x)<a\}$, $a\in\mathbb{R}$, forms an open cover of $X$ an account that $f$ being upper-semicontinuous, and $f$ being real-valued. The compactness of $X$ implies that there is $X=U_a$ for some $a\in \mathbb{R}$ (why?). Let $\alpha:=\inf\{a\in\mathbb{R}: X=U_a\}$. Notice that $\alpha$ is an accumulation point of $A=f(X)$ and $f(x)\leq \alpha$ for all $x\in X$ (why?) Hence, there a sequence $x_n\in X$such that $f(x_n)\rightarrow\alpha$. As $X$ is compact, there is a subsequence $x_{n'}$ that converges to some $x^*\in X$. The upper-semicontinuity of $f$ implies that
$$\alpha=\lim_{n'}f(x_n')=\limsup_{n'}f(x_{n'})\leq f(x^*)\leq \alpha$$
This shows that $x^*$ is a maximal point of $f$.

Comment: In the second proof I present, I used the following equivalence regarding upper semicontinuous functions:

Let $f:X\rightarrow[-infty,\infty]$ be a function on a Hausdorff topological space. $f$ is upper semicontinuous iff for any net $x_d\rightarrow x$, $\limsup_d f(x_d)\leq f(x)$.

A proof for this (actually for lower semicontinuous) can be found here. The upper semicontinuous case follows by applying the result in that link to $-f$.
