By the Wigner theorem, symmetries transformations are implemented by operators ##\hat{U}## that are unitary or antiunitary. This is what is written in most books. But I have read somewhere that, to ##\hat{U}## represent a symmetrie, it's necessary that ##\hat{U}^{\dagger} \hat{H} \hat{U} = \hat{H}##, that is, the hamiltonian has to be invariant under the transformation. Is it true? Are these definitions equivalents?