What are the closure properties of regular languages?
Overview
We define closure as a set of things. We describe closure properties of regular languages as the operations implemented on regular languages which ensure that a new regular language will be produced.
Properties of regular languages
All regular languages are closed under the mentioned operations. These operations are as follows:
- Kleen star closure
- Union
- Intersection
- Concatenation
- Complement
- Reversal
- Difference
- Homomorphism
- Inverse homomorphism
Explanation
Let's go over a detailed explanation of the closure properties of regular languages.
Kleen star closure
If a language
The process for Kleen star closure
To implement Kleen star closure on the language
- Make a finite automaton for the language.
- Create a new start state. Join it to the original start state with a null transition.
- Create a new final state. Join the original final state to the new final state with a null transition. The original final state will now not be a final state anymore.
- Make a null transition from the new final state to the new start state.
We can illustrate this process in the following way:
Union
Let's assume there are two regular languages,
We can represent union as
The process for union
Let's assume there are two languages,
- Make the finite automaton for both
and separately. - Add a new start state. Join the new start state to the automata's original start states by null transitions.
The final states remain the same as for the two automata.
Intersection
If there are two languages,
The intersection is checked by De Morgan's law, which states the following:
The process for the intersection
The process for the intersection is slightly different from other properties. The steps to implement intersection are as follows:
- Make the automatons for both languages.
- Take the cross-product of all states from both the automatons.
- The final state is the one that has the final state of the first automaton and the second automaton.
We can see this in the illustration below:
Concatenation
For concatenation, let's assume there are two regular languages,
The process for concatenation
Assume that there are two languages,
- Make the finite automaton for both
and separately. - Suppose the order of concatenation is
. Make a null transition from the final state of to the starting state of . Make the final state of nonfinal.
The final state of
Complement
The process for the complement
There is one step for the complement process:
- Make the accepting states non-accepting and vice versa.
We can see this in the illustration below:
Reversal
Let's assume a regular language,
The process for reversal
To reverse a language, we perform the following the steps:
- Make a definite finite automaton for the regular language.
- Make the final state the new initial state and the initial state the new final state.
- Reverse the direction of the transitions.
If there are
Difference
Consider the two languages,
This difference is
The process for difference
The process to take the difference between the two languages is as follows:
- Make the automatons for the regular languages,
and . - Take the complement of the second language (the language that is to be subtracted,
in this case). The steps for complement are explained before. - Take the intersection of the language
and .
Homomorphism
Homomorphism is allowing a string for each input symbol of a language.
For a regular language,
The process for homomorphism
Homomorphism is closed under regular languages. The algorithm is defined for the regular expression of the language.
- Define homomorphism as the operation on the regular expression of a regular language,
. - Prove that
. - Assume
is such that . Let , and resultantly .
Example
Suppose that
Let a regular expression of a regular language be
Then,
By equating, we see that
Inverse homomorphism
Consider
The process for inverse homomorphism
To prove inverse homomorphism, we perform the following steps:
- Make a definite finite automaton,
, of . - Construct another definite finite automaton
such that it accepts
The intuition behind this is that on the input,
Example
Let
Let the language
Let the string be
Let another string be
Free Resources