Explaining imperfect ant mimicry