SLIDE 1 Five Lectures on CA
Thomas Worsch
Department of Informatics Karlsruhe Institute of Technology http://liinwww.ira.uka.de/~thw/vl-hiroshima/
at Hiroshima University, January 2012
SLIDE 2
Outline
Turing machines Simulation of TM by CA Simulation of CA by TM
SLIDE 3
Turing machines Simulation of TM by CA Simulation of CA by TM
SLIDE 4
Definition Turing machine, one head, one tape (1)
SLIDE 5 Definition Turing machine, one head, one tape (1)
Basics:
◮ finite set of states Q ◮ finite tape alphabet S ◮ move function δ : Q × S → Q × S × D
◮ D = {−1, 0, 1}: directions for head move
−1 for moving left, 1 for moving right and 0 for no move
◮ let’s assume that δ is a total function in this lecture
◮ a blank symbol ✷ ◮ an initial state
SLIDE 6 Definition Turing machine, one head, one tape (2)
derived notions
◮ configuration of a TM
◮ c = (q, b, p) ∈ Q × SZ × Z
◮ write the move function as three separate functions:
◮ δq : Q × S → Q ◮ δs : Q × S → S ◮ δd : Q × S → D
◮ one step of a TM: ∆ : Q × SZ × Z → Q × SZ × Z ◮ For c = (q, b, p) the succesor configuration ∆(c) = (q′, b′, p′)
is defined as
◮
q′ = δq(q, b(p)),
◮
∀x ∈ Z holds b′(x) = b(x) if x = p δs(q, b(p)) if x = p
◮
p′ = p + δd(q, b(p))
SLIDE 7 Turing machines: recent developments :-)
◮ http://www.youtube.com/watch?v=E3keLeMwfHY ◮ Steam-Powered Turing Machine ◮ http://www.cs.washington.edu/general/sptm-caption.html ◮ http://www.cs.washington.edu/homes/ruzzo/
”[. . . ] principal research project involves the construction and programming of a vaguely parallel computer, consisting of 32 steam-powered Turing machines installed in the basement [. . . ] Graduate students have played an important role in the construction and operation of the engine, [...] Originally intended as a general computing engine, restrictions imposed by the Pollution Control and Noise Abatement Boards require that only algorithms running in polynomial time may be
- used. [. . . ] one of [the] students slipped on a mouldering stack of
ungraded homework exercises and fell under the write head of one
- f the machines. Now permanently embossed with a series of 1’s
and 0’s, the student is suing to have the machine dismantled.“
SLIDE 8
Turing machines Simulation of TM by CA Simulation of CA by TM
SLIDE 9
Theorem
For each TM T = (QT, ST, δT) there is a CA C = (Z, QC, {−1, 0, 1}, fC, ) simulating T without loss of time step by step.
SLIDE 10
Sketch of proof: idea
a1 a2 a3 a4 a5 q ∆T a1 a2 a4 a5 a′
3
q′
SLIDE 11
Sketch of proof: idea
a1 a2 a3 a4 a5 q ∆T a1 a2 a4 a5 a′
3
q′ FC
SLIDE 12
Sketch of proof: idea
a1 a2 a3 a4 a5 q ∆T a1 a2 a4 a5 a′
3
q′ FC
SLIDE 13
Sketch of proof: idea
a1 a2 a3 a4 a5 q ∆T a1 a2 a4 a5 a′
3
q′ a1 a2 a3 a4 a5 FC a1 a2 a4 a5 a′
3
SLIDE 14
Sketch of proof: idea
a1 a2 a3 a4 a5 q ∆T a1 a2 a4 a5 a′
3
q′ a1 a2 a3 a4 a5 q FC a1 a2 a4 a5 a′
3
q′
SLIDE 15
Sketch of proof: idea
◮ let QC = (QT ˙
∪{ }) × ST
◮ represent cT = (q, b, p) by
cC : Z → QC x → (q, b(p)) if x = p ( , b(x)) if x = p
SLIDE 16
Sketch of proof: local transition function
for the simulation to work define fC(( , al), ( , am), ( , ar)) = ( , am)
SLIDE 17 Sketch of proof: local transition function
for the simulation to work define fC(( , al), ( , am), ( , ar)) = ( , am) fC((q, al), ( , am), ( , ar)) = (q′, am) if δT(q, al) = (q′, a′
l, 1)
( , am)
SLIDE 18 Sketch of proof: local transition function
for the simulation to work define fC(( , al), ( , am), ( , ar)) = ( , am) fC((q, al), ( , am), ( , ar)) = (q′, am) if δT(q, al) = (q′, a′
l, 1)
( , am)
fC(( , al), (q, am), ( , ar)) = (q′, a′
m)
if δT(q, am) = (q′, a′
m, 0)
( , a′
m)
if δT(q, am) = (q′, a′
m, ±1)
SLIDE 19 Sketch of proof: local transition function
for the simulation to work define fC(( , al), ( , am), ( , ar)) = ( , am) fC((q, al), ( , am), ( , ar)) = (q′, am) if δT(q, al) = (q′, a′
l, 1)
( , am)
fC(( , al), (q, am), ( , ar)) = (q′, a′
m)
if δT(q, am) = (q′, a′
m, 0)
( , a′
m)
if δT(q, am) = (q′, a′
m, ±1)
fC(( , al), ( , am), (q, ar)) = (q′, am) if δT(q, ar) = (q′, a′
r, −1)
( , am)
This does not yet completely specify f . The rest is not important here.
SLIDE 20 Generalization: more tapes and heads
more complicated:
◮ TM with two tapes and one head on each of them ◮ TM with two heads on one tape ◮ TM with arbitrary numbers of tapes and heads
problem:
◮ heads can be “far away” from each other,
- e. g. copying data from one head to the other
◮ still we want to simulate that in one (or two) steps
SLIDE 21
Generalization: more tapes and heads (2)
basic idea for a solution:
SLIDE 22 Generalization: more tapes and heads (2)
basic idea for a solution:
◮ always keep the important information in one cell
- i. e. the information needed for the simulation of the next step
SLIDE 23 Generalization: more tapes and heads (2)
basic idea for a solution:
◮ always keep the important information in one cell
- i. e. the information needed for the simulation of the next step
◮ like this:
SLIDE 24 Generalization: more tapes and heads (2)
basic idea for a solution:
◮ always keep the important information in one cell
- i. e. the information needed for the simulation of the next step
◮ like this:
◮ don’t move the head(s) but the tape contents
SLIDE 25 Generalization: more tapes and heads (2)
basic idea for a solution:
◮ always keep the important information in one cell
- i. e. the information needed for the simulation of the next step
◮ like this:
◮ don’t move the head(s) but the tape contents ◮ don’t wait until everything has been shifted . . .
SLIDE 26 Generalization: more tapes and heads (2)
basic idea for a solution:
◮ always keep the important information in one cell
- i. e. the information needed for the simulation of the next step
◮ like this:
◮ don’t move the head(s) but the tape contents ◮ don’t wait until everything has been shifted . . . ◮ . . . start simulating the next step as soon as all necessary
informations are available
SLIDE 27
Shifting one tape (1)
SLIDE 28 Shifting one tape (1)
. . . q . . . . . . a b c d e f g h . . . δT(q, d) = . . . . . . (q′, x, −1) . . . q′ . . . . . . a b c
←
✷ e f g h . . . . . .
→
x . . . . . . q′ . . . . . . a b
←
✷ c x f g h . . . . . .
→
e . . . . . . q′ . . . . . . a
←
✷ b c x e g h . . . . . .
→
f . . . . . . q′ . . . . . .
←
✷ a b c x e f h . . . . . .
→
g . . .
SLIDE 29 Shifting one tape (2)
. . . q . . . . . . a b c d e f g h . . . δT(q, d) = . . . . . . (q′, x, −1) . . . q′ . . . . . . a b c
←
✷ e f g h . . . . . .
→
x . . . . . . q′ . . . . . . a b
←
✷ c x f g h . . . δT(q′, c) = . . .
→
e . . . (q′′, y, −1) . . . q′′ . . . . . . a
←
✷ b
←
✷ x e g h . . . . . .
→
y
→
f . . . . . . q′′ . . . . . .
←
✷ a
←
✷ b y e f h . . . . . .
→
x
→
g . . .
SLIDE 30
Shifting more
◮ the same technique works for more tapes and one head on
each tape
◮ if one has k heads on the same tape:
SLIDE 31 Shifting more
◮ the same technique works for more tapes and one head on
each tape
◮ if one has k heads on the same tape:
◮ simulate it by k tapes with only 1 head on each
without loss of time (Stoß, 1970) or
SLIDE 32 Shifting more
◮ the same technique works for more tapes and one head on
each tape
◮ if one has k heads on the same tape:
◮ simulate it by k tapes with only 1 head on each
without loss of time (Stoß, 1970) or
◮ use the same idea as before: store all currently visited tapes
squares in one cell . . .
SLIDE 33 Shifting more
◮ the same technique works for more tapes and one head on
each tape
◮ if one has k heads on the same tape:
◮ simulate it by k tapes with only 1 head on each
without loss of time (Stoß, 1970) or
◮ use the same idea as before: store all currently visited tapes
squares in one cell . . .
◮ as just described, this simulation now needs two CA steps for
◮ there are techniques to save a factor of 2 “most of the time”
◮ but we will not go into details here . . .
SLIDE 34
Turing machines Simulation of TM by CA Simulation of CA by TM
SLIDE 35
Definition
Given a CA with quiescent state q0 and a configuration c ∈ QR the support supp(c) of c is supp(c) = {x ∈ R | c(x) = q0}
SLIDE 36
Lemma
If c is a CA configuration with finite support, then F(c) also has finite support.
Proof
SLIDE 37
Lemma
If c is a CA configuration with finite support, then F(c) also has finite support.
Proof
◮ quiescent state: f (q0, . . . , q0) = q0 ◮ If F(c)(x) = q0, then at least one neighbor y of x was not
quiescent before: c(y) = q0.
◮ But each non-quiescent cell y is only the neighbor of |N|,
i.e. finitely many cells.
◮ Since supp(c) is finite, only finitely many cells have a
non-quiescent neighbor.
◮ Therefore supp(F(c)) is finite, too.
SLIDE 38
Theorem
For each CA C = (Z, QC, {−1, 0, 1}, fC, q0) there is a TM T = (QT, ST, δT) simulating C restricted to configurations with finite support. The simulation of c → FC(c) needs time O(| supp(c)|).
SLIDE 39
Simulation of CA
◮ one CA step
a1 a2 a3 a4 a5 FC b1 b2 b3 b4 b5
◮ is simulated computing one new state after the other
SLIDE 40 Simulation of CA
◮ the new states are computed one after the other:
a1 a2 a3 a4 a5 b1 b2 q
◮ for example the TM
◮ reads a2, a3, and a4 ◮ computes b3 and writes it on the tape ◮ moves one square to the right
◮ at the end
◮ the bi are copied to the upper part and ◮ used for the simulation of the next CA step
◮ This is also the (naive) standard technique used on computers.
SLIDE 41
Summary
◮ Each TM can be simulated by a CA. ◮ Each CA using only configurations with finite support
can be simulated by a TM.