Constants of motion in quantum mechanics