Five Lectures on CA 2. Simulations Thomas Worsch Department of - - PowerPoint PPT Presentation

five lectures on ca 2 simulations
SMART_READER_LITE
LIVE PREVIEW

Five Lectures on CA 2. Simulations Thomas Worsch Department of - - PowerPoint PPT Presentation

Five Lectures on CA 2. Simulations Thomas Worsch Department of Informatics Karlsruhe Institute of Technology http://liinwww.ira.uka.de/~thw/vl-hiroshima/ at Hiroshima University, January 2012 Outline Turing machines Simulation of TM by CA


slide-1
SLIDE 1

Five Lectures on CA

  • 2. Simulations

Thomas Worsch

Department of Informatics Karlsruhe Institute of Technology http://liinwww.ira.uka.de/~thw/vl-hiroshima/

at Hiroshima University, January 2012

slide-2
SLIDE 2

Outline

Turing machines Simulation of TM by CA Simulation of CA by TM

slide-3
SLIDE 3

Turing machines Simulation of TM by CA Simulation of CA by TM

slide-4
SLIDE 4

Definition Turing machine, one head, one tape (1)

slide-5
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
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
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
SLIDE 8

Turing machines Simulation of TM by CA Simulation of CA by TM

slide-9
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
SLIDE 10

Sketch of proof: idea

a1 a2 a3 a4 a5 q ∆T a1 a2 a4 a5 a′

3

q′

slide-11
SLIDE 11

Sketch of proof: idea

a1 a2 a3 a4 a5 q ∆T a1 a2 a4 a5 a′

3

q′ FC

slide-12
SLIDE 12

Sketch of proof: idea

a1 a2 a3 a4 a5 q ∆T a1 a2 a4 a5 a′

3

q′ FC

slide-13
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
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
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
SLIDE 16

Sketch of proof: local transition function

for the simulation to work define fC(( , al), ( , am), ( , ar)) = ( , am)

slide-17
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)

  • therwise
slide-18
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)

  • therwise

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
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)

  • therwise

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)

  • therwise

This does not yet completely specify f . The rest is not important here.

slide-20
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
SLIDE 21

Generalization: more tapes and heads (2)

basic idea for a solution:

slide-22
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
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
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
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
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
SLIDE 27

Shifting one tape (1)

slide-28
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
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
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
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
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
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

  • ne TM step

◮ there are techniques to save a factor of 2 “most of the time”

◮ but we will not go into details here . . .

slide-34
SLIDE 34

Turing machines Simulation of TM by CA Simulation of CA by TM

slide-35
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
SLIDE 36

Lemma

If c is a CA configuration with finite support, then F(c) also has finite support.

Proof

slide-37
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
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
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
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
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.