Show that f is bounded below and assumes its infimum I got a metric space $(M,d)$ and the function $f:M\to \mathbb{R}$ with the following property: $\forall r\in$$\mathbb{R},$ $\{x\in M:f(x)>r\}$ is an open set. Now I need to show that this function in an compact metric space is bounded below and assumes its infimum. I thought that I only need to show that the function is continuous, but I don't really know how.
I hope someone can help me with this.
 A: Hint
You won't be able to prove that $f$ is continuous as it may not be. However your $f$ is lower semi-continuous. For example
$$f= \begin{cases}
1 &\text{if } x \lt 1\\
0 &\text{if } x = 1\\
1/2 &\text{if } x \gt 1
\end{cases}$$
is lower semi-continuous but not continuous.
A lower semi-continuous map is attaining its minimum on a compact set. To prove it consider a sequence $\{x_n \}$ in the compact $K$ such that $\{f(x_n)\}$ converges to the infimum $m$ of $f$ in $K$. As $K$ is compact, there is a subsequence $\{x_{\varphi(n)}\}$ of $\{x_n \}$ that converges. Let say to $k \in K$. Then prove that $f(k) = m$.
A: First we prove that the function is bounded from below.
Note that we have an open cover
$$\bigcup_{n=0}^\infty \{f>-n\}$$
of $X.$ By the compactness of $X,$ it admits a finite open cover. Thus we know
$$X=\{f>-n\}$$
for some $n\in\mathbb N,$ so $f$ is bounded below by $-n.$
Next, we let $m:=\inf_X f.$ By definition, we can find a sequence $x_n$ in $X$ such that $f(x_n)\searrow m$ as $n\to \infty.$ The compactness of $X$ implies that it admits a convergent subsequence $x_{i_n},$ say converging to $x.$ By construction, given any $\delta>0,$ $x_{i_n}$ belongs to $\{f\le m+\delta\}$ for any large enough $n.$ Since $\{f\le m+\delta\}$ is closed, we know the limit $x$ also belongs to this set. Thus we derive
$$x\in\bigcap_{\delta>0}\{f\le m+\delta\}=\{f\le m\},$$
so $f(x)=m.$
