c328topic8

download c328topic8

of 8

Transcript of c328topic8

  • 8/18/2019 c328topic8

    1/8

    Comp 328

    Theory of Computation

    SSU

    Topic 8: Turing Machines

    Session 1: Introduction

    We have seen that there are very "simple" languages, such as,  L = {α ν β ν  χ ν  :ν  ≥ 0} that cannot be

    recognized with either an NFA or an NPDA. Neither type of machine has a sophisticated enough

    memory. Also, we want machines that can do more sophisticated computation then merely

    recognize languages.

    We can accomplish both of these goals by adding a simple output device to our finite state

    machine. If we allow the tape to be written to in addition to being read from, then it can serve as

    both output and memory. The result is a Turing Machine.

    Defn. (Turing Machine)

    M=(Q,, , , q0, , F)

    • Q is the finite set of states

    • is the input alphabet

    • is the tape alphabet

    • : (Q x F) ~ (Q x ~ x {L, R}) is the transition function (a partial function)

    • q0 is the start state

    • is the blank tape symbol

    • F Q is the set of accepting states

    • Also we have - {}

    Examples:

    •L={ambn : m ≥ 0, n ≥ 0}

    • Instantaneous description

    • Move

    • Computation

  • 8/18/2019 c328topic8

    2/8

    Comp 328

    Theory of Computation

    SSU

    •  L = {α ν β ν  : ν ≥ 0} or  L = {α 

    ν β ν  χ ν  :ν  ≥ 0}

    •  L = {ωω   :ω   ∈ {α ,β }∗} or  L = {ωω : ω  ∈ {α ,β }∗}

    Defn: (The Languange of a TM)

    •L(M) = {w: q0w  uq f v for some u, v  *, q f   F }

  • 8/18/2019 c328topic8

    3/8

    Comp 328

    Theory of Computation

    SSU

    Topic 8: Turing Machines

    Session 2: Turing Machines as Computational Devices (Transducers)

    I.

    Input is the contents of the tape when computation starts and output is the contents of thetape when the machine halts.

    A. Examples

    1. A TM that computes f  ( x) = x + 1 ( x is in binary)

    2. A TM that computes f  ( x) = 2 x ( x is in binary)

    3. A TM that computes f ( x) = x & y

    II. Exercise: Build a TM that computes the function f ( x) = x + y.

  • 8/18/2019 c328topic8

    4/8

    Comp 328

    Theory of Computation

    SSU

    Topic 8: Turing Machines

    Session 3: Turing Machine Results

    What are the limits of a TM's ability? Are there functions that cannot be computed? Are therelanguages that cannot be accepted? Are there problems that cannot be solved?

    Can we make them more powerful?

    • Staying in one place on the tape. {L, R, S}

    • Subroutine that causes a backup. (Sec. 10.1)

    • Multiple Tracks (one read and write head).

    • Tape Alphabet consists of tuples. (Sec. 10.1)

    • Multiple Tapes (more than one read and write head).

    • Implement as a multi-track machine. (Sec. 10.2)

    • Twice as many tracks as tapes

    • Mark the head's position on each tape with a 1 on the next track 

    • Non-deterministic TM's

    • Use backtracking algorithm (Sec. 10.3)

    Can we program a TM?

    • A Universal TM, M', (Sec. 10.4)

    • Takes as input a TM, M and a string

    • Use a 3-tape TM

    • Tape 1 - Description of M

    • Tape has five tracks to simulate the transition function

    • Tape 2 - M's Tape

    • Tape 3 - Current state of M

    What languages do TM's accept?

    • Recursively Enumerable (Sec. 11.1)

    • Recursive - Halts on all inputs

  • 8/18/2019 c328topic8

    5/8

    Comp 328

    Theory of Computation

    SSU

  • 8/18/2019 c328topic8

    6/8

    Comp 328

    Theory of Computation

    SSU

    What problems can be solved by a TM?

    • Turing's Thesis (Sec. 9.3)

    • Any problem that has an algorithmic solution can be solved by a TM.

    • A universal TM is equal in power to any existing computational device.

  • 8/18/2019 c328topic8

    7/8

    Comp 328

    Theory of Computation

    SSU

    Topic 8: Turing Machines

    Session 4: The Halting Problem

    Are there problems that cannot be solved by any algorithmic process?

    If we accept the Church-Turing Thesis, then any algorithmic process can be performed by a Turing

    Machine. Thus, a Turing Machine is at least as powerful as any mechanical computation device in

    existence.

    Thus if we can find a problem that no Turing Machine can solve then this problem is not solvable

    by any computational device.

    The Halting Problem

    Given a Turing machine M , and a string w  over the alphabet of M , does M  reach a haltingstate during the computation of w ?

    A solution to this problem would consist of an algorithm or a TM that starts with M  and w on its

    tape and returns "Yes" if M  halts on w, and returns "No" if M  does not halt on w.

    Why can't we just simulate M  on a universal TM to see if it halts on w or not?

    • This process may not be finite!! It will not terminate if M  does not halt on w.

    We will show that the Halting problem is unsolvable. We will proceed by contradiction.

    • Assume that the Halting problem is solvable

    • Let M  H  be a TM that solves the Halting problem

    • M  H  halts in a "Yes" state if M  halts on w and M  H  halts in a "No" state if M  

    loops on w.

    • Modify M  H  to get a TM M  H’ that goes into an infinite loop if M  halts on w and

    halts in a "Yes" state if M  loops on w.

    • Further modify M  H’ to get a TM M  H’’ that takes as its input a TM M , and runs M  H’ 

    to see if M halts on its own description!!!

    • Thus M  H  ‘’loops if M  accepts its own description and halts if M  loops onits own description.

    • Now run M  H’’ with input M  H’’.

    • What happens?

    • M  H’’ loops on M  H’’ if M  H’’ halts on M  H’’ and M  H’’ halts on M  H’’ if M  H’’ loops

    on M  H’’

  • 8/18/2019 c328topic8

    8/8

    Comp 328

    Theory of Computation

    SSU

    • This is an impossible situation! Therefore, no such TM MH, can exit and so the Halting

    problem is unsolvable.