Because languages are sets, and regular languages are a type of language, we can perform set operations on regular languages. These operations allow us to create new languages from existing ones.
Today we will look at some set operations as applied to regular languages, and consider whether regular languages are closed under these operations.
The term closure refers to whether operations on something always produce the same sort of thing.
For instance integers are closed under multiplication because if we multiply two integers together, we always get another integer. However integers are not closed under division because we sometimes when we divide two integers, the result is not an integer.
When we say that regular languages are closed under some operation, we mean that the operation will always produce another regular language as the result.
The complement of a language $L$ (often written as $\overline{L}$) is the set of all strings not in $L$. For example:
Given any regular language $L$, is its complement also guaranteed to be a regular language?
Yes:
This proof by construction shows that we can construct a DFA to recognize the complement of any regular language. Therefore the complement of any regular language is also regular, so the class of Regular Languages are closed under complement.
The union of two languages is simply the set of words that belong to either one language or the other (or both).
If:
What is $A \cup B$?
Can we build a DFA that recognizes $A \cup B$?
If $A_1$ and $A_2$ are regular languages, then so is $A_1 \cup A_2$.
To prove this, we use the following argument:
$M$ will work by simulating both $M_1$ and $M_2$ at the same time:
For example, if $M_1$ is the following machine:
And $M_2$ is the following machine:
Are regular languages closed under intersection? How can we show it?
If:
What is $A \circ B$ ?
If:
What is $A\ast$?
The class of regular languages are closed under both concatenation and star, but the proofs are difficult without non-determinism which we will look at next time.
Copyright © 2024 Ian Finlayson | Licensed under a Creative Commons BY-NC-SA 4.0 License.