A theory of polymorphism in gene-for-gene interactions