Professional Documents
Culture Documents
Fa1 PDF
Fa1 PDF
Motivation
An Example
Informal Explanation
Finite automata are finite collections of
states with transition rules that take
you from one state to another.
Original application was sequential
switching circuits, where the state
was the settings of internal bits.
Today, several kinds of software can be
modeled by FA.
2
Representing FA
Simplest representation is often a
graph.
Nodes = states.
Arcs indicate state transitions.
Labels on arcs tell what causes the
transition.
Not i or n
nothing
Start
Saw i
Saw in
Saw ing
Automata to Code
In C/C++, make a piece of code for
each state. This code:
1. Reads the next input.
2. Decides on the next state.
3. Jumps to the beginning of the code for
that state.
timeout
ack
Extended Example
Thanks to Jay Misra for this example.
On a distant planet, there are three
species, a, b, and c.
Any two different species can mate. If
they do:
1. The participants die.
2. Two children of the third species are
born.
9
11
Questions (2)
These questions mirror real ones about
protocols.
Can the planet fail? is like asking whether
a protocol can enter some undesired or
error state.
Must the planet fail is like asking whether
a protocol is guaranteed to terminate.
Here, failure is really the good condition of
termination.
12
13
020
002
011
101
110
300
030
003
a
210
102
c
021
b
201
120
b
012
c
15
211
a
022
121
103
b
400
130
310
c
202
040
013
112
c
c
a
031
a
004
301
220
17
The Cases 2, 3, 4
110
111
211
200
300
400
310
x
210
220
x
Notice: for the case n = 4, there is nondeterminism : different
transitions are possible from 211 on the same input.
18
5 Individuals
500
410
221
320
311
6 Individuals
600
510
222
420
321
411
330
20
7 Individuals
700
322
610
331
520
421
511
430
22