Semigroups and cosine functions