Computer Science 340
Reasoning about Computation
Homework 10
Due at the beginning of class on Wednesday, December 5, 2007
Problem 1
Give an implementation level description of a Turing machine that decides the following
language over alphabet
{
0
,
1
}
:
{
w

w
does not contain twice as many 0
s
as 1
s
}
.
Read the Section on “Terminology For Describing Turing Machines” in the notes (pages
144147) in order to clarify what an implementation level description is.
Solution:
I assume the start of the tape is marked by a
$
, and that
#
represents a blank. The string
lies somewhere on the tape and all the other characters are blanks.
We start from the beginning and go right so that we either reach a blank (end of the
string) or a
1
. In the former case, we check the tape again to see if there was any
0
’s there
(ACCEPT) or not (REJECT). In the latter though, i.e. if we found a
1
, we cross it out by
substituting an
X
for it. After that we go back to the start (by looking for
$
and then by
moving to the right, we look for
0
’s and we cross out at most two of them. If we couldn’t
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview.
Sign up
to
access the rest of the document.
 Fall '07
 CharikarandChazelle
 implementation level description

Click to edit the document details