Regular Languages
Date: 2021-02-04
title: 'Regular Languages' date: '2021-02-04'
Regular Languages
Deterministic Finite Automata
Def:
- (starts in start state)
- (state transition according to
) for - (input ends in accept state)
Def: A language is called regular language if some finite automaton recognizes it.
Design Finite Automata
3 Operations on Languages (Closed under regular operations)
Let
- Union:
- Concatenation:
- Star:
- Empty string
is always in a member of
- Empty string
Closed under Operations
- Union of two alphabets (true if two are different)
Nonderminism
Def:
is finite set of states is a finite alphabet is the transition function is the start state is the end state
Differences bewteen DFA:
- For one single input, transition funciton of NFA can have zero, one or multiple output states
transition: transition without reading any input - The machine splits into multiple copies of itself and follows all the possibilities in parallel. Finally, if any one of these copies of the machine is in an accept state at the end of the input, the NFA accepts the input string.
Think about Nonderminism computation as a tree of all possibilities
Equivalence between NFAs and DFAs
Two machines are equivalent if they recognize the same language.
Let
- For
and , let , aka:
To take
Corollary A language is regular if and only if some nondeterministic finite automaton recognizes it, for
- NFA DFA equivalence
- A language is regular if and only if it is recognized by a DFA
###Closed under Operations
- special start state
that has arrows to and
Note: Think about the new NFA as the root with two children
Closed under concatenation
Construct
Note: Think about concatenation of two linked lists by connecting final state(s) of
Closed under star operation
is the new start state that which is the old start state accepts both the new and old start state
Regular Expression
- empty string
- empty language
: doesn't contain any string , where are regular expression , where are regular expression , where is regular expression
Note:
. Concatenating the empty set to any set yields the empty set . Empty string is always in a member of . If the language is empty, the star operation can put together 0 strings, giving only the empty string.
Equivalence with Finite Automata
Theorem: A language is regular if and only if some regular expression describes it.
Lemma
-
where and for -
empty string
where for any -
empty language
: doesn't contain any string where for any (Cases below are closed under operations) -
, where are regular expression -
, where are regular expression -
, where is regular expression
Lemma
Idea: Convert the GNFA with
Then in the new machine,
Formally,
is finite states is the input alphabet
is the start state is the accept state
- for each
, , where
Proof: ...
Nonregular Languages
Pumping lemma
If
- for each
,
Idea: take a string
Pumping lemma practice
Pumping down: