Lect 07

You might also like

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 24

COMMONWEALTH OF AUSTRALIA

Copyright Regulations 1969


WARNING
This material has been reproduced and communicated to you by or on behalf of Monash University pursuant to
Part VB of the Copyright Act 1968 (the Act).
The material in this communication may be subject to copyright under the Act. Any further reproduction or
communication of this material by you may be the subject of copyright protection under the Act.
Do not remove this notice.

Lecture 7

Converting Finite Automata into


Regular Expressions
CSE2303 Formal Methods I

Kleenes Theorem
Regular Expression

GTG

TG

NFA-

NFA

Finite Automaton

First Three Proofs


Every Finite Automaton is a NFA
Every NFA is a Transition Graph.
Every Transition Graph is a Generalised
Transition Graph.

How to convert a
Generalised Transition Graph
into a
Regular Expression

Make a unique
Start State
with no input
transitions

Are
YES
there any Final States
?
NO

Write

Eliminate
multiple loops

NO
Is the GTG
connected?
YES
Write the
label

Make a unique
Final State with no
output transitions

NO

Is
the number of states
> 2?
YES

Eliminate
multiple edges

Eliminate a
state which is
NOT
the Start state
or the
Final state

Make a unique Start State


...
-

...

...

Make a unique Start State


...

...

...

Make a unique Start State


...

...

...

Make a unique Final State


...
+

...
...

Make a unique Final State


...
+

...
...

Make a unique Final State


...

...
...

Eliminate multiple loops


R2

...
R1

...
R3

R1 + R2 + R3

...

...

Eliminate multiple edges


...

R1
R2

...

R3

...

R1 + R2 + R3

...

State Elimination
Cases
1
2
3
4
5
6

Incoming edges
Outgoing edges
Loops
from a different state to a different state
1
1
NO
1
1
YES
1
More than 1
NO/YES
More than 1
More than 1
NO/YES
0
0, 1, or more
NO/YES
0, 1, or more

NO/YES

...

R1

...

R2

R1 R2

...

...

...

R1

...

R2

R1 (S)* R2

...

...

...

R2

R1

R3

...

...

...

R4
R1 (S )* R2

...

R1 (S )* R3

...

...

...

R1 (S )* R4

S
R1

...

R2
R3

...

...

R4
R1 (S )* R2

...

R1 (S )* R3

R1 (S )* R4

...

...

...

R1

R2
R3

...

R5

...

...

...

R4
R1 (S )* R2

...

...

R1 (S )* R3

R5 (S )* R3
R5 (S )* R4

...

R5 (S )* R2
3

...

...

R1 (S )* R4

...

R1

R2
R3

...

R5

...

...

...

...

...

R4

...

...

...

...

R1

R2
R3

...

R5

...

...

...

...

...

R4

...

...

...

EVEN-EVEN
aa

ab + ba

aa

bb

ab + ba

bb

Revision
Know Kleenes Theorem
Be able to convert FAs into Regular Expressions

Preparation
Read
Text Book Chapter 8

You might also like