Equivalent Variations of Turing Machines
● Nondeterministic TM = deterministic TM
● nPDA = pushdown automata with n stacks
2PDA = nPDA = TM for all n ≥ 2
● Turing machines with n tapes (n≥ 2) and n tape heads has the
same expressive power as a Turing machine with one tape
head.
● Turing machines with a tape that is infinite to the left and right
has the same expressive power as a Turing machine with a
tape that is finite to the left and infinite to the right.
(Chapters 21 and 22)
1
Chapter 23: Turing Machine Languages
● Definition. A language L over the alphabet Σ is recursively
enumerable if there exists a Turing machine such that for
every word w∈L, w is accepted, and for every word w∉L,
either w is rejected (crashes) or w causes the machine to go
into an infinite loop.
● Definition. A language L over an alphabet Σ is recursive if
there exists a Turing machine such that for every word w∈L,
w is accepted, and for every word w∉L, w is rejected
(crashes).
2
● Theorem. If there exist two Turing machines T1 and T2 that
accept languages L1 and L2, then there exists a Turing machine
that accepts L1 + L2.
● Proof: (abbreviated) It is possible to build a Turing machine
T3 that simulates running the input on the two machines
alternately.
First, transform T1 which accepts L1 to a Turing machine
such that for every word that is not in L1, the machine
loops forever. Call the new machine T1’. Do the same for
L2.
◆ For each state, if a letter x has no outgoing transition, add a
transition (x, x, R) to a new state NOWHERESVILLE and in this
state add transitions back to itself that together implement an infinite
loop, e.g., (x,x,R) for every x ϵ Σ ∪ Γ ∪{∆}.
Similarly, transform T2 to T2’.
3
SET-UP: the initial steps of the new Turing machine must
make 2 copies of the input word on the tape, one for T1’
and one for T2’.
T3 will simulate the two machines T1’ et T2’ executing at
the same time. We add a SIMULATE-T1’ state and a
SIMULATE-T2’ state to T3.
For each state xi of T1’, we add a set of states to T3 to
perform the simulation of a step of execution starting from
xi.
Similarly, for each state yi of T2’, we add a set of states to
T3 to perform the simulation of a step of execution starting
from yi.
A state FIND-Y pushes the tape head right until it finds a
state in T2’, and a FIND-X state pushes the tape head left
until it finds a state in T1’.
4
The SET-UP Subprogram
a
b
b
∆
∆
…
#
x1
a
b
b
*
state from T1’
symbol marking
the first cell
y1
a
b
b
∆
∆
…
state from T2’
symbol separating the 2 copies
Neither of the two machines will crash if the word is in L1 + L2 .
(If the word in in L1, then T2’ will either accept the word or go
into an infinite loop and T1’ will have time to accept the word. So
T3 will accept the word. Similarly, for when the word is in L2.)
5
(b,c,L)
x5
x3
…
b
a
x5
b
a
a
…
b
a
b
a
a
…
…
b
a
c
a
a
…
…
b
x3
a
c
a
a
…
…
6
START
SET-UP
SIMULATE T1’
(x1,x1,R)
SIM-x1
(x2,x2,R)
SIM-x2
FIND Y
(x3,x3,R)
SIM-x3
SIMULATE T2’
(y1,y1,R)
SIM-y1
(y2,y2,R)
SIM-y2
(y3,y3,R)
SIM-y3
FIND X
7
Theorem. If a language L and its complement L’ are both
recursively enumerable then L is recursive.
.
Proof: (abbreviated)
T1 is aTuring machine for L.
T2 is a Turing machine for L’.
We transform both machines into new Turing machines T1’ et T2’
such that:
T2’ crashes on every word in L’ and goes into an infinite loop
for every word in L.
T1’ accepts every word in L and goes into an infinite loop for
every word in L’.
8
The machine T3 will simulate both machines T1’ and T2’ (as was
done for the union).
If the word is in L, then T2’ will go into an infinite loop and
T1’ will have time to accept the word. So T3 will accept the
word.
If the word is not in L, then T1’ will go into an infinite loop
and it will give time for T2’ to crash. So T3 will reject the
word.
The Turing machine T3 will not go into an infinite loop and
this makes the language L recursive.
9
● Theorem. If there exist two Turing machines T1 and T2 that
accept languages L1 and L2, then there exists a Turing
machine that accepts L1 ∩ L2.
● Theorem: The complement of a recursively enumerable
language is not necessarily recursively enumerable.
10
The Encoding of Turing machines
● Example
(a,b,L)
(b,b,R)
START 1
(a,b,R)
3
(∆,b,L)
HALT 2
X1
X2
X3
X4
X5
From
To
Read
Write
Move
1
1
b
b
R
1
3
a
b
R
3
3
a
b
L
3
2
∆
b
L
11
● Encoding a state = encoding a positive integer
Σ={a,b} 1: ab 2: aab 3: aaab
● Σ ∪ Γ = {a,b,#}
Read/Write
a
b
∆
#
Code
aa
ab
ba
bb
Move
L
R
Code
a
b
12
From
To
Read
Write
Move
Code
1
1
b
b
R
ababababb
1
3
a
b
R
abaaabaaabb
3
3
a
b
L
aaabaaabaaaba
3
2
∆
b
L
aaabaabbaaba
Code of the machine:
ababababbabaaabaaabbaaabaaabaaabaaaabaabbaaba
ababababb|abaaabaaabb|aaabaaabaaaba|aaabaabbaaba
Code Word Language: CWL = language((a+ba+b(a+b)5)*)
Remark: It is possible to determine if a word in CWL is the code
of a Turing machine.
13
ALAN = all words w∈CWL that are not accepted by the Turing
machines that they represent.
ALAN⊂CWL
Example:
START 1
(b,b,R)
HALT 2
From
To
Read
Write
Move
1
2
b
b
R
Language L defined by this machine: words starting with b
Code word for the machine that accepts L: abaabababb
abaabababb ∉ L
Thus abaabababb ∈ ALAN
14
Other Examples
● Example: The code word for a machine that accepts
language((a+b)*) is not in ALAN.
● Example: The code word for a machine that accepts the empty
language is in ALAN.
● Example: The code word for a machine that accepts
L=language((a+b)*aa(a+b)*) contains aa, and thus is in L.
Thus the code word is not in ALAN.
15
● Theorem. There does not exist any Turing machine that
accepts ALAN.
● Proof: Assume there is a Turing machine T that accepts
ALAN. We denote the code word for T as code(T). Either
code(T) ∈ ALAN, or code(T) ∉ ALAN.
Case 1. If T accepts code(T), then code(T) ∈ ALAN.
(ALAN is the language accepted by T.) But by definition,
ALAN cannot contain a code word accepted by its own
machine. Thus code(T) ∉ ALAN. A contradiction.
Case 2. If T does not accept code(T), then code(T) ∈ ALAN.
But ALAN is the language defined by T. A contradiction.
Thus there is no Turing machine that accepts ALAN.
16
● Theorem. Not all languages are recursively enumerable.
● Example: ALAN
17
Universal Turing Machine
● Definition. A universal Turing machine is a Turing machine
MTU such that:
● Input words to MTU have the form:
#w#x
where w is the code word that represents a Turing machine
T and x is a word containing letters of T’s input alphabet.
● MTU will operate on the data #w#x exactly the same as T
would operate on x. (MTU crashes, accepts, or loops if and
only if T does the same.)
18
● Theorem: Universal Turing machines exist.
● A universal Turing machine is a model of a computer. For
program w and input x, the Turing machine performs the
execution of program w on input x.
● A programming language is Turing complete if it can be used
to simulate a universal Turing machine.
19
Decidability: The Halting Problem
● Does there exist a Turing machine such that given an input
word x and a code word w for a Turing machine T that can
decide whether or not T halts (enters a HALT state) on input
x?
● A Turing machine solves a problem that is decidable if it can
produce a “yes” or “no” answer in a finite number of steps. It
does not decide the problem if it enters an infinite loop on
some inputs.
● We assume that input to a Turing machine HP that solves the
halting problem has the form #code(T)#x, and HP prints “yes”
on the tape and then halts whenever T halts, and prints “no” on
the tape and then halts whenever T crashes or enters an infinite
loop.
20
● Theorem. No Turing machine exists that can decide the halting
problem. In other words, there is no Turing machine that for
any string w and any code for T, can determines whether or
not T halts on w.
● Proof idea: If we assume such a machine exists, we can build a
Turing machine that accepts ALAN.
● Note: the halting problem is the membership problem for
recursively enumerable languages: Is w in the language
accepted by T? A Turing machine cannot decide this problem.
21
© Copyright 2026 Paperzz