CS 454, Section 001 | Sonoma State University | Spring, 2024 |
Theory of Computation
|
||
Instructor: Henry M. Walker
Lecturer, Sonoma State University |
Although much of this course has been well developed in recent semesters, the SSU CS faculty recently have approved an updated course description. Also, the required SSU Signature Project for SSU's Upper Division GE Area B Requirement for CS Majors has been rethought for this course. Currently, the Web site is reasonably stable, but modest refinements are likely. Check these pages regularly for adjustments.
Since May, 2024, the California Faculty Association (CFA) – the labor union of professors, lecturers, librarians, counselors, and coaches across the 23 California State University campuses – has been in negotiations with the management of the California State University System. After a one-day strike on Monday, January 22, the two sides have reached a tentative agreement, and the strike has been called off. Effective Tuesday, January 23, SSU classes (including CS 454) will be held as scheduled.
Shifting a String Right: Consider the problem of shifting a string on a tape right by one character, placing a space or blank at the original first position.
One solution of this problem, apparently by Bhanu Priya on Tutorials Point, presents a Turing machine to solve this problem over the alphabet Σ = {0,1} by moving to the right end of the string and then moving backward—shifting each character one position to the right.
In reviewing the operation of this Turing machine from Tutorials Point,
The given solution works with strings of binary numbers and requires 6 states for the Turing machine. Suppose the problem were expanded to include strings of decimal numbers.
How would the Tutorials Point Turing machine need to be changed to include decimal integers? That is,
In each case, justify your answer.
Note In this part you are NOT asked to write out the full, revised Turing machine. Rather, you need to explain what each state represents, and describe how processing would proceed.
The given Turing machine over the alphabet Σ = {0, 1} first moves to the right end of the string and then works backward, moving each character one position at a time. Can this problem be solved (for binary numbers) with a single pass from left to right?
Adding 1 in binary: This problem considers algorithms implemented on a Turning Macine, that are supposed to add 1 to a non-negative binary integer. More precisely, at the start of processing, a non-negative binary integer is to appear at the start of an input tape, and at the end of processing, the incremented positive binary integer should appear at the start of the tape. At the end of processing, no other non-blank systems should be present on the tape.
As might be expected, many such algorithms are discussed on the Web.
Before proceeding, some notes are needed regarding how the tape of a Turing machine works.
Now consider three proposed algorithms to solve the problem of adding 1 to a non-negative binary integer.
Within computers, numbers are represented in a binary format—that is, numbers are notated with just two symbols: 0 and 1. For this exercise, only non-negative numbers are considered. For those unfamiliar or uncomfortable with non-negative binary integers, many references are available on the Web, including the following:
Analyze a Given Turing Machine: Consider a Turing machine with an input of non-negative decimal integers. That is, the input alphabet is Σ = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} and uses the following transition function. (In this table, "sp" represent a space or blank character. Also, * is a tape symbol that is not in the input alphabet.)
Input Character | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Notes | state | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | * | sp (for space or blank) |
start | q0 | q3, *, R | q1, *, R | q2, *, R | q3, *, R | q1, *, R | q2, *, R | q3, *, R | q1, *, R | q2, *, R | q3, *, R | q7, 0, R | q7, 0, R |
q1 | q1, 1, R | q2, 2, R | q3, 3, R | q1, 1, R | q2, 2, R | q3, 3, R | q1, 1, R | q2, 2, R | q3, 3, R | q1, 1, R | q7, 1, R | q4, sp, L | |
q2 | q2, 2, R | q3, 3, R | q1, 1, R | q2, 2, R | q3, 3, R | q1, 1, R | q2, 2, R | q3, 3, R | q1, 1, R | q2, 2, R | q7, 2, R | q5, sp, L | |
q3 | q3, 3, R | q1, 1, R | q2, 2, R | q3, 3, R | q1, 1, R | q2, 2, R | q3, 3, R | q1, 1, R | q2, 2, R | q3, 3, R | q7, 3, R | q6, sp, L | |
q4 | q4, sp, L | q4, sp, L | q4, sp, L | q4, sp, L | q4, sp, L | q4, sp, L | q4, sp, L | q4, sp, L | q4, sp, L | q4, sp, L | q7, 1, R | q7, sp, R | |
q5 | q5, sp, L | q5, sp, L | q5, sp, L | q5, sp, L | q5, sp, L | q5, sp, L | q5, sp, L | q5, sp, L | q5, sp, L | q5, sp, L | q7, 2, R | q7, sp, R | |
q6 | q6, sp, L | q6, sp, L | q6, sp, L | q6, sp, L | q6, sp, L | q6, sp, L | q6, sp, L | q6, sp, L | q6, sp, L | q6, sp, L | q7, 0, R | q7, sp, R | |
accept | q7 | accept |
For this Turing machine, assume all inputs are valid non-negative decimal integers (e.g., without embedded spaces and without non-digit characters).
created Fall, 2023 revised Fall, 2023 |
|
For more information, please contact Henry M. Walker at walker@cs.grinnell.edu. |