The underlying logic of right and wrong