Theory of Automata6&7
Theory of Automata6&7
Theory of Automata6&7
Lec06_07:
Union: L1 L2
L
Concatenation:
1L2
Kleene Star: L1 *
R
Reversal: L1
Complement: L1
Intersection: L1 L2
A useful transformation: use one accept state
NFA
a
2 accept states
a b
Equivalent NFA
a 1 accept state
a b
b
NFA
In General
Equivalent NFA
Single accepting state
Take two languages
L1
Regular language Regular language L2
LM1 L1 LM 2 L2
NFA
M1 NFA
M2
M1
n0
a
n
L1 {a b} b
M2
a
L2 ba b
Union L1 L2
NFA for M1
M2
Example
n
NFA for L1 L2 {a b} {ba}
n
L1 {a b}
a
b
L2 {ba}
b a
Prof. Busch - LSU
Concatenation
L1L2
NFA for
M1 M2
Example
n n
L1L2 {a b}{ba} {a bba}
NFA for
n
L1 {a b}
a L2 {ba}
b b a
M1
a
R n
L1 {ba } b
Complement
L1 M1 L1 M1
L1 {a b} n b a, b
M1
a a, b
n b a, b
L1 {a, b} * {a b}
Finite Automata With Output
Background
Finite automaton discussed so far, is just associated with the RE or
the language.
The answer is YES. Such machines are called machines with output.
There are two types of machines with output, Moore Machines and
Mealy Machines
Moore Machine
A Moore Machine consists of the following:
1. A finite set of states q0, q1, q2 … where q0 is the initial
state.
2. An alphabet of letters Σ = {a, b, c….} from which the
input strings are formed.
3. An alphabet ɼ = {x, y, z ….} of output characters from
which output characters are generated.
4. A transition table that shows for each state and each
input letter what state is entered next.
5. An output table the that shows what character is
printed by each state as it is entered.
Moore Machine: Example01
– Consider the following Moore machine
having the states q0, q1, q2, q3 where q0
is the start state and Σ={a, b} and ɼ ={0, 1}
the transition table follows as
Moore Machine
It is to be noted that
The states are labeled along with the characters to be printed.
It is to be noted that:
The length of output string is one more than that of
input string as the initial state prints out the extra
character 1, before the input string is read.
Moore Machine: Example 02
– To identify the relation between input strings and
the corresponding output strings in the following
Moore machine.
Moore Machine
• If the string bbbabaabbaa is run, the out
output string will be 000010000010, as
shown below:
Your Turn:
Mealy Machine
• A Mealy Machine consists of the following:
1. A finite set of states q0, q1, q2 … where q0 is the initial state.
2. An alphabet of letters Σ = {a, b, c….} from which the input
strings are formed.
3. An alphabet ɼ = {x, y, z ….} of output characters from which
output characters are generated.
4. A pictorial representation with states and directed edges
labeled by an input letter along with an output character. The
directed edges also show how to go from one state to another
corresponding to every possible input letter.
Note: It is not possible to give transition table in this
case.
Mealy Machine
Similar to Moore machine, no state is designated to be a final state, so
there is no question of accepting any language by Mealy machine.