Turing Machine
2026-08-18 21:55
From Basics of a Turing Machine:
Every construction there answered how. This unit asks whether.
Halting. Nothing in the definition forces a machine to stop.
The head moves only where \(\delta\) sends it.
Universality. \(U\) simulates but does not decide.
If \(M\) loops on \(w\), then \(U\) loops too.
Are Turing machines powerful enough to model any conceivable algorithm?
To answer it we must first define algorithm.
Each technique is sharper than the one before.
An algorithm is an effective, systematic, mechanical method for achieving the desired result for a given problem.
Its properties:
Everything in this unit turns on terminates in finitely many steps.
Decision problems — input \(w\), output yes or no.
Yes means \(w \in L\). Given a chess configuration and it is your turn, can you win?
Function computation — input \(w\), output \(f(w)\).
Given the Facebook graph, what is the minimum number of people between you and your role model?
\(M\) decides \(L \subseteq \Sigma^*\) iff for all \(w \in \Sigma^*\):
\[\begin{cases} M \text{ accepts } w, & \text{if } w \in L, \\ M \text{ rejects } w, & \text{if } w \notin L. \end{cases}\]
A language is Turing-decidable, or recursive, iff some TM decides it.
Every input gets a verdict. Nothing runs forever.
\(M\) computes \(f : \Sigma^* \to \Sigma^*\) iff for all \(w \in \Sigma^*\):
\[(q_0, \triangleright w) \vdash^* (q_{\text{acc}}, \triangleright f(w))\]
Again: on every input.
\(M\) semidecides \(L\) iff for all \(w \in \Sigma^*\):
\[\begin{cases} M \text{ accepts } w, & \text{if } w \in L, \\ M \text{ rejects } w \text{ or runs forever}, & \text{if } w \notin L. \end{cases}\]
A yes answer arrives. A no answer may never arrive.
| Type of computation | Always halt? |
|---|---|
| TM’s for decidable languages | ✓ |
| TM’s for computable functions | ✓ |
| TM’s for semidecidable languages | ✗ |
Algorithm = a TM for a Turing-decidable language, or for a Turing-computable function.
Semidecidability is deliberately excluded.
A procedure that might not stop is not an algorithm — however useful it is in practice.
“Semidecidable” does not mean “solvable if you are patient”.
If the machine has not accepted yet, you have learned nothing.
Any algorithm can be executed by a Turing machine.
Equivalently:
One side is formal — Turing machines.
The other side is informal — what a person or device could mechanically do.
No proof crosses that gap. What supports it is evidence: \(\lambda\)-calculus, register machines, every programming language — all compute the same functions.
Without the thesis, “the Halting Problem is undecidable” is a fact about one formalism.
With it, it is a fact about computation.
If \(L\) is Turing-decidable, then \(\overline{L}\) is Turing-decidable too.
Run the decider and swap the verdict.
If \(L\) is semidecidable and undecidable, then \(\overline{L}\) is not semidecidable.
Otherwise run both machines in parallel and always get an answer — making \(L\) decidable.
The set of all decision problems is bigger than the set of all Turing machines.
Proved before naming a single unsolvable problem.
A decision problem is a function \(\Sigma^* \to \{0,1\}\) — read the answers off as bits.
| Strings | \(\{0,1\}\) | |
|---|---|---|
| \(\epsilon\) | → | 0 |
| 0 | → | 1 |
| 1 | → | 1 |
| 00 | → | 0 |
| 01 | → | 0 |
| 10 | → | 0 |
| 11 | → | 1 |
This one is the number
\[0.0110001\ldots\]
Every program in every language you will ever write is on that list.
An uncountable set cannot inject into a countable one.
Most decision problems are not even Turing-semidecidable.
To show a list is incomplete, you do not examine infinitely many entries.
You build one thing the list cannot contain.
Build an object that differs from:
Then it cannot equal entry \(i\) for any \(i\).
The cost of defeating all of them is one disagreement each.
Lay the list out as a grid — machines down, inputs across.
Entry \(i\)’s behaviour is row \(i\). Position \(i\) is column \(i\).
So the places we disagree are the cells \((i,i)\) — the diagonal.
The name is literal.
| TM | \(w_1\) | \(w_2\) | \(w_3\) | \(w_4\) | \(w_5\) | \(\cdots\) |
|---|---|---|---|---|---|---|
| \(M_1\) | 1 | 0 | 0 | 1 | 0 | \(\cdots\) |
| \(M_2\) | 0 | 0 | 1 | 0 | 0 | \(\cdots\) |
| \(M_3\) | 0 | 1 | 1 | 1 | 1 | \(\cdots\) |
| \(M_4\) | 1 | 1 | 0 | 1 | 0 | \(\cdots\) |
| \(M_5\) | 0 | 1 | 0 | 0 | 0 | \(\cdots\) |
Every semidecidable language is a row, because every machine appears.
Diagonal: \(1, 0, 1, 1, 0, \ldots\)
Flipped: \(0, 1, 0, 0, 1, \ldots\)
\[L_d = \{w_i \mid w_i \notin L(M_i)\}, \qquad d_i = \begin{cases} 1 & \text{if } \text{table}_{ii} = 0, \\ 0 & \text{if } \text{table}_{ii} = 1. \end{cases}\]
Suppose \(L_d\) is semidecidable. Then \(L_d = L(M_k)\) for some \(M_k\).
Does \(M_k\) accept \(w_k\)?
\[\implies w_k \notin L_d \quad (\text{defn. of } L_d)\]
\[\implies w_k \notin L(M_k) \quad (L_d = L(M_k))\]
\[\implies M_k \text{ does not accept } w_k\]
Contradicts the assumption of this case.
\[\implies w_k \in L_d \quad (\text{defn. of } L_d)\]
\[\implies w_k \in L(M_k) \quad (L_d = L(M_k))\]
\[\implies M_k \text{ accepts } w_k\]
Contradicts the assumption of this case.
\(L_d\) is not Turing-semidecidable.
We have named a specific decision problem no machine solves.
Three machines over \(\Sigma = \{a\}\). Each has one state.
| \(M_1\) | \(\triangleright\) | \(a\) | \(\square\) |
|---|---|---|---|
| \(q_0\) | \((q_0, \rightarrow)\) | \((q_0, \rightarrow)\) | \((q_0, \rightarrow)\) |
The head keeps moving right forever.
| \(M_2\) | \(\triangleright\) | \(a\) | \(\square\) |
|---|---|---|---|
| \(q_0\) | \((q_0, \rightarrow)\) | \((q_0, a)\) | \((q_0, \square)\) |
The head does not move; it rewrites the symbol as itself.
| \(M_3\) | \(\triangleright\) | \(a\) | \(\square\) |
|---|---|---|---|
| \(q_0\) | \((q_0, \rightarrow)\) | \((q_0, \leftarrow)\) | \((q_0, \leftarrow)\) |
The head oscillates between the end marker and the first character.
Non-termination is not the preserve of complicated programs.
Undecidability is not caused by complexity.
\[L = \{\langle M, w \rangle \mid \text{TM } M \text{ accepts input string } w\}\]
If \(M\) runs forever on \(w\), SIMULATE runs forever. Exactly like \(U\) last unit.
Then invoke PARADOX(<PARADOX>).
Case 1. PARADOX accepts \(\langle\)PARADOX\(\rangle\)
\(\implies\) SIMULATE rejects \(\langle\)PARADOX\(, \langle\)PARADOX\(\rangle\rangle\) \(\implies\) PARADOX rejects \(\langle\)PARADOX\(\rangle\)
Case 2. PARADOX rejects \(\langle\)PARADOX\(\rangle\)
\(\implies\) SIMULATE accepts \(\langle\)PARADOX\(, \langle\)PARADOX\(\rangle\rangle\) \(\implies\) PARADOX accepts \(\langle\)PARADOX\(\rangle\)
SIMULATE is algorithmically impossible.
\[L = \{\langle M, w \rangle \mid \text{TM } M \text{ halts on input string } w\}\]
Case 1. accepts \(\implies\) HALT rejects \(\implies\) runs forever.
Case 2. runs forever \(\implies\) HALT accepts \(\implies\) accepts.

