What are the closure properties of Regular languages?

Data Structure AlgorithmsComputer ScienceComputers

In an automata theory, there are different closure properties for regular languages. They are as follows −

  • Union
  • Intersection
  • concatenation
  • Kleene closure
  • Complement

Let see one by one with an example

Union

If L1 and If L2 are two regular languages, their union L1 U L2 will also be regular.

Example

L1 = {an | n > O} and L2 = {bn | n > O}

L3 = L1 U L2 = {an U bn | n > O} is also regular.

Intersection

If L1 and If L2 are two regular languages, their intersection L1 ∩ L2 will also be regular.

Example

L1= {am bn | n > 0 and m > O} and

L2= {am bn U bn am | n > 0 and m > O}

L3 = L1 ∩ L2 = {am bn | n > 0 and m > O} are also regular.

Concatenation

If L1 and If L2 are two regular languages, their concatenation L1.L2 will also be regular.

Example

L1 = {an | n > 0} and L2 = {bn | n > O}

L3 = L1.L2 = {am . bn | m > 0 and n > O} is also regular.

Kleene Closure

If L1 is a regular language, its Kleene closure L1* will also be regular.

Example

L1 = (a U b )

L1* = (a U b)*

Complement

If L(G) is a regular language, its complement L'(G) will also be regular. Complement of a language can be found by subtracting strings which are in L(G) from all possible strings.

Example

L(G) = {an | n > 3} L'(G) = {an | n <= 3}

Note − Two regular expressions are equivalent, if languages generated by them are the same. For example, (a+b*)* and (a+b)* generate the same language. Every string which is generated by (a+b*)* is also generated by (a+b)* and vice versa.

raja
Published on 12-Jun-2021 11:03:33
Advertisements