What are the closure properties for context free language?

Data Structure AlgorithmsComputer ScienceComputers

The closure properties for context free language (CFG) are as follows −

Closed under Union Operation

n order to show that context-free language is closed under union operation, consider two starting variables S1 and S2 for the two different languages L1 and L2.

Grammar for union operation is as shown below −

S ->S1|S2

If both the languages belong to the context free language then union of both the languages should belong to context free language.

By the above definition if a user generates S1 and S2 string or both then in that case union of both the language is generated.

Hence, L1 U L2 ∈ CFL

So, context free language is closed under union operation.

Closed under Concatenation

In order to show that context free language is closed under concatenation, the operation considers two starting variables S1 and for the two different languages L1 and L2.

Grammar for union operation is as shown below −

S->S1S2−

If both the language belongs to the context free language then concatenate one of both the language should belong to context free language.

∀L1L2∈CFL

{W1W2:W1∈L1∈ΛW2∈L2}∈CFL

By the above definition if a user generates S1 string for language L1 followed by S2 string of language. Then, its concatenation of both languages is generated.

Hence, the result is as follows −

{W1W2:W1∈L1∈ΛW2∈L2}∈CFL

So, context free language is closed under concatenation operation.

Closed under Star operation

In order to show that context free language is closed under star operation. Consider one start variable S1 for the languages L1

Grammar for union operation is as shown below −

S->S1S| ∈

If the language belongs to the context free language then the star of the language should belong to the context free language.

∀L1∈CFL

By the above definition, if the user generates zero or many strings which is the definition of the star. So, context free language is closed under star operation.

raja
Published on 16-Jun-2021 12:35:34
Advertisements