proof for the extreme value theorem