CP violation in gauge theories and the electric dipole moment of the neutron