In cognitive dissonance the two ideals do not cancel out. One is reduced by rationalization. Hence cognitive dissonance reduction. "I want to smoke the cigarette.  I know it is bad for me.  I will quit at some later point so it is ok to smoke it now."  More relevant,  "I speak of punching nazis and there is a guy with a MAGA hat in front of me in the line at a fast food restaurant.  I know violence is bad but if I punch this guy and steal his hat my friends will cheer for me.  I will punch the guy with the MAGA hat."   Edit,  as I read this over I do not want to give the impression I am lecturing.   Sorry if that was unintentionaly conveyed.