Let $X \subset \mathbb{R^m}$. Show that if any continuous function of real value and defined in $X$ reaches a value maximum, then $X$ is compact.
I have seen several proofs of this exercise, but using more complex topics such as the Tietze Extension theorem and other answers I have seen prove the contrapositive. Can I make a simpler demonstration using only real analysis elements? And if that is possible, what would a demonstration be like for this exercise?