Question

Show that the class of context-free languages is closed under concatenation.

Show that the class of context-free languages is closed under concatenation.

Homework Answers

Answer #1

Let L1 and L2 are context free languages. Context free grammar for L1 and L2 are G1 and G2 respectively.

If starting symbols of G1 and G2 are S1 and S2, then for two grammars to be concatenated, we can create a new start symbol with production as S-> S1S2. The result grammar will a new CFG which generates the concatenation of L1 and L2. Therefore, concatenation is closed in Context-free languages.

For example, L1 = {anbn | n >=0} and L2 = {wwr | w belongs to (a,b)}

The G1 will be:

S1 -> aS1b | Λ

And G2 is :

S2 -> aS2a | bS2b | Λ

And resultant grammar for L1.L2 will be:

S -> S1S2

S1 -> aS1b | Λ

S2 -> aS2a | bS2b | Λ

Know the answer?
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
Similar Questions
Using the pumping lemma for context free Languages to prove L is not context free. L...
Using the pumping lemma for context free Languages to prove L is not context free. L = { w#w#w | w E (0+1)*} Are the used variables {0,1,#}
Prove that regular languages are closed under the set dierence operation. That is, if A and...
Prove that regular languages are closed under the set dierence operation. That is, if A and B are regular languages, then, A - B is also a regular language.
Show that if languages L1 and L2 are decidable, then concatenation of L1 and L2 is...
Show that if languages L1 and L2 are decidable, then concatenation of L1 and L2 is also decidable.
Please make a Context Free Grammar (CFG) for the regular languages below: The language that is...
Please make a Context Free Grammar (CFG) for the regular languages below: The language that is in C++ and containing lowercase and upper case letters, and also can have digits, and can also contain the underscore character '_', and it must begin with an underscore or a letter.
prove that the language L over {c,d,e} is not context free. (using pumping lemma for context...
prove that the language L over {c,d,e} is not context free. (using pumping lemma for context free languages) L= {w ∈ {c,d,e}* : number of c's, number of d's, and number of e's have a common factor greater than 1}
Draw the state diagram of DFAs recognizing the following languages. a. A = {w|w starts with...
Draw the state diagram of DFAs recognizing the following languages. a. A = {w|w starts with 0 and has odd length, or starts with 1 and has even length} b. B = {w|w is any string except 11 and 111} c. C = {, 0} Example of set difference: A = {0, 01}, and B = {0, 11}. Then, A − B = {01}. Prove that regular languages are closed under the set difference operation. That is, if A and...
Find context-sensitive grammars for the following languages: (a) L = {anbncndn : n≥1}
Find context-sensitive grammars for the following languages: (a) L = {anbncndn : n≥1}
List and describe three graphical languages encountered under IEC 61131-3
List and describe three graphical languages encountered under IEC 61131-3
Show that if languages L1 and L2 are decidable, then the intersection of L1 and L2...
Show that if languages L1 and L2 are decidable, then the intersection of L1 and L2 is also decidable.
(a) Suppose Ireland moves from autarky to free trade. Ireland imports shoes under free trade. Show...
(a) Suppose Ireland moves from autarky to free trade. Ireland imports shoes under free trade. Show graphically the change to domestic Irish consumer surplus, producer surplus and total surplus. (b) Suppose South Africa moves from autarky to free trade. South Africa exports machinery under free trade. Show graphically the change to domestic South African consumer surplus, producer surplus and total surplus.
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT