Finite Automata: Informal - Wichita State...

27
Finite Automata: Informal August 26, 2013 Finite Automata: Informal

Transcript of Finite Automata: Informal - Wichita State...

Finite Automata: Informal

August 26, 2013

Finite Automata: Informal

Computational models

I The theory of computation begins with the question:

what is a computer?

I Real computers are however quite complicated so it is difficultto set up a manageable mathematical theory for them

I Instead we can use an idealized computer called computationalmodel in order to begin the theory of computation

Finite Automata: Informal

Finite automata

I The simplest computational model is called a finite statemachine or a finite automaton

I Before developing the mathematics of finite automata we willexamine the usage of a concrete finite automaton: thecontroller of an automatic door

Finite Automata: Informal

The automatic door

I Automatic doors are often found at supermarket entrancesand exits

I An automatic door swing open when sensing that a person isapproaching

I An automatic door is controlled by a simple automaton seenin Figure 1

Finite Automata: Informal

Controller of an automatic door

pad

Front

pad

Rear

door

Figure 1 : Controller of an automatic door

I An automatic door has a pad in front to detect the presenceof a person about to walk through the door

I Another pad is located to the rear of the doorway so that thecontroller can hold the door open long enough for the personto pass all the way through

I The rear pad also take care that the door does not strikesomeone standing behind it as it opens

Finite Automata: Informal

Controller of an automatic door

pad

Front

pad

Rear

door

Figure 1 : Controller of an automatic door

I An automatic door has a pad in front to detect the presenceof a person about to walk through the door

I Another pad is located to the rear of the doorway so that thecontroller can hold the door open long enough for the personto pass all the way through

I The rear pad also take care that the door does not strikesomeone standing behind it as it opens

Finite Automata: Informal

Controller of an automatic door

pad

Front

pad

Rear

door

Figure 1 : Controller of an automatic door

I An automatic door has a pad in front to detect the presenceof a person about to walk through the door

I Another pad is located to the rear of the doorway so that thecontroller can hold the door open long enough for the personto pass all the way through

I The rear pad also take care that the door does not strikesomeone standing behind it as it opens

Finite Automata: Informal

Controller of an automatic door

pad

Front

pad

Rear

door

Figure 1 : Controller of an automatic door

I An automatic door has a pad in front to detect the presenceof a person about to walk through the door

I Another pad is located to the rear of the doorway so that thecontroller can hold the door open long enough for the personto pass all the way through

I The rear pad also take care that the door does not strikesomeone standing behind it as it opens

Finite Automata: Informal

States of the controller

I The controller is in either of two states:open or closed

I There are four input conditions:

front, meaning that a person is standing on the front padrear, meaning that a person is standing on the rear padboth, meaning that people are standing on both padsneither, meaning that no one is standing on either pad

Finite Automata: Informal

State transition diagram

The state transition diagram of the controller, Figure 2, depicts themovements of the controller depending upon the input it receives:

&%'$

closed

jfront

&%'$

open

Yneither

?

neither

both

rear

?

both

rear

front

Figure 2 : Controller’s state transition diagram

Finite Automata: Informal

Interpretation

Door movement:I When the door is closed and there is somebody on the rear pad or on both pads

or there is no one on the pads, the door remains closed

I When the door is closed and somebody steps on the front pad the door opens

I When the door is open and somebody is on the front pad, rear pad, or on bothpads the door stays open

I When the door is open and nobody is on the pads the door closes

Finite Automata: Informal

Interpretation

Controller movement:I When controller is in the state closed and the input is rear, both, or neither the

controller remains in the state closed

I When controller is in the state closed and the input is front the controller movesto the state open

I When the controller is in the state open and the input is one of front, rear,both, the controller remains in the state open

I When the controller is in the state open and the input is neither the controllermoves to the state closed

Finite Automata: Informal

Tabular representation

The movement of the controller (and of the door) can also berepresented by a table whose rows are labeled by the states and whosecolumns are labeled by the input, as seen in Table 1

Table 1 : Controller’s tabular representation

State/Input neither front rear both

closed closed open closed closed

open closed open open open

Interpretation: T(state,input) = NewState

Finite Automata: Informal

Note

I This controller is a computer that has just a single bit of memorythat is used to record the controller’s state

I Other similar devices need controllers with larger memory.

I A state of the controller of an elevator may represent the floor theelevator is on and the inputs may be signals received from the buttons

I Controllers of various household appliances may be more complex.

I dishwashersI electronic thermostatsI digital watchesI calculators

I However the methodology is the same: they are all finite automata

Finite Automata: Informal

Other applications

I Finite automata and their probabilistic counterparts, Markov chains,are useful tools for pattern recognition used in speech processingand optical character recognition

I Markov chains have been used to model and predict price changesin financial applications, speech recognitions

Finite Automata: Informal

Generalizing the controller

I All controllers of the applications mentioned above have acommon property: they are finite automata