SIMULATE.
HALT.Only the middle box and one output label change.
No perfect infinite-loop detector.
No perfect static analyser for arbitrary runtime behaviour.
Ever, in any language.
\[L_{\text{old}} \leq_m L_{\text{new}}\]
if there is a computable \(f\) with
\[x \in L_{\text{old}} \iff f(x) \in L_{\text{new}}\]
Yes-instances land in \(L_{\text{new}}\); no-instances land in its complement.
The \(m\) stands for many-to-one.
If \(L_{\text{old}} \leq_m L_{\text{new}}\):
Assume HALT is algorithmically possible. Then build:
Line 2 is what makes it terminate.
If HALT is an algorithm, so is SIMULATE.
But SIMULATE is impossible.
So HALT is impossible.
We reduce the known-hard problem to the new problem.
The reverse proves nothing — it says the new problem is no harder than something impossible.
To check yourself: write out the imagined decider and see which problem it decides.
They all share a bound.
“More than 481 steps on \(\epsilon\)?”
Simulate for 482 steps and look.
That simulation always halts — the step count is fixed in advance.
They all quantify over all inputs.
Given a new question, ask: could a finite amount of simulation settle it?
Anything a finite check settles is decidable.
Anything requiring behaviour on all inputs generally is not.
Reduction is the one you will actually use.
SIMULATE and HALT impossible by self-reference.The previous unit built a model of computation and found it strong enough to do anything a computer can.
This unit found its edge.
By the Church-Turing thesis, that edge is the limit of computation — no faster hardware and no better language moves it.
Every question about arbitrary program behaviour is undecidable in general.
Real tools work because they give up something:
Knowing which of the three a tool has chosen is the useful form of everything proved here.
Turing Machine · Algorithms and the Limits of Computation