# How to show that the regular language is closed under the complementary operation?

Data Structure AlgorithmsComputer ScienceComputers

#### Big Data Hadoop

Best Seller

89 Lectures 11.5 hours

#### Practical Data Science using Python

22 Lectures 6 hours

#### Data Science and Data Analysis with Python

50 Lectures 3.5 hours

Closure property is a technique to understand the class of the resulting language when we are performing an operation on two languages of the same class.

That means, suppose L1 and L2 belong to regular language and if regular language is closed under operation ∪, then L1∪L2 will be a Regular language. But if RL is not closed under ∩, that doesn't mean L1∩L2 won't be a RL.

For a class to be closed under an operation, it has to hold true for all languages in that class. So, if a class is not closed under an operation, we cannot say anything about the class of the resulting language of the operation – it may or may not belong to the class of the operand languages.

In brief we can say that, closure property is applicable, only when a language is closed under an operation.

Now let us prove that the regular language is closed under the complementary operation −

## Problem

Let the complementary Operation (COR) of two sets is defined as −

COR(A, B) = {x : x ∉ A or x ∉ B }, we need to show that the regular language is closed

under the COR operation.

## Solution

Let A and B be regular languages.

COR(A, B) = {x : x ∉ A or x ∉ B }

=> { x : x ∈ A's Complement } ∪ {x : x ∈ B's Complement}.

If A and B are regular,

let M1 = (Q1, ∑, δ1, q0, F1) and

M2 = (Q2, ∑, δ2, p0, F2) be DFAs that accept A and B.

Then the DFAs M1's Complement = (Q1, ∑, δ1, q0, Q1 − F1) and M2's Complement = (Q2, ∑, δ2, p0, Q2 − F2) accept A's Complement and B's Complement.

Thus, { x : x ∉ A } and { x: x ∉ B } are regular.

Then by the results of the last problem, we know that the family of regular languages is closed under finite union.

Therefore, we conclude that COR(A,B) is regular