Question

Let G be the CFG: S → aS | Sb | a | b. Show that...

Let G be the CFG: S → aS | Sb | a | b. Show that no string in L(G) contains ba as substring.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

First of all, we can't minimize the given grammar further.

Productions generating terminals are S->a and S->b. Both the productions are not generating 'ba'.

Now, lets assume that no string of length at most k has susbstring 'ba'

Now lets look at the string generated with length k+1.

Step 1 in the derivation must be S->aS or S->Sb.

If the derviation is S->aS then we will be able to generate the strings of kind a*S untill we stop reducing S with the production S->aS. Next if you take S->b or S->a or S->Sb, either of them produces a string containing ba.

If the derviation is S->Sb then we will be able to generate the strings of kind Sb* untill we stop reducing S with the production S->Sb. Next if you take S->b or S->a or S->Sb, either of them produces a string containing ba.

Hence the given CFG wont generate the strings containing 'ba'

Add a comment
Know the answer?
Add Answer to:
Let G be the CFG: S → aS | Sb | a | b. Show that...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT