This preview shows pages 1–3. Sign up to view the full content.
CS 154 Intro. to Automata and Complexity Theory Handout 38
Autumn 2009
David Dill
December 4, 2008
Solution Set 7
Problem 1
There is no reliable method for doing this, but you can Fgure it out from examples
(see how the book does it for expression grammars).
The sentence symbol is
R
:
R
→
R
+
P

P
P
→
P
·
K

K
K
→
K
∗ 
(
R
)
∅
e

a

b
R
P
K
K
*
(
R
)
R
+
P
P
P
.
K
K
a
K
a
b
Problem 1’
A string is not of the form
ww
if it is of odd length, or (if

w

=
n
) there is a mismatch at
positions
i
and
n
+
i
where 1
≤
i
≤
n
.
The second condition is the hardest to Fgure out. However, suppose the string has even length,
so it can be written as
ww
′
where

w

=

w
′

. If
w
n
=
w
′
then
w
=
xcy
and
w
′
=
x
′
dy
′
where the
only conditions on
x
,
y
,
x
′
,
y
′
are arbitrary strings over
{
a,b
}
where

x

=

x
′

and

y

=

y
′

and
c,d
∈ {
a,b
}
and
c
n
=
d
.

yx
′

is of length

x
′

+

y

=

x

+

y
′

, so we can divide
ww
′
di±erently, into
1
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Documentstrings
xcu
and
vdy
′
where
uv
=
yx
′
and

u

=

x

and

v

=

y
′

.
xcu
and
vdy
′
are thus any strings
of odd length whose middle symbols diFer.
Here is a C±G:
A
→
aAa

aAb

bAa

bAb

a
B
→
aBa

aBb

bBa

bBb

b
S
→
A

B

AB

BA
S
is the sentence symbol. The strings derived from
A
are all the oddlength strings with
This is the end of the preview. Sign up
to
access the rest of the document.
 '08
 Motwani,R

Click to edit the document details