Notes on Complexity Theory
Last updated: August, 2011
Lecture 1
Jonathan Katz
1
Turing Machines
I assume that most students have encountered Turing machines before. (Students who have not
may want to look at Sipser’s book [3].) A Turing machine is defined by an integer
k
≥
1, a finite
set of states
Q
, an alphabet Γ, and a transition function
δ
:
Q
×
Γ
k
→
Q
×
Γ
k

1
×{
L, S, R
}
k
where:
•
k
is the number of (infinite, onedimensional) tapes used by the machine. In the general case
we have
k
≥
3 and the first tape is a readonly
input tape
, the last is a writeonce
output
tape
, and the remaining
k

2 tapes are
work tapes
. For Turing machines with boolean output
(which is what we will mostly be concerned with in this course), an output tape is unnecessary
since the output can be encoded into the final state of the Turing machine when it halts.
•
Q
is assumed to contain a designated start state
q
s
and a designated halt state
q
h
. (In the
case where there is no output tape, there are two halting states
q
h,
0
and
q
h,
1
.)
•
We assume that Γ contains
{
0
,
1
}
, a “blank symbol”, and a “start symbol”.
•
There are several possible conventions for what happens when a head on some tape tries
to move left when it is already in the leftmost position, and we are agnostic on this point.
(Anyway, by our convention, below, that the leftmost cell of each tape is “marked” there is
really no reason for this to ever occur. . . ).
The computation of a Turing machine
M
on input
x
∈ {
0
,
1
}
*
proceeds as follows: All tapes of
the Turing machine contain the start symbol followed by blank symbols, with the exception of the
input tape which contains the start symbol followed by
x
(and then the remainder of the input tape
is filled with blank symbols). The machine starts in state
q
=
q
s
with its
k
heads at the leftmost
position of each tape. Then, until
q
is a halt state, repeat the following:
1. Let the current contents of the cells being scanned by the
k
heads be
γ
1
, . . . , γ
k
∈
Γ.
2. Compute
δ
(
q, γ
1
, . . . , γ
k
) = (
q
0
, γ
0
2
, . . . , γ
0
k
, D
1
, . . . , D
k
) where
q
0
∈
Q
and
γ
0
2
, . . . , γ
0
k
∈
Γ and
D
i
∈ {
L, S, R
}
.
3. Overwrite the contents of the currently scanned cell on tape
i
to
γ
0
i
for 2
≤
i
≤
k
; move head
i
to the left, to the same position, or to the right depending on whether
D
i
=
L, S
, or
R
,
respectively; and then set the current state to
q
=
q
0
.
The output of
M
on input
x
, denoted
M
(
x
), is the binary string contained on the output tape
(between the initial start symbol and the trailing blank symbols) when the machine halts. (When
there is no output tape, then the output is ‘1’ if
M
halts in state
q
h,
1
and the output is ‘0’ is
M
halts in state
q
h,
0
.) It is also possible that
M
never halts when run on some input
x
. We return to
this point later.
11