Extensions to Turing machines - PowerPoint PPT Presentation

About This Presentation
Title:

Extensions to Turing machines

Description:

Basic idea: At each step, scan symbols of all heads. ... Number locations diagonally in M', v v v v v 1 2 6 7 15 3 5 8 14 4 9 13 10 12 ... – PowerPoint PPT presentation

Number of Views:130
Avg rating:3.0/5.0
Slides: 16
Provided by: Muf7
Category:

less

Transcript and Presenter's Notes

Title: Extensions to Turing machines


1
Extensions to Turing machines
  • TMs are clumsy.
  • Can we make them more efficient or more powerful?
  • We will consider 6 possibilities
  • Multiple tapes
  • Multiple heads
  • Two dimensional tapes
  • Random access memory
  • One way tapes
  • Nondeterminism

2
Multiple tapes
tape1
lt a b a a - -
head1
control
tape2
lt a b a a - -
head2
tape3
lt a b a a - -
head3
  • Basic idea At each step, scan symbols of all
    heads. Then, control depends on set of symbols
    and current state the result is to replace
    symbols (move R/L) on all tapes.
  • Question does this allow us to compute more
    functions?
  • Answer NO.
  • Theorem A function is TM-computable iff it is
    computable on a multitape TM.
  • Proof Assume TM M and MTTM M.
  • Show TM M is simulated by MTTM M (easy)
  • Show MTTM M is simulated by TM M. (more
    interesting)

3
Multiple tapes
One encoding of two tapes.
-1 0 1 2 3
M
lt A B C D E - -
tape1
head1
-1 0 1 2 3
lt F G H I J - -
tape 2
head2
M .. (0,A,F) (0,B,G) (1,C,H)
(0,D,I)
  • In M,
  • location -1 contains 0 not current head
  • A location -1 of tape 1
  • F location -1 of tape 2
  • location 0 contains 0 not current head
  • B location 0 of tape 1 and posn of tape 1
    head
  • G location 0 of tape 2

4
Multiple tapes
Another encoding of two tapes.
-1 0 1 2 3
M
lt A B C D E - -
tape1
head1
-1 0 1 2 3
lt F G H I J - -
tape 2
head2
  • M -1 0 1 2 3
  • A B C D E
  • 0 1 0 0 0
  • F G H I J
  • 0 0 0 1 0
  • 0 denotes inactive location
  • 1 - denotes active location

5
Multiple tapes
Whichever encoding, consider how to simulate a
transition in M. One action in M will be matched
by several actions in M
-1 0 1 2 3
M
lt A B C D E - -
tape1
head1
-1 0 1 2 3
lt F G H I J - -
tape 2
One transition Move head tape 1 Replace symbol
on tape 2
head2
-1 0 1 2 3
M
lt A B C D E - -
tape1
head1
-1 0 1 2 3
lt F G H Z J - -
tape 2
head2
  • In M
  • Position head somewhere sensible right end of
    data
  • Move left, memorising the symbols at all active
    locations. Move to right end.
  • Move left, replacing ABC by ABC
  • 010
    by 001
  • and HIJ
    by HZF
  • 010
    010
  • Return to right end.
  • If in halting state, convert contents of tape and
    halt.

6
Multiple Heads
tape
lt a b a a - -
head1
head2
head n
control
  • There are n heads, but in any state, only one
    head can move.
  • BUT, this doesnt add any expressive power this
    machine can be simulated by an ordinary TM
    (argument is similar to multiple tapes).

7
Two dimensional tapes
One head on a grid that expands indefinitely to
the right and down We can simulate
this machine by a TM. Number locations
diagonally in M, v v v v v gt 1
2 6 7 15 gt 3 5 8 14 gt 4
9 13 gt 10 12 gt 11 then represent as
follows v 1 v 2 3 gt 4 5 6 v 7
8 9 10 gt 11 ..
8
Random Access Memory RAM TMs
  • Instead of sequential data, change model to
    incorporate random access.
  • program ----- program
    counter PC
  • -----
    registers R1 Ac

  • Rn
  • control
  • tape
  • (RAM)
  • The tape itself (memory) is still one
    dimensional, and infinite, but we index into it
    via (a finite number of) registers. Registers
    and RAM cells contain natural numbers.
  • Standard TM inputs/outputs strings over S.
  • RAM TM inputs/outputs values in N into RAM
    locations.

