Review for Mid-Term

From the Notes on Ambiguity (13)

HW Due Sept 29: Are Context Free Grammars sufficent to capture the usual precedence rules for $\QTR{Large}{+\ }$and $\QTR{Large}{\ast }$ without ambiguity?

MATH

MATH

MATH

____________________________________________________________________________________

From the Proof of the CFLPumpingLemma (15)

Since G is in Chomsky Normal Form the tree looks like MATH.

With either MATHor MATH(or both). (Home Work Due Sept 29: How could one be zero?)

But then, by substituting MATH ,

(Home Work Due Sept 29: How could we choose B so as to guarantee 3. in the statement of the Theorem? Note that we do not use this in our applications)

See The Proof

___________________________________________________________________

From the Text:

Page 88 Problem 1.25

The strings are

MATH

MATH

the states are

MATHwhere represents an invalid binary addition.

The start state is MATH

The only accepting state is MATH . If we reach it at the end of the string it means that there is no carry hence the binary addition is correct.

Finally

MATH MATH MATH MATH
MATH MATH MATH MATH
MATH MATH MATH MATH
MATH MATH MATH MATH
MATH MATH MATH MATH
MATH MATH MATH MATH
MATH MATH MATH MATH
MATH MATH MATH MATH
MATH MATH MATH MATH

where

MATH reads MATH

and

MATHreads MATH is not a valid binary add.

Page 129 Problems 2.8 ,

the girl touches the boy with the flower

__________________________________________

2.9

Show MATH or $\QTR{Large}{j=k}$ where MATH is a CFL.

MATH

MATH

MATH

MATH

MATH

The language is ambiguous. Look at strings of the form MATH

___________________________________________

2.14

Convert to Chomsky Normal Form.

MATH

MATH

I am assuming that $\QTR{Large}{A}$ is the starting state.

  1. Add a new starting state.

    MATH

  2. Remove rules MATH and MATH

    MATH

    MATH

    MATH

  3. Remove MATH

    MATH

    MATH

    MATH

  4. Remove terminals from strings of length MATH

    MATH

    MATH

    MATH

    MATH

  5. Shorten long production strings.

    MATHbecomes

    MATH

    MATH

    and

    MATHbecomes

    MATH

    MATH