TOC-Regular language
Regular Language
+ Def: regular language
A language is regular if it is recognized by a DFA or an NFA.
To Prove a Language is regular, we need to construct a DFA or an NFA for the language.
Regular Operations
+ Def: Let $A$ and $B$ be languages.
- Union :
- Concatenation:
Star
Note: each
+ Def: Star operator
Let
$$A^{*} = \cup_{i\in \mathbb{N}} A^{i}$$
Complement
Let
Note:
is the set difference. is the set complement.
The goal
Thus, we need to prove
(
Assume
Then
Thus, DFA
In other words, DFA
By the construction of
Thus,
(
Assume
DFA
In other words, DFA
By the construction of
Thus,
Thus,
Let
Closure
+ Theorem (Closure)
Regular language is closed under union, concatenation, star and complement.
if A and B are two regular languages, then

Construct an NFA for .

Construct an NFA for .

Construct an NFA for .

Regular Expression
Regular languages can be recursively constructed. A regular expression describes the common pattern the strings in a regular language (machine independent).
+ Def: [[Regular Expression|Regular expression]] (Recursive Definition)
for some , , or
, where and are regular expressions, , where and are regular expressions, or , where is a regular expression.
Languages Defined by Regular Expression
+ Def: Let $R$ be a [[Regular Expression|regular expression]]. The language $L(R)$ defined by $R$ is
, , , .
- if
, then - if
, then - if
, then
Example:
Suppose
Match nothing
Equivalence of Regular Expression and Finite Automata
+ Theorem
Regular expressions are equivalent to finite automata.
The proof has two steps.
- The language defined by a regular expression can be recognized by a finite automaton.
- The conversion is also doable vice versa.
The conversion from a regular expression to an NFA is trivially ensured by the closure property . So, we only need to convert NFA to regular expressions.
Conversion from NFA to Regular Expression
The Conversion requires generalized NFA, which is a special type of NFA.
Only one start state and one final state. The start state is different from the final state. The transition function is
Suppose
- It means transition from
to requires . - If the GNFA has only 2 states
and , then the label on the transition is the regular expression for the language. - Thus, the conversion recursively merges states and transitions of the generalized NFA.
Algorithm 2 Convert NFA to 2-state gNFA
Input: An NFA
Output: A regular expression which defines
1: // convert the domain and codomain of the transition function
2:
3:
4:for all do
5:
6:end for
7:for all state in except and do
8:
9:for all state in except do
10:for all state in except do
11:Suppose , , , and
12:
13:end for
14:end for
15:end for
16:return