The Computational Beauty of Nature — Spring 2020

Problem Set 4: Turing Machines

Due by class time Tuesday, March 31

For these exercises, you are required to submit your answers in the form of a single Microsoft Word document. A PDF file is not acceptable. (I need to be able to copy-and-paste your Turing machine rules for testing purposes, and PDF files make this too difficult.)

Reading for this week

Exercises

  1. Finish exercises 5, 6, 8, 10, 12, 14, and 18 of the Turing machine lab worksheet (Lab 5). For each of your Turing machines, label it clearly, and include its complete rule table with the columns in the standard order shown below:

    Current state     Current symbol     New symbol     Move     New state
  2. Design a Turing machine that takes a single string of 0's and 1's as input and replaces the string with its reversal — meaning the same string running in the opposite direction. (Note that this does not mean that the 1's and 0's just get flipped; rather, the direction of the string should be reversed.) For example, the reversal of 100111 is 111001 (not 011000). If the machine starts with 100111 on its tape, with the read/write head positioned on the leftmost 1, it should eventually halt with just the string 111001 left on the tape. The exact location of the final string on the tape does not matter, as long as no other symbols remain (except for blanks).

Challenge Problem (extra credit)

  1. Construct a Turing machine to do the following: Assume that the machine is started on a tape that contains nothing but a block of a's and b's in some random order. (The machine must work for any such sequence, including sequences containing only a's or only b's.) The machine is started on the leftmost symbol of this sequence. The purpose of the machine is to sort the a's from the b's. For example, given the input aababbabaa, the machine should change the tape to read aaaaaabbbb. Given the input bbbabba, the output should be aabbbbb. Given the input bbb, the output should be bbb. The output string does not have to be in the same place on the tape as the input string, but it should be the only thing on the tape when the machine halts.