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.
List and describe three graphical languages encountered under IEC 61131-3
List and describe three graphical languages encountered under IEC 61131-3
Use the pumping lemma to show that the following languages are not regular. b. A2 =...
Use the pumping lemma to show that the following languages are not regular. b. A2 = {www| w € {a, b}*}
(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.
if the state space s is finite, show that there must exist at least one closed...
if the state space s is finite, show that there must exist at least one closed communicating class. give an example of a transistion matrix with no such class
Let F be the set of all finite languages over alphabet {0, 1}. Show that F...
Let F be the set of all finite languages over alphabet {0, 1}. Show that F is countable
In the context of the housing sale or rentals, under what specific circumstance may one discriminate...
In the context of the housing sale or rentals, under what specific circumstance may one discriminate against members of a "protected class" in seeming violation of Title VII of the Civil Right? In your opinion, should this exception be abrogated and why.
Prove that the intersection of a CFL and a Regular language is always context free. I...
Prove that the intersection of a CFL and a Regular language is always context free. I was thinking representing the CFL as a PDA, and the regular language as a DFA, then - if they both accept at the same time, the intersection must be context free?
Determin if the following sets of numbers are closed under the given operation. Question 2 options:...
Determin if the following sets of numbers are closed under the given operation. Question 2 options: Even numbers under the operation of division Multiplies of the number 3 under the operation of subtraction Negative numbers under the operation of multiplication 1. Closed 2. Not Closed