Lecture #26 (18 April 2002)

Theory of Computation & Turing Machines


Overall Reading
Decker/Hirshfield: pp. 269-277
Brookshear: (Optionally) Ch. 11.2
Note: The two books discuss the same content, but using different notation. We choose to use the material from [DH].


Outline:

  • Introduction (Mod. 8.1 [DH])
  • View of Programs (pp. 271-274 [DH])
  • The Turing Machine (pp. 274-277 [DH])

  • Introduction (Mod. 8.1 [DH])

    Are there limits to computing?

  • Artificial Intelligence
    Most recently, we examined many problems which are done well by humans, but seem to be difficult for machines.

    When talking about Artificial Intelligence, one of the early contributors was Alan Turing (recall the 'Turing Test' for intelligence). This work was late in his career (1950), as the development of modern computers was getting underway and they could begin to experiment.

  • Theory of computation
    Today we will look carefully at the question of whether there are some problems which computers simply cannot solve.

    Interestingly, Alan Turing was also at the forefront in thinking about the formal limits of computing, even before any of these computers existed!

    In 1936, he defined an abstract model for computation which we now call the "Turing Machine." We will look carefully at this model and note some interesting facts:

  • It seems that any program on a modern computer, written in a programming language of your choice, could be expressed as an equivalent Turing Machine program.
  • There are some problems that cannot be solved by Turing Machines.
  • Therefore, it seems that there exist some problems which probably cannot be solved by any programs for any computer.

  • View of Programs (pp. 271-274 [DH])

  • In general, we will think of programs which
    take "input" to "output"

  • For now, let's not worry about how the program works;
    only the end result in going from input to output
    ("black box" vs. "clear box")

  • For input and output, we might want to consider only strings of 0's and 1's.
    (after all, all digital information can be viewed as 0's and 1's).

    In truth, if you prefer to think of strings of characters over a larger alphabet, that's okay too, so long as the alphabet is finite.


  • The Turing Machine (pp. 274-277 [DH])

    A very simple view of computation:
  • Machine's memory is a linear tape of discrete cells and unlimited length.
    Each cell can store one character ('symbol')
    There is a head which is always pointing to one particular cell of the tape which can be read from or written to.

  • The program control is always in one of a finite number of states.
    (we will simply represent the current state as a number from 1...n)

    At each step, the following is done:

  • The symbol under the tape head is read
  • Based on this symbol, and the current state we might do any or all of the following:
  • Write another symbol to the tape in place of the current symbol
  • Change the current state of the machine
  • Move the tapehead one spot left or right
  • That's all there is to it!

    Let's walk through some examples:

  • Present State Present Symbol Write Move New State
    100Right2
    200Right3
    211Right2
    30blankLeft5
    310Left4
    401Right2

    Shorthand way to describe the program:
    (1,0,0,R,2)
    (2,0,0,R,3)
    (2,1,1,R,2)
    (3,0,b,L,5)
    (3,1,0,L,4)
    (4,0,1,R,2)

    Note: If a combination is ever reached for which no rule is given, the machine simply halts.

    Let's execute the program on a sample input:

    0 1 0 1 1 0     <--  current location is in bold
    1               <--  this is the current state
    
    [continue the example]






    If we can figure out the method to the madness, here's what the program does:
    It adds two numbers together, where the two numbers are originally written in unary and delimited by zeros.

    e.g.
    010110 --> 01110       as 1 + 2 = 3
    01110110 --> 0111110   as 3 + 2 = 5
    
    If we look back at the program, we see:
    (1,0,0,R,2)  -- move right, past the first 0
    (2,0,0,R,3)  -- we've come to the end of a string of 1s
    (2,1,1,R,2)  -- move to right past all the 1s
    (3,0,b,L,5)  -- we've moved past the last 1 -- done
    (3,1,0,L,4)  -- just hit the second string of 1s; shift the 0
    (4,0,1,R,2)  -- finish shifting the 0, and go back to state 2
    
    Well...not very special, but it was our first example.

  • comp150 Class Page
    mhg@cs.luc.edu
    Last modified: 17 April 2002