-
Let and languages. We define the regular operations as follows:
- Union:
- Concatenation:
- Kleene Star:
-
A language is called a regular language if some finite automaton recognizes it.
-
(1.45,7,9) The class of regular languages is closed under the union, concatenation, and Kleene star operations. That is, if and are regular languages, then so are
-
(1.40) A language is regular iff some NFA recognizes it.
-
(1.54) A language is is regular iff some regular expression describes it.
-
(1.70, Pumping Lemma) If is a regular language, then there exists a number (the pumping length) such that every string of length at least , can be written as , satisfying the following conditions:
Finite Automata
- A deterministic finite automaton (DFA) is a 5-tuple
- is a finite set of states
- is an alphabet
- is a transition function
- is the start state
- is the set of accept states
- A nondeterministic finite automaton (NFA) is a 5-tuple
- is a finite set of states
- is an finite alphabet
- is the transition function
- is the start state
- is the set of accept states
- (1.39) Every NFA has an equivalent DFA.
- (exercise 1.11) Every NFA can be converted to an equivalent one that has a single accept state.
Regular Expressions
- Say that is a regular expression if is one of the following:
- for some
- , where and are regular expressions
- , where and are regular expressions
- , where is a regular expression
- A regular expression represents the language as follows:
DFA to Regular Expression
GNFA
- A generalized nondeterministic finite automaton (GNFA) is a 5-tuple, , where
- is the finite set of states
- is the input alphabet
- is the transition function (where is the set of all regular expressions over )
- is the start state
- is the accept state
- A GNFA accepts a string if , where and there exists a sequence of states such that:
- For each , we have , where ;
DFA to GNFA
- Let be a DFA.
- We can construct a GNFA as follows:
- For each ,
- If any arrows have multiple labels (or if there are multiple arrows going between the same two states in the same direction), we replace each with a single arrow whose label is the union of the previous labels
- We add arrows labelled with between states that has no arrows.
GNFA to Regular Expression
The procedure is used to convert a GNFA into a regular expression .
- :
- Let be the number of states in
- If , then must consist of a single transition from the start state to the accept state, and the regular expression is simply the label of that transition. Return
- If , then:
- Select any different from and
- Let be the GNFA , where:
- For every , and every :
- Return
Regular Grammar
- A regular grammar is a formal grammar in which each production rule is one of the following forms: (where and )
- Every regular language is generated by a regular grammar.
- Every regular grammar generates a regular language.
Non-Regular Languages
- A language is non-regular if it is not regular.
- The class of non-regular languages is closed under the complement operation.