I The mathematical theory of finite automata must be done inabstract, without reference to any particular application

I Hence, the concept of a finite automaton, Figure 3, withoutreference to application must be developed

Finite Automata: Informal

The concept

-����

q1

U

0

U1

����

q2����U1

U0

I0, 1����

q3

Figure 3 : The finite automaton M1

I Figure 3 is the state diagram of the automaton M1

I The start state, q1, is indicated by an arrow pointing to itfrom nowhere

I The accept state, q2, is indicated by a double circle

I The arrows going from one state to another are calledtransitions

Finite Automata: Informal

How does it work?

I When the automaton receives an input string, such as 1101, itprocesses that string and produces an output which is eitheraccept or reject

I Processing begins in M1’s start state

Finite Automata: Informal

Processing procedure

I The automaton receives the input symbols one by one fromleft to right

I After reading each symbol, M1 moves from one state toanother along the transition that has that symbol as its label

I When M1 reads the last symbol of the input it produces theoutput: accept if M1 is in an accept state, or reject if M1 isnot in an accept state

Finite Automata: Informal

Example processing

Examine the work produced by M1, Figure 3, on the input 1101:

1. M1 starts in state q1;

2. M1 reads 1 and follows transition from q1 to q2;

3. In state q2 M1 reads next symbol 1 and follows transition from q2 to q2;

4. Then M1 reads next symbol, 0, and follows transition from q2 to q3

5. In state q3 M1 reads 1 and follows transition to q3 to q2

6. In state q2 the input was consumed, q2 is an accept state and M1 outputs accept

Finite Automata: Informal

Example processing

Examine the work produced by M1, Figure 3, on the input 1101:

1. M1 starts in state q1;

2. M1 reads 1 and follows transition from q1 to q2;

3. In state q2 M1 reads next symbol 1 and follows transition from q2 to q2;

4. Then M1 reads next symbol, 0, and follows transition from q2 to q3

5. In state q3 M1 reads 1 and follows transition to q3 to q2

6. In state q2 the input was consumed, q2 is an accept state and M1 outputs accept

Finite Automata: Informal

Example processing

Examine the work produced by M1, Figure 3, on the input 1101:

1. M1 starts in state q1;

2. M1 reads 1 and follows transition from q1 to q2;

3. In state q2 M1 reads next symbol 1 and follows transition from q2 to q2;

4. Then M1 reads next symbol, 0, and follows transition from q2 to q3

5. In state q3 M1 reads 1 and follows transition to q3 to q2

6. In state q2 the input was consumed, q2 is an accept state and M1 outputs accept

Finite Automata: Informal

Example processing

Examine the work produced by M1, Figure 3, on the input 1101:

1. M1 starts in state q1;

2. M1 reads 1 and follows transition from q1 to q2;

3. In state q2 M1 reads next symbol 1 and follows transition from q2 to q2;

4. Then M1 reads next symbol, 0, and follows transition from q2 to q3

5. In state q3 M1 reads 1 and follows transition to q3 to q2

6. In state q2 the input was consumed, q2 is an accept state and M1 outputs accept

Finite Automata: Informal

Example processing

Examine the work produced by M1, Figure 3, on the input 1101:

1. M1 starts in state q1;

2. M1 reads 1 and follows transition from q1 to q2;

3. In state q2 M1 reads next symbol 1 and follows transition from q2 to q2;

4. Then M1 reads next symbol, 0, and follows transition from q2 to q3

5. In state q3 M1 reads 1 and follows transition to q3 to q2

6. In state q2 the input was consumed, q2 is an accept state and M1 outputs accept

Finite Automata: Informal

Example processing

Examine the work produced by M1, Figure 3, on the input 1101:

1. M1 starts in state q1;

2. M1 reads 1 and follows transition from q1 to q2;

3. In state q2 M1 reads next symbol 1 and follows transition from q2 to q2;

4. Then M1 reads next symbol, 0, and follows transition from q2 to q3

5. In state q3 M1 reads 1 and follows transition to q3 to q2

6. In state q2 the input was consumed, q2 is an accept state and M1 outputs accept

Finite Automata: Informal

Example processing

Examine the work produced by M1, Figure 3, on the input 1101:

1. M1 starts in state q1;

2. M1 reads 1 and follows transition from q1 to q2;

3. In state q2 M1 reads next symbol 1 and follows transition from q2 to q2;

4. Then M1 reads next symbol, 0, and follows transition from q2 to q3

5. In state q3 M1 reads 1 and follows transition to q3 to q2

6. In state q2 the input was consumed, q2 is an accept state and M1 outputs accept

Finite Automata: Informal

Note

I M1 accepts strings that end with 1; Why?

I M1 accepts strings that end with an even number of 0-sfollowing the last symbol 1; Why?

I M1 rejects all other strings

Q: can you describe the language consisting from all stringsaccepted by M1?

Finite Automata: Informal