Introduction to the Theory of Computation | Regular Languages
Definition: If is the set of all strings that machine accepts, we say that is the language of machine . We say that recognizes/accept .
Definition: Let and be languages.
- we define union as or
- we define concatenation as and
- we define star as and each \
Deterministic Finite Automaton
Definite: A deterministic finite automaton is a 5-tuple , where
- is a finite set called the states.
- is a finite set called the alphabet.
- is the transition function.
- is the starting state.
- is the set of accept/final states.
Definition: Let be a deterministic finite automaton and let be a string were each is a member of the alphaet . Then aceepts if a sequence of states in exists with three conditions
Nondeterministic Finite Automaton
Definite: A nondeterministic finite automaton is a 5-tuple , where
- is a finite set called the states.
- is a finite set called the alphabet.
- is the transition function. (Here is called the power set of .
- is the starting state.
- is the set of accept/final states.
Definition: Let be a nondeterministic finite automaton and let be a string were each is a member of the alphaet . Then aceepts if a sequence of states in exists with three conditions
Equivalence of Nondeterministic Finite Automaton and Deterministic Finite Automaton
Definition: The subset construction starts from an NFA . Its goal is the DFA such that
- is the set of subsets of
- is the set of states that include at lease on accepting state of .
- For each set and for each input symbol in ,
Proof: If is the DFA constructed from NFA , by the subset construction, then
// TODO
Regular Expressions
Definition: Say that is a regular expression if is
- for some in the alphabet
- , where and are regular expressions
- , where and are regular expressions
- , where 1 is a regular expression
A definition of this type is called an inductive definition.
Equivalence with Finite Automaton
Regular Expressions => Finite Automaton
Say that we have a regular expression describing some language . We show how to convert into an NFA recognizing .
We consider the six cases in the formal definition of regular expressions.
The base cases are:
- : one starting state and one accepting state, with one transition from thpe start to the accepting state corresponding to
- : one starting state that's also accepting
- : no accepting state
The inductive cases are: (We assume and respectively recognizes and
- : a new 'super starting state' with transitions to both starting states of and
- : add transitions from every accepting states of to the starting state of
- : add transitions from every accepting states to the starting state and from the starting state to accepting states
Finite Automaton => Regular Expressions
Definition: A generalized nondeterministic finite automaton is a 5-tuple, , where
- is the finite set of states
- is the input alphabet
- is the transition function
- is the starting state
- is the accepting state
从 DFA 到 Reg:给每个状态编号, 表示中间状态最高到 的路径的正则表示。得到转移方程
从 DFA 到 Reg:通过消除每条初始状态到某个接受状态路径上的状态来构造正则表达式(有多个接受状态的话就有多条路径,最后将每条路径对应的正则表达式合起来 每消除一个状态 就为其每个前驱 及每个后继 添加一条
- 消到最后剩一个开始状态和接受状态,看67页
The Pumping Lemma For Regular Languages
Pumping Lemma states that If is a regular language, then there is a number (called the pumping length) where if is any string in of length at least , then may be divided into three pieces, , satisfying the following conditions:
Proof: Let be a DFA recognizing and be the number of states of . Let be a string in of length , where .
accepts , then there is a sequence of states in . This sequence has length , which is at least .
Among the first elements in the sequence, two must be the same state, by the pigeonhole principle. We call the first of these positioned at and the second .
Then we can spit into where,
- takes from to
- takes from to ( and are the same state
- takes from to which is an accepting state.
which satisfies the 3 conditions:
- is by definition
- is among the first , then .
- will not change the state as a result, then M must accept for all
Regular Languages
Definition: language is called a regular language if some finite automaton recognizes it.
Theorem: THe class of regular language is closed under the union operation
Theorem: THe class of regular language is closed under the concatenation operation
Theorem: THe class of regular language is closed under the star operation