Extreme value theorem, global versus local extrema, and critical points