these material has been reproduced and presented to you by km khan afridi for idea only. do not...

23
These material has been reproduced and presented to you by KM Khan Afridi for IDEA only. Do not forget me in DUA Warning: The information herein is for idea purposes only and I cannot guarantee the accuracy of any information provided in this presentation.. I makes no warranties, express, implied or statutory, as to the information in this presentation. This Presentation is protected by copyright laws and VU Plagiarism Policy. Unauthorized reproduction or distribution of this Presentation, or any portion of it, may result in severe civil and criminal penalties, and will be prosecuted to the maximum extent possible

Upload: domenic-simon

Post on 17-Jan-2016

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: These material has been reproduced and presented to you by KM Khan Afridi for IDEA only. Do not forget me in DUA Warning: The information herein is for

These material has been reproduced and presented to you by KM Khan Afridi for

IDEA only. Do not forget me in DUA

Warning:The information herein is for idea purposes only and I cannot guarantee the accuracy of any information provided in this presentation..I makes no warranties, express, implied or statutory, as to the information in this presentation.This Presentation is protected by copyright laws and VU Plagiarism Policy. Unauthorized reproduction or distribution of this Presentation, or any portion of it, may result in severe civil and criminal penalties, and will be prosecuted to the maximum extent possible under law.

Page 2: These material has been reproduced and presented to you by KM Khan Afridi for IDEA only. Do not forget me in DUA Warning: The information herein is for

Converting Finite Automata into Regular Expressions

CS402

Page 3: These material has been reproduced and presented to you by KM Khan Afridi for IDEA only. Do not forget me in DUA Warning: The information herein is for

Kleene’s Theorem

Regular Expression

Finite Automaton

NFA-LGTG

TG NFA

Page 4: These material has been reproduced and presented to you by KM Khan Afridi for IDEA only. Do not forget me in DUA Warning: The information herein is for

First Three Proofs

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

Transition Graph.

Page 5: These material has been reproduced and presented to you by KM Khan Afridi for IDEA only. Do not forget me in DUA Warning: The information herein is for

How to convert aGeneralised Transition Graph

into aRegular Expression

Page 6: These material has been reproduced and presented to you by KM Khan Afridi for IDEA only. Do not forget me in DUA Warning: The information herein is for

Make a uniqueStart State

with no inputtransitions

Are there any Final States

?

Make a uniqueFinal State with nooutput transitions

Eliminatemultiple loops

Eliminatemultiple edges

Is the number of states

> 2?

Eliminate astate which is

NOTthe Start state

or theFinal state

Is the GTGconnected?

Write f

Write thelabel

NO

NO

NO

YES

YESYES

Page 7: These material has been reproduced and presented to you by KM Khan Afridi for IDEA only. Do not forget me in DUA Warning: The information herein is for

Make a unique Start State

-

-

...

...

...

Page 8: These material has been reproduced and presented to you by KM Khan Afridi for IDEA only. Do not forget me in DUA Warning: The information herein is for

Make a unique Start State

-

-

...

...

...

-

L

L

Page 9: These material has been reproduced and presented to you by KM Khan Afridi for IDEA only. Do not forget me in DUA Warning: The information herein is for

Make a unique Start State

...

...

...

-

L

L

Page 10: These material has been reproduced and presented to you by KM Khan Afridi for IDEA only. Do not forget me in DUA Warning: The information herein is for

Make a unique Final State

+

+

...

...

...

Page 11: These material has been reproduced and presented to you by KM Khan Afridi for IDEA only. Do not forget me in DUA Warning: The information herein is for

Make a unique Final State

+

+

...

...

...

+

L

L

Page 12: These material has been reproduced and presented to you by KM Khan Afridi for IDEA only. Do not forget me in DUA Warning: The information herein is for

Make a unique Final State

...

...

...

+

L

L

Page 13: These material has been reproduced and presented to you by KM Khan Afridi for IDEA only. Do not forget me in DUA Warning: The information herein is for

Eliminate multiple loops

... ...

R1

R2

R3

... ...

R1 + R2 + R3

Page 14: These material has been reproduced and presented to you by KM Khan Afridi for IDEA only. Do not forget me in DUA Warning: The information herein is for

Eliminate multiple edges

... ...

R1

R2

R3

R1 + R2 + R3... ...

Page 15: These material has been reproduced and presented to you by KM Khan Afridi for IDEA only. Do not forget me in DUA Warning: The information herein is for

State Elimination

Cases Incoming edgesfrom a different state

Outgoing edgesto a different state

Loops

1 1 1 NO2 1 1 YES3 1 More than 1 NO/YES4 More than 1 More than 1 NO/YES5 0 0, 1, or more NO/YES

6 0, 1, or more 0 NO/YES

Page 16: These material has been reproduced and presented to you by KM Khan Afridi for IDEA only. Do not forget me in DUA Warning: The information herein is for

... ...R1 R21 2

... ...R1 R2

1 2

Page 17: These material has been reproduced and presented to you by KM Khan Afridi for IDEA only. Do not forget me in DUA Warning: The information herein is for

... ...R1 (S)* R2

1 2

... ...R1 R21 2

S

Page 18: These material has been reproduced and presented to you by KM Khan Afridi for IDEA only. Do not forget me in DUA Warning: The information herein is for

... ...R1

R2

1 3

S 2

4

...

...

R3

R4

... ...R1 (S )* R3

1 3

4

2 ...

...

R1 (S )* R2

R1 (S )* R4

Page 19: These material has been reproduced and presented to you by KM Khan Afridi for IDEA only. Do not forget me in DUA Warning: The information herein is for

... ...

R1

R2

1 3

S 2 ...

R3

R4

... ...R1 (S )* R3

1 3

2 ...R1 (S )* R2

R1 (S )* R4

Page 20: These material has been reproduced and presented to you by KM Khan Afridi for IDEA only. Do not forget me in DUA Warning: The information herein is for

...

...

R1R2

1

3

S 2

4

...

...

R3

R4... 5 R5

...

...R1 (S )* R3

1

3

4

2 ...

...R1 (S )* R4... 5

R1 (S )* R2

R5 (S )* R2

R5 (S )* R4

R5 (S )* R3

Page 21: These material has been reproduced and presented to you by KM Khan Afridi for IDEA only. Do not forget me in DUA Warning: The information herein is for

...

...

R1R2

1

3

S 2

4

...

...

R3

R4... 5 R5

...

...

1

3

2

4

...

...... 5

Page 22: These material has been reproduced and presented to you by KM Khan Afridi for IDEA only. Do not forget me in DUA Warning: The information herein is for

...

...

R1R2

1

3

S 2

4

...

...

R3

R4... 5 R5

...

...

1

3

2

4

...

...... 5

Page 23: These material has been reproduced and presented to you by KM Khan Afridi for IDEA only. Do not forget me in DUA Warning: The information herein is for

Revision• Know Kleene’s Theorem• Be able to convert FAs into Regular

Expressions

Preparation

• Read– Lectures 11 and 12, Practice on Example