CpSc 421
Homework 10
Solutions
Attempt any
three
of the
six
problems below. The homework is graded on a scale of 100 points, even though you can
attempt fewer or more points than that. Your recorded grade will be the total score on the problems that you attempt.
1. (
20 points
, Sipser problems 5.17 and 5.18)
(a) (
10 points
) Prove that the Post Correspondence Problem is decidable if the alphabet is unary, i.e.,
Σ =
{
1
}
.
Solution (sketch): if the PCP instance has a tile of the form
1
i
1
i
, then that tile solves the problem. Other
wise, if there is at least one tile of the form
1
i
1
j
with
i > j
and one with
i < j
, then it is straightforward
to solve the problem. Finally, if all tiles have more
1
’s on the top than on the bottom (or all have more on
the bottom than on the top), then the problem is not solvable.
(b) (
10 points
) Prove that the Post Correspondence Problem is undecidable if the alphabet is binary, i.e.,
Σ =
{
0
,
1
}
.
Solution (sketch): Consider any instance of
PCP
with some alphabet,
Σ
1
. Let
k
=
log
2

Σ
1

. We can
encode each symbol of
Σ
1
with
k
symbols of
{
0
,
1
}
. With this encoding, every tile will a top string whose
length is a multple of
k
and likewise for the bottom string. This ensures that the strings of
{
0
,
1
}
that
encode symbols of
Σ
1
will stay properly aligned, and the new, binary, problem is solvable iff the original
problem is solvable.
2. (
30 points
, Sipser problem 5.21) Let
AMBIG
CFG
=
{
G

G
describes an ambiguous CFG
}
.
Show that
AMBIG
CFG
is undecidable. (Hint: Use a reduction from
PCP
. Given a PCP instance
P
=
t
1
b
1
,
t
2
b
2
, . . . ,
t
k
b
k
,
construct a CFG
G
with the rules
S
→
T

B
T
→
t
1
T
a
1

. . .

t
k
T
a
k

t
1
a
1

. . .

t
k
a
k
B
→
b
1
B
a
1

. . .

b
k
B
a
k

b
1
a
1

. . .

b
k
a
k
,
where
a
1
. . .
a
k
are new terminal symbols. Prove that this reduction works.)
Solution (sketch): If the PCP problem has a solution,
i
1
,
i
2
, . . .
i
m
such that
t
i
1
t
i
2
. . . t
i
m
=
b
i
1
b
i
2
. . . b
i
m
, then
S
⇒
T
*
⇒
t
i
1
t
i
2
. . . t
i
k
a
i
k
. . .
a
i
2
a
i
1
and
S
⇒
B
*
⇒
b
i
1
b
i
2
. . . b
i
k
a
i
k
. . .
a
i
2
a
i
1
. Because
t
i
1
t
i
2
. . . t
i
m
=
b
i
1
b
i
2
. . . b
i
m
, these two derivations produce the same string. Thus,
G
is ambiguous.
Now, I’ll show that if
G
is ambiguous, then the PCP problem has a solution. The critical observation is that a
grammar with starts symbol
T
and has the rules given above is unambiguous, as there is only one way to get
any suffix of
a
i
symbols. Likewise, a grammar that starts with
B
is unambiguous. So, if
G
is ambiguous, there
must be a string,
x
∈
L
(
G
)
such that
S
⇒
T
*
⇒
x
and
S
⇒
B
*
⇒
x
. The derivation gives a solution to the PCP
problem (in fact, the solution is the reverse of the string of
a
i
’s at the end of
x
).
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.
 Spring '09
 Li
 Collatz conjecture, polynomial time

Click to edit the document details