Solution (source code)

= Solution

The <intermediate value theorem> states that if $f:[a,b]\to\mathbb R$ is <continuous>, then every real value between $f(a)$ and $f(b)$ is attained at some $c\in[a,b]$. Here is a proof using <completeness of the real numbers>. Endpoint values are immediate, so suppose $f(a)<y<f(b)$; reversing the sign of $f$ handles the other ordering. Let
$$
S=\{x\in[a,b]:f(x)<y\},\qquad c=\sup S.
$$
The set is nonempty and bounded above. <Continuity> at $a$ puts points to the right of $a$ in $S$, while <continuity> at $b$ excludes an entire interval to the left of $b$, so $a<c<b$. If $f(c)<y$, <continuity> puts some point larger than $c$ in $S$, contradicting its <supremum>. If $f(c)>y$, <continuity> excludes $S$ in a neighborhood of $c$, contradicting the existence of points of $S$ arbitrarily close to its <supremum> from below. Therefore $f(c)=y$, proving the theorem.

For the fixed-point assertion, put $g(x)=f(x)-x$. This is <continuous>, with $g(0)=f(0)\ge0$ and $g(1)=f(1)-1\le0$. If either endpoint value is zero it already gives a <fixed point>; otherwise the <intermediate value theorem> gives an interior zero. Hence
$$
\boxed{\text{Every continuous self-map of }[0,1]\text{ has a fixed point.}}
$$
The proof needs both <continuity> and the closed-interval endpoint information; the following counterexamples separate those hypotheses.