Theory of Self-Reproducing Automata