Evolutionarily stable investments in recognition systems explain patterns of discrimination failure and success. (6th July 2020)