Kleene closure of a regular language
Let L be a regular language. We will prove that the Kleene closure of the language L is again a regular language.
What the closure of a language is
We write the Kleene closure of a language L as L∗. The closure contains all the strings that can be built by concatenating a finite number of strings from the language L. We can define the closure as:
where ∘ denotes the operation of concatenation. The closure also contains the empty string, that is, ϵ.
Formal construction
We proceed in a very similar way to the case of the concatenation of languages. Instead of joining two different automata, we join one automaton to itself – from the accepting states of the automaton we add epsilon transitions to its start state. However, the closure must also contain the empty string. How can we arrange that? We could make the start state an accepting state. Then the automaton would accept the empty string, but it might also accept some other strings. So instead we create a new start state and add an epsilon transition from this new start state to the original start state.
Let L1 be a regular language and let this automaton accept it:
We construct a non-deterministic automaton A = ⟨Q, Σ, δ, qs, F⟩ for which the following holds:
- Q = Q1 ∪ {qs}
- Σ= Σ1
- F = F1 ∪ {qs}
We define the transition function δ as follows:
Example
Let A1 be this automaton, which accepts the strings 00 or 11:
The closure of the language L(A1) is therefore the language of all strings made up of pairs 00 and 11, for example 0000, 110011, 11110000 and so on. We would build an automaton accepting this closure by creating a new start state qs with an epsilon transition to the former start state q0, and by adding epsilon transitions from the states q3 and q4 to the state q0:
We can check that this automaton really does accept the strings 0000, 110011 and 11110000, but does not accept, for instance, the string 1010.
Sources
Chapters: Closure of regular languages, Union of regular languages, Intersection of regular languages, Difference of regular languages, Complement of a regular language, Concatenation of regular languages, Kleene closure of a regular language