Complement of a regular language
Let L be a regular language. We will prove that the complement of the language L is again a regular language.
What the complement is
By the complement of a language L we mean all the strings that are not in the language L. We write the complement as Lc. That is, for an alphabet Σ:
For example, for the language of strings containing at least one symbol 1, the complement would be the language of strings that contain no symbol 1 at all.
Construction
The construction is very simple. We have a regular language L and a deterministic complete automaton A = ⟨Q, Σ, δ, q0, F⟩ that accepts it (every finite automaton can be converted to one). We construct the automaton Ac, which accepts Lc, by swapping the accepting and non-accepting states: Ac = ⟨Q, Σ, δ, q0, Q ∖ F⟩. That is all.
Example
Let this be our automaton:
The automaton accepting the complement of the language would look like this:
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