A formal theory of the selfish gene