100% found this document useful (1 vote)
120 views21 pages

Finite State Automata

Set of slides illustrating Finite state automata (FSA) and NFA non deterministic finite state automata. This is from set of lectures on compilers form coursera
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
120 views21 pages

Finite State Automata

Set of slides illustrating Finite state automata (FSA) and NFA non deterministic finite state automata. This is from set of lectures on compilers form coursera
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

Finite Automata

What Are They?


Who Needs em?
An Example: Scoring in Tennis
1

What is a Finite Automaton?


A formal system.
Remembers only a finite amount of
information.
Information represented by its state.
State changes in response to inputs.
Rules that tell how the state changes in
response to inputs are called transitions.
2

Why Study Finite Automata?


Used for both design and verification of
circuits and communication protocols.
Used for many text-processing
applications.
An important component of compilers.
Describes simple patterns of events, etc.

Tennis
Like ping-pong, except you are very
tiny and stand on the table.
Match = 3-5 sets.
Set = 6 or more games.

Scoring a Game
One person serves throughout.
To win, you must score at least 4
points.
You also must win by at least 2 points.
Inputs are s = server wins point and
o = opponent wins point.

s
s
s
Start
s

Love
o

o
s

o
s

40-15

30-all

s
30-40

15-40

deuce

Ad-out

Love-40

40-30

s
o

Ad-in

15-30

Love-30
o

30-15

15-all

Love-15
o

o
o

15-Love

40-Love

30-Love

Server
Wins

o
Oppnt
Wins
6

Acceptance of Inputs
Given a sequence of inputs (input
string ), start in the start state and
follow the transition from each symbol
in turn.
Input is accepted if you wind up in a
final (accepting) state after all inputs
have been read.
7

Example: Processing a String


sosososososs
s

s
o

15-Love
o

Love

30-15

o
Love-30

s
o

s
o

15-all

Love-15
o

30-Love

s
Start

40-Love

Server
Wins
s
40-15

Love-40

s
o

30-all

s
30-40

o
Oppnt
Wins

deuce
o

Ad-out
o

40-30

s
15-40

Ad-in

o
s

15-30
o

Example: Processing a String


sosososososs
s

Start

*
15-Love

o
o
s

30-15

o
Love-30

s
o

s
o

15-all

Love-15
o

30-Love

Love

40-Love

Server
Wins
s
40-15

Love-40

s
o

30-all

s
30-40

o
Oppnt
Wins

deuce
o

Ad-out
o

40-30

s
15-40

Ad-in

o
s

15-30
o

Example: Processing a String


sosososososs
s

15-Love
o

Love
o

o
s

30-15

o
Love-30

s
o

s
o

15-all

Love-15
o

30-Love

s
Start

40-Love

Server
Wins
s
40-15

Love-40

s
o

30-all

s
30-40

o
Oppnt
Wins

deuce
o

Ad-out
o

40-30

s
15-40

Ad-in

o
s

15-30
o

10

Example: Processing a String


sosososososs
s
30-Love

s
Start

15-Love
o

Love
o

*
30-15

o
Love-30

s
o

o
s
o

15-all

Love-15
o

40-Love

Server
Wins
s
40-15

Love-40

s
o

30-all

s
30-40

o
Oppnt
Wins

deuce
o

Ad-out
o

40-30

s
15-40

Ad-in

o
s

15-30
o

11

Example: Processing a String


sosososososs
s

s
o

15-Love
o

Love

30-15

o
Love-30

s
o

s
o

15-all

Love-15
o

30-Love

s
Start

40-Love

Server
Wins
s
40-15

*
30-all

15-30
o
Love-40

s
o

s
s
o
s

s
30-40

o
Oppnt
Wins

deuce
o

Ad-out
o

40-30

s
15-40

Ad-in

12

Example: Processing a String


sosososososs
s

s
o

15-Love
o

Love

30-15

o
Love-30

s
o

s
o

15-all

Love-15
o

30-Love

s
Start

40-Love

Server
Wins
s
40-15

Love-40

s
o

s
o
s

30-all

15-30
o

o
Oppnt
Wins

*
40-30

s
30-40
o

deuce
o

Ad-out
o

s
o

s
15-40

Ad-in

13

Example: Processing a String


sosososososs
s

s
o

15-Love
o

Love

30-15

o
Love-30

s
o

s
o

15-all

Love-15
o

30-Love

s
Start

40-Love

Server
Wins
s
40-15

Love-40

s
o

30-all

o
Oppnt
Wins

40-30
o

s
30-40

s
15-40

Ad-in

o
s

15-30
o

deuce
o

Ad-out
o

14

Example: Processing a String


sosososososs
s

s
o

15-Love
o

Love

30-15

o
Love-30

s
o

s
o

15-all

Love-15
o

30-Love

s
Start

40-Love

Server
Wins
s
40-15

Love-40

s
o

30-all

o
Oppnt
Wins

Ad-in

s
30-40
o

deuce
o

Ad-out
o

40-30

s
15-40

o
s

15-30
o

15

Example: Processing a String


sosososososs
s

s
o

15-Love
o

Love

30-15

o
Love-30

s
o

s
o

15-all

Love-15
o

30-Love

s
Start

40-Love

Server
Wins
s
40-15

Love-40

s
o

30-all

o
Oppnt
Wins

40-30
o

s
30-40

s
15-40

Ad-in

o
s

15-30
o

*
deuce
o

Ad-out
o

16

Example: Processing a String


sosososososs
s

s
o

15-Love
o

Love

30-15

o
Love-30

s
o

s
o

15-all

Love-15
o

30-Love

s
Start

40-Love

Server
Wins
s
40-15

Love-40

s
o

30-all

o
Oppnt
Wins

Ad-in

s
30-40
o

deuce
o

Ad-out
o

40-30

s
15-40

o
s

15-30
o

17

Example: Processing a String


sosososososs
s

s
o

15-Love
o

Love

30-15

o
Love-30

s
o

s
o

15-all

Love-15
o

30-Love

s
Start

40-Love

Server
Wins
s
40-15

Love-40

s
o

30-all

o
Oppnt
Wins

40-30
o

s
30-40

s
15-40

Ad-in

o
s

15-30
o

*
deuce
o

Ad-out
o

18

Example: Processing a String


sosososososs
s

s
o

15-Love
o

Love

30-15

o
Love-30

s
o

s
o

15-all

Love-15
o

30-Love

s
Start

40-Love

Server
Wins
s
40-15

Love-40

s
o

30-all

o
Oppnt
Wins

Ad-in

s
30-40
o

deuce
o

Ad-out
o

40-30

s
15-40

o
s

15-30
o

19

Example: Processing a String


*
Server

sosososososs
s

s
o

15-Love
o

Love

30-15

o
Love-30

s
o

s
o

15-all

Love-15
o

30-Love

s
Start

40-Love

Wins

s
40-15

Love-40

s
o

30-all

s
30-40

o
Oppnt
Wins

deuce
o

Ad-out
o

40-30

s
15-40

Ad-in

o
s

15-30
o

20

Language of an Automaton
The set of strings accepted by an
automaton A is the language of A.
Denoted L(A).
Different sets of final states -> different
languages.
Example: As designed, L(Tennis) =
strings that determine the winner.
21

You might also like