{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

sol06 - CS 154 Intro to Automata and Complexity Theory...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
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 figure 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 figure out. However, suppose the string has even length, so it can be written as ww where | w | = | w | . If w negationslash = 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 negationslash = d . | yx | is of length | x | + | y | = | x | + | y | , so we can divide ww differently, into 1
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
strings 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 differ. Here is a CFG: 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 odd-length strings with a in the middle. Those derived from B are the odd-length strings with b in the middle. The desired
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern