Professional Documents
Culture Documents
Finite State Machines Regular Languages
Finite State Machines Regular Languages
1
12/08/2017
Regular Languages
Regular
L
Language
Defines
Regular Grammar
Finite State
Machine 3
2
12/08/2017
3
12/08/2017
4
12/08/2017
Configurations of DFSMs
A Configuration of a DFSM M is an element of
K × Σ*
10
Transition Function - δ
• Defines the DFSM, one state at a time
5
12/08/2017
C a
S q1
b
13
6
12/08/2017
7
12/08/2017
16
Example Language
L = {x | x is an odd integer}
• Is 3456 ∈L?
• How will we develop a machine to
answer the question?
• Process characters left to right
• Assume the current character is the
LAST character
• What are the necessary states?
17
8
12/08/2017
An Example Computation
An FSM to accept odd integers:
even odd
even
q0 q1
odd
Developing a DFSM
Heuristic – a generality, a recommendation
• List or Label the possible states of a
machine based upon the language or
problem definition
• Determine the transitions between the
states
19
9
12/08/2017
20
21
10
12/08/2017
Regular Languages
A language is regular iff it is accepted
by some FSM.
We have defined
several regular
languages…
22
Regular Examples
L = {w ∈ {a,b}*| every region of a’s is of
even length}
L = {w ∈ {a,b}*| w contains at most 1 b }
L = {w ∈ {a,b}*| no 2 consecutive
characters are the same }
23
11
12/08/2017
24
12
12/08/2017
27
13
12/08/2017
C a
S q1
a,b b
d a, b
28
ERROR – d is not an
accepting state
d is Dead State;
once in that state
string cannot be
accepted.
29
14
12/08/2017
DFSM Example
L=
{w ∈ {a, b}* : every a region in w is of even length}
d is a Dead State
30
31
15
12/08/2017
32
33
16
12/08/2017
34
A Simple Controller
35
17
12/08/2017
Developing FSMs
Sometimes, it is “easier” to develop the
FSM for the complement of the
language, then reverse the Accept &
Reject states
Do you believe this would work???
36
Complement of FSMs
L = {w ∈ {a, b}* : w does not contain the
substring aab}.
18
12/08/2017
Let LMissing =
{w : there is a symbol ai ∈ Σ not appearing in w}.
38
39
19
12/08/2017
20