4.6.16 · D1Theory of Computation

Foundations — Universal Turing machine

3,321 words15 min readBack to topic

Before you can understand that sentence, you must be able to read every squiggle in it. This page builds each symbol from absolute zero, in an order where nothing appears before it is earned. We link the parent Universal Turing Machine and each prerequisite as it enters.


0. What a "machine" even means here

We are not talking about metal and gears. In this subject a machine is a rule for changing a row of symbols. Picture a long paper strip divided into boxes, and a tiny reading head sitting over one box. That is the entire physical universe of the theory.

Look at Figure s01. The row of boxes is the tape; the yellow letters 1 0 1 1 are the input sitting in the leftmost cells; the greyed boxes marked "blank" are empty cells we have not written on yet (we will give this "blank" a proper symbol in §1); the red arrow is the head, pointing at the one cell it is currently reading. Keep this picture in mind — every definition below is just a label on some part of it.

Figure — Universal Turing machine

1. The alphabet symbols: and

The head reads symbols, so we need names for the allowed symbols. This is also where we finally put a proper name on the "blank" cells you saw in Figure s01.

Look at Figure s02. The small blue bag holds the input letters 0 1; the big green bag holds those plus two extra symbols: the blank and a scratch marker . The small bag sitting entirely inside the big one is the whole point: every input letter is also a tape letter, but not vice-versa.

Figure — Universal Turing machine

2. Strings and the special string


3. States and

The machine also has an internal "mood" that decides how it reacts — this is a state.

Look at Figure s03. The four circles labelled , , , and are states — think of a dial that can be set to one of them at a time. The red arrow between them, tagged "read 1: write 0, move R", is a single rule that moves the dial from one state to another. That arrow is exactly a row of , which we define in the next section.

Three states get special jobs (all four appear as circles in Figure s03):

  • = the start state: where the dial begins.
  • = the accept state: reaching it means "YES, halt and accept" (the green double ring in Figure s03).
  • = the reject state: reaching it means "NO, halt and reject" (the red double ring in Figure s03).

4. The transition function

Now the engine: the rulebook that ties state + read-symbol to an action. In Figure s03 it is drawn as the labelled red arrow between two state-circles; here we write that same arrow in symbols.

Why is the whole personality of the machine. Everything a machine does — add, palindrome-check, loop forever — is encoded entirely in this finite table. Two machines differ only in their . That is exactly why we can hope to write down as a string and hand it to another machine: it is finite.


5. The encoding and the pair

Here is the leap that makes the whole topic possible.


6. The interpreter symbols: , , , and


7. Where all this is heading

These foundations feed three big destinations you'll meet after this note:

  • The idea "fixed machine + variable program on tape" is exactly the Stored-Program Computer and von Neumann Architecture.
  • Feeding a description of itself () seeds Diagonalization and the Halting Problem.
  • The claim that is not more powerful — just more flexible — is the Church-Turing Thesis.
  • The multi-tape design of relies on Multi-tape vs Single-tape TM equivalence.

How to read the map below. Read it top-to-bottom: each box is a foundation from this page, and an arrow "" means "you need before makes sense". Start at Tape and Head (§0); it lets us talk about Alphabets (§1), which lets us talk about strings and (§2). Separately, the States box (§3) and the alphabets feed the Transition function (§4). Bundle those and you get the Machine tuple ; encode that tuple as a string and you get Encoding of (§5); feed that plus states into the Universal machine (§6). The final box shows the two topics this page unlocks.

Tape and Head

Alphabets Sigma and Gamma

Strings and input w

States set Q and q0 qacc qrej

Transition function delta

Machine tuple M

Encoding of M as a string

Universal Turing Machine U

Stored-Program and Halting Problem


Equipment checklist

Cover the right side and test yourself — you're ready for the parent note when every line is easy.

What is the tape?
An infinite strip of cells, each holding one symbol — the machine's memory and worksheet.
Is the standard tape one-way or two-way infinite?
Standard textbook TMs use a two-way-infinite tape; one-way (left-bounded) variants exist and compute the same things.
What does the head do?
Sits over one cell; it can read, write, and step one cell left or right.
Difference between and ?
= input alphabet; = tape alphabet including the reserved blank; .
Where does the blank symbol live?
In but never in ; i.e. , and it fills every unused cell.
What is a scratch symbol like ?
A tape symbol in (not the blank) the machine writes as a bookmark; it never appears in the input.
What is ?
The input string — the data placed on the tape at the start of a run.
What is a state, and what is ?
A state is the machine's current internal mode; is the finite set of all states.
What do , , mean?
Start state, accept (halt-yes) state, reject (halt-no) state.
On which states is undefined?
On the halting states and ; its domain is .
Read aloud.
In state reading : write , move direction , switch to state .
What is ?
The move direction — left or right by one cell.
What does denote?
The function computed by — the outcome (accept, reject, or loop) of running on input .
What does mean?
The finite-string description (the "program") of machine , over a fixed alphabet.
What does mean?
The pair encoded as one string: , a separator, then — splittable back into the two.
Why can any machine be encoded as a string?
Because , , and are all finite, so the whole rulebook is a finite table.
What does mean?
If and only if — a two-way promise: both statements are true together and false together.
What does say?
Running on 's description plus gives the same answer as run directly on .
What does mean?
The machine halts (stops), as opposed to looping forever.