1 · Theory
The recursion theorem doesn't only give us quines. It lets us build TMs that inspect, modify, and react to their own description in any computable way. This problem demonstrates one such construction.
The kamikaze construction
M on any input w:
- Print ⟨M⟩ on the tape (recursion-theorem guarantee).
- Append "I have shown my source. Now I erase." to the tape.
- Enter a special "qkz" state — effectively halt with the tape cleared.
M's existence shows: "self-aware" TMs aren't theoretical artefacts — they can be concretely constructed via the recursion theorem.
2 · Animated demo · auto-plays · loops
3 · Pitfalls
- "Erasure" isn't real. TMs don't delete their own code; the kamikaze just halts with a marker after printing itself. The drama is pedagogical.
- δ is fixed at construction time. No TM can modify its own transition function at runtime. Self-modification is simulated by interpreting a description on the tape.
- The recursion theorem makes this routine. Once you have the theorem, building "M prints ⟨M⟩ and does X" is mechanical for any X. The kamikaze is one such X.
4 · Q&A defence notes
Q1. Is "erasing" really meaningful in a TM?
TMs don't have file-system erasure. The kamikaze enters a halt state with a marker. The "erasure" is conceptual — used to dramatise the self-destructive aspect of self-printing TMs.
Q2. Could a TM modify its own transition function during execution?
No — δ is fixed at construction time. But the TM can simulate a different machine by interpreting a description on its tape, effectively running a modified version of itself.
Q3. How does the recursion theorem guarantee step 1?
Apply the s-m-n theorem to construct a function q : ⟨P⟩ ↦ ⟨P'⟩ where P' first writes ⟨P'⟩ to its tape then runs P. With P = "append text 'I have shown my source' and halt," we get the kamikaze TM.
Q4. What's the pedagogical point?
"Self-aware" TMs aren't theoretical artefacts. The recursion theorem provides a constructive recipe for building TMs that perform any computable operation involving their own description. The kamikaze is the most dramatic such example.
5 · Where to read more
Sipser: §6.1 (recursion theorem). Lecture notes: Module 3 slide 5. Companion problems: P13 (quine), P15 (fixed point), P16 (self-aware TM).