Theory of Automata6&7

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 39

Theory Of Automata

Lec06_07:

Humera Azam | Introduction


Properties of Regular
Languages:
Properties of Regular Languages:
For regular languages we will prove that: L1 and L2
Union: L1  L2
Concatenation: L1L2
Are regular Languages
Star: L1 *
Reversal: R
L1
Complement: L1
Intersection:
L1  L2
We say: Regular languages are closed under

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

LM1   L1 LM 2   L2
NFA
M1 NFA
M2

Single accepting state Single accepting state


Example

M1
n0
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

Prof. Busch - LSU


Reverse R
NFA for
L1
L1 M1 M1

1. Reverse all transitions


2. Make initial state accepting state
and vice versa
Example
M1
a
n
L1  {a b} b

M1
a
R n
L1  {ba } b
Complement
L1 M1 L1 M1

1. Take the DFA that accepts L1


2. Make accepting states non-final, and vice-versa
Example
M1
a a, b

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.

 There is a question whether does there exists an FA which generates

an output string corresponding to each input string?

 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.

 Running the string abbabbba over the above machine, the


corresponding output string will be 100010101, which can be
determined by the following table as well.
Moore Machine

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.

 However, in some cases a relation between input string and the


corresponding output string may be identified by the Mealy machine.

 Moreover, the state to be initial is not important as if the machine is used


several times and is restarted after some time, the machine will restart
from the state where it was left off.
Mealy Machine
Mealy Machine
Mealy Machine
Mealy Machine
– It is observed that in the above Mealy machine, if in
the output string the nth character is 1, it shows
that the nth letter in the input string is the second
in the pair of double letter. For babaababba the
0000100010.
Complementing Machine
Incrementing Machine
• It has been observed in the previous example that
the input string and the corresponding output string
are 1’s complement of each other.

• There is a question weather the Mealy machine can


be constructed so that it is increased in magnitude,
by 1 than the corresponding input string? The
answer is yes. This machine is called the
Incrementing Machine.
Incrementing Machine
• It has been observed in the previous example that
the input string and the corresponding output
string are 1’s complement of each other.

• There is a question weather the Mealy machine can


be constructed so that it is increased in magnitude,
by 1 than the corresponding input string? The
answer is yes. This machine is called the
Incrementing Machine.
Incrementing Machine
• Before the incrementing machine is constructed,
consider how 1 is added in binary number.

• Since, if two numbers are added, the addition is


performed from right to left, so while increasing the
binary number by 1, the string must be read by the
corresponding Mealy machine from right to left and
hence, the output string will also be generated from
right to left.
Incrementing Machine
Incrementing Machine
Incrementing Machine
Kleene’s Theorem

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy