For the first exam, you should be prepared to
- answer questions about definitions, properties, and behaviors of DFAs, NFAs, and GNFAs,
- determine whether a string is in the language of some finite automaton,
- design a DFA or NFA given some language (which may or may not involve closure properties),
- determine the language of a given DFA or NFA,
- determine if a string matches a given regular expression,
- convert a given NFA to an equivalent DFA using subset construction algorithm, and
- recover a regular expression from a finite automaton using state elimination.
Proofs
We will get proofs, oftentimes by oconstruction:
Let
We would be asked to prove that L is regular
- this would be proof by construction of a finite automaton
NFAs/DFAs Transition
An epsilon transition (ε-transition) in a finite automaton is a transition between states that occurs without consuming any input symbol. This means the automaton can move from one state to another “for free,” without reading a character from the input string.
Given a NFA:
stateDiagram-v2 Direction LR [*] --> q0 q0 --> q1:ε q0 --> q2:ε q2 --> q3:ε
Looks like the following DFA:
stateDiagram-v2 [*] --> q0 [*] --> q1 [*] --> q2 [*] --> q3
Formal Definition
Given a state diagram machine :
stateDiagram-v2 Direction LR [*] --> A A --> B:0 A --> C:1 B --> B:0 B --> C:1 C --> A:0,1 C --> [*] C:::accepting classDef accepting fill:#bbf,stroke:#333,stroke-width:2;
We have a 5 tuple:
Q:
:
:
For this we can make a table
0 | 1 | |
---|---|---|
A | B | C |
B | B | C |
C | A | A |
or with equations:
:
just the start state
(always a set, accepting states):
State Elimination
Say we have the following unpruned DFA:
stateDiagram-v2 Direction LR [*] --> A A --> B:0 B --> B:0 B --> C:1 C --> C:0 C --> A:1
We want to recover an equivalent regex using state elimination
RIP states in the order
- Construct GNFA
stateDiagram-v2 Direction LR [*] --> S S --> A:ε A --> B:0 B --> B:0 B --> C:1 B --> accept:ε C --> C:0 C --> A:1
Let’s start RIPPING:
RIP C:
RIP B:
RIP A:
Closure Properties of Regular Languages
Theorem: The class of regular languages is closed under the union operation. That is, if languages and are regular, then is regular.
Theorem: The class of regular languages is closed under the concatenation operation. That is, if languages and are regular, then is regular.
Theorem: The class of regular languages is closed under the Kleene star operation. That is, if language is regular, then is regular.
Theorem: the class of regular languages is closed under the reversal operation. That is, if language is regular, then is regular.
Theorem: The class of regular languages is closed under complementation. That is, if language is regular, then is regular.
NFAs and DFAs Equivalent
Theorem: Every nondeterministic finite automaton has an equivalent deterministic finite automaton. (This is proven using subset construction.)
Corollary: A language is regular if and only if some nondeterministic finite automaton recognizes it.
Definition of a Regular Expression
We say that is a regular expression if is:
- for some in the alphabet
- , the empty string
- , the empty language
- , where and are regular expressions
- , where and are regular expressions, or
- , where is a regular expression