Computational principles of cultural evolution