9
Turing machine
  • Standard TM inputs/outputs strings over S.
  • But
  • RAM TM inputs/outputs values in N into RAM
    locations.
  • So does this mean that the RM TM is more
    powerful?OF COURSE NOT.
  • Any string in S can be represented by a numeric
    code (assign numbers to symbols, then
    concatenate). So both machines have the same
    domain.
  • To show that RAM TM ? M, we construct a
    simulation.
  • Dont give simulation here, but idea is
  • K registers ? k3 tape TM
  • tape 1 for I/O
  • tape 2 for content of
    RAM tape (locn, content)
  • tape 3 for working tape

10
One Way Tapes
  • So far, our tape has been infinite in both
    directions. What if we restrict the tape to being
    one way infinite. Does this mean that the OWT TM
    is less powerful?OF COURSE NOT.
  • Any two way tape machine M can be simulated by
    a one way tape machine M.
  • Two way tape
  • location -2 -1 0 1 2 3
  • x-2 x-1 x0 x1
    x2 x3
  • One way tape
  • location 1 2 3 4 5 6 7 8
  • x1 x0 x2 x-1
    x3 x-2
  • Location i in M is at location 2i1 in M
    igt1
  • Location i in M is at location 4-2i in M i
    lt0
  • Why do we need ?
  • To indicate end of tape (to wrap around).

11
countability
  • The argument for one way tapes is very similar to
    a countability argument.
  • Defn A set is countable if we can list the
    elements of the set (total order), and we can
    refer to the ith element of the set.
  • Examples
  • N 0,1,2,3, is countable
  • Z -1, -2, 0,1, 2, is countable
  • NxN is countable
  • (m,n) lt (m,n) iff (mn)lt (mn) or if
    (mn)(mn) then mltm
  • (1,1) (1,2) (1,3) (1,4)
  • (2,1) (2,2) (2,3) (2,4)
  • (3,1) (3,2) (3,3) (3,4)
  • But R is not countable. Consider the interval
    0,1).
  • Proof By contradiction (Cantors diagonisation)
  • Assume there is an ordering
  • 1st 0.a11a12a13

12
countability
  • The argument for one way tapes is very similar to
    a countability argument.
  • Defn A set is countable if we can list the
    elements of the set (total order), and we can
    refer to the ith element of the set.
  • Examples
  • N 0,1,2,3, is countable
  • Z -1, -2, 0,1, 2, is countable
  • NxN is countable
  • (m,n) lt (m,n) iff (mn)lt (mn) or if
    (mn)(mn) then mltm
  • (1,1) (1,2) (1,3) (1,4)
  • (2,1) (2,2) (2,3) (2,4)
  • (3,1) (3,2) (3,3) (3,4)
  • But R is not countable. Consider the interval
    0,1).
  • Proof By contradiction (Cantors diagonisation)
  • Assume there is an ordering
  • 1st 0.a11a12a13

13
countability
  • Now change aii to bii as follows bii aii 1,
    if aii lt9

  • 0 if aii 9
  • Clearly the number 0.b11b22b33 is in the
    interval 0,1).
  • But, it does not occur in the list because for
    any i, the ith digit differs from aii (it is aii
    1!) so we cannot find a position for
    0.b11b22b33 . Thus 0,1) is not countable. Nor
    is R.

14
Nondeterminism
  • All machines so far have been deterministic.
    What if we allow nondeterminism? Nondeterminism
    does not affect the power of FSAs but it does
    affect PDA (something not covered here).
  • What is nondeterminism for TMs? Multiple
    transitions
  • (q,a) (p,b)
  • (q,b) (p,b)
  • (q,b) (p,b)
  • So, we have nondeterministic computations
  • C0
  • C11 C12
    C1k
  • C21 C22 .. ..
  • A nondeterministic machine can produce multiple
    outputs. But is it more powerful? (OF COURSE
    NOT)

15
Nondeterminism
  • Sketch of proof Show that if M semidecides L
    (if w is in L, at least one comp. halts) then M
    semidecides L (if w is in L, then M halts).
  • How to simulate all computations of M? We cant
    simply run them one after another what if one
    doesnt halt (but a later one does)? We need to
    dovetail computations. Or put another way,
    instead of a depth first search, we need a
    breadth first search.
  • Dovetailing
  • Step 1 run first computation for 1 step.
  • Step 2 run first computation for 2 steps and 2nd
    computation for 2 steps.
  • Step i run I computations for I steps.
  • To do the dovetailing in M, use 2 tapes to store
    the configurations from odd and even steps.
  • For example, assume all configurations from the
    10th step are stored on tape 2. Then, assuming
    no computations halt, work out next
    configurations (from tape 2) and write them to
    tape 1. Erase tape 2, then start working on
    configurations from 1th step, which are all no
    stored on tape 1.
  • Clearly if M halts, then so will M.
  • CONCLUSION We cannot enhance a TM!
Write a Comment
User Comments (0)
About PowerShow.com