Self-replication
A machine that builds a working copy of itself, and the copy can do it again. Not the same as printing your own source.
●●○ moderate · where to see it
The idea
In the late 1940s John von Neumann asked whether a machine can build a copy of itself without the copy getting simpler each time. Building something usually needs a builder more complex than the thing built. Life seems to break that rule.
Read the story
His answer, worked out in a 29-state cellular automaton and published after his death (Theory of Self-Reproducing Automata, edited by Arthur Burks, 1966), has three parts plus a tape.
- A, the constructor. Given a description on a tape, it builds the machine described.
- B, the copier. It copies any tape, without reading what it means.
- C, the controller. It runs A, then B, then attaches the new tape to the new machine.
- φ(A+B+C), the description. A tape that describes A, B and C.
Give A+B+C the tape φ(A+B+C). A builds a new A+B+C. B copies the tape. C hands the copy over. Now there are two, and the child has everything the parent had.
The key trick is that the tape is used twice, once interpreted (as instructions for building) and once copied (as plain data). That is what avoids the infinite regress of a description that must contain a description of itself. It is also how DNA works; it is transcribed into proteins and replicated as a string. Von Neumann had the scheme before the structure of DNA was known (1953).
How it works
Replicator versus quine.
Replicator versus quine. A quine prints its own text. It does not run the copy, and the copy does not have to live anywhere. A replicator builds its copy in the same world it lives in, and the copy runs. A quine's output is a file; a replicator's output is a neighbour.
The smallest real replicator is the Core War Imp in Redcode.
MOV 0, 1
It copies itself one cell ahead, and the program counter steps onto the copy. Trace, with memory cells 100, 101, 102.
| Step | PC | Cell 100 | Cell 101 | Cell 102 |
|---|---|---|---|---|
| 0 | 100 | MOV 0, 1 | (empty) | (empty) |
| 1 | 101 | MOV 0, 1 | MOV 0, 1 | (empty) |
| 2 | 102 | MOV 0, 1 | MOV 0, 1 | MOV 0, 1 |
Strictly it is one process walking forward, not two. Real replicators split off a new process; Tierra creatures copy themselves into a fresh block and then call DIVIDE.
Seen in
- Langton's loops. Christopher Langton (1984) made a much smaller replicating loop in an 8-state automaton by dropping von Neumann's demand that the constructor be universal.
- Redcode. The Imp, and warriors that copy themselves to survive bombing.
- Tierra. Thomas Ray's 80-instruction ancestor copies itself in a loop and divides. Mutation in the copy loop drives evolution.
- Avida. Tierra's idea with organisms in a grid and rewards for doing logic.
- bff. Nobody writes the replicator. It appears from random 64-byte tapes.
- Nanopond. Tiny cells in a grid, each a small program that can copy itself into a neighbour.
- Game of Life. Self-replicating patterns exist, but are huge and were built by hand, decades after the rules.
Try this
- Step through the Imp table above for three more steps. Which cells hold
MOV 0, 1now? - In von Neumann's terms, which part of the Imp is the tape, the copier and the constructor?
- Hard: write a program that is a replicator but not a fixed point, one that copies most of itself and changes a little every generation.
Further
- John von Neumann, Theory of Self-Reproducing Automata, ed. Arthur W. Burks (1966).
- C. G. Langton, "Self-reproduction in cellular automata", Physica D (1984).
- Von Neumann universal constructor on Wikipedia
- See also quine, artificial life, cellular automata.