In general, I understand the proof, however, I have a difficulty understanding the proof given by my professor. It goes like the following which is very similar to most proofs given in many textbooks.
Suppose $f$ is continuous on the interval $[a,b]$ and $f(a)<S<f(b)$, then $\exists c$ s.t. $f(c)=S$
Proof:
Define $V= \{x \in[a,b];f(x)\leq S \}$
Then $V$ is nonempty and has a least upper bound $c$.
Now, we claim that $f(c)=S$
First, suppose, $f(c)>S$ then by continuity $\exists \delta$ s.t. $f(x)$ is on the interval $(c-\delta,c]$
Then $c-\delta$ is an upper bound of $V$
Now suppose $S>f(c)$, then similarly, $\exists \delta$ s.t.$\forall x\in[c,c+\delta)$, we have $f(x)<S$
This implies that $c$ is not an upper bound of $V$
Therefore $f(c)=S$
Now what I'm especially confused is how he deduced $c-\delta$ as being an upper bound of $V$ by showing that $\exists \delta$ s.t. $f(x)$ is on the interval $(c-\delta,c]$
What is the justification behind this step?
If $f(c)>S$, there is a $\delta>0$ such that $f(x)>S$ for each $x\in(c-\delta,c]$. So, the set $V$ contains no element of $(c-\delta,c]$, which is impossible, since $c=\sup V$, by definition.