Solution (source code)

= Solution

Let $f$ be <continuous> on a closed bounded interval $[a,b]$. First prove that $f$ is a <bounded function>. If it failed, we could choose $x_n\in[a,b]$ with $|f(x_n)|>n$. The <Bolzano-Weierstrass theorem> gives a <subsequence> $x_{n_j}\to x_*$. Because the interval is closed, $x_*\in[a,b]$. <Continuity> gives $f(x_{n_j})\to f(x_*)$, contradicting $|f(x_{n_j})|>n_j\to\infty$.

Now let $M=\sup\{f(x):x\in[a,b]\}$, which exists by <completeness of the real numbers> and the bound just proved. Choose $y_n\in[a,b]$ with $f(y_n)>M-1/n$. A <convergent subsequence> has <limit of a sequence> $y_*\in[a,b]$, and <continuity> gives $f(y_*)=M$. Applying the same argument to $-f$ gives attainment of the <infimum>. This proves the <extreme value theorem>: \b[the maximum and minimum both exist and are attained]. The argument also covers a one-point interval, where the conclusions are immediate.