Vous êtes sur la page 1sur 3

Basic data processing system:

CPU

Memory

logic

storage

Finite state machine:


The simplest computational model with very limited number of memory.
Example 1: Simulate the working mode of a Chinese torch with pushbutton type of switch.
The following are the description:
a. The memory - States of Torch: Glow (ON), Un-glow (OFF)
b. The data - input signal: Switch on and off (PUSH), idle (NO_PUSH)
c. Transition table - The program logic shown as table
column index - present states
row index - input signals
Contents cells - next state
Present
States
OFF
ON

Input signals
PUSH
ON
OFF

NO_PUSH
OFF
ON

d. State diagram - Diagram showing the work of torch


No-Push

Push
No-Push
OFF

ON

States circles
Transitions arrows
Input labels on arrows

Push
Example 2: A string recognizing machine recognizes the string THE
0

1
H
4

States

3
in-arrow
from no-where
present
present

Start
Intermediate
Final Accept
(Double circle)
Reject
present
(Single circle)

out-arrow
present
present
may be
no

Transition Function:
Present
States
OFF
ON

Input signals
PUSH
ON
OFF

NO_PUSH
OFF
ON

The transition table reveals relation between states and input symbol called as transition
function :
The function takes a state (present) and an input symbol and outputs a new state (next).
(OFF,PUSH)=ON
(OFF,NO_PUSH)=OFF
(ON,PUSH)=OFF
(ON,NO_PUSH)=ON
Let we define
Q set of states - Q={OFF, ON}
set of input symbols the alphabet: ={ PUSH, NO_PUSH }
The transition function can be written as
: Qx Q
Again defining the start state as q0 the OFF state
q0Q
Also the set of accept states
FQ
Define the finite state machine as 5 tuple
M= {Q, q0, , , F }

A set of languages is closed under an operation if the result of applying the operation to any
arbitrary language(s) of the set is a language in the set.
For example a set of languages is closed under union if the union of any two languages of the
set also belongs to the set.
Theorem 1: The set of regular languages over an alphabet is closed under operations union,
concatenation and Kleene star.
Proof: Let Lr and Ls be regular languages over an alphabet . Then by the definition of the set
of regular languages , Lr Ls , LrLs and Lr* are regular languages and they are obviously over
the alphabet . Thus the set of regular languages is closed under those operations.

NFA accepting string 0*1*10*


0

0,1

q1

Computations of the equivalent DFA


Q P(Q)={,{q1},{q2},{q1,q2}}
qs={q1}
F={{q2},{q1,q2}}

q2

Equivalent DFA
accepting string 0*1*10*
0,1
0

q1

Computation of DFA states


(q1,0){q1}
(q1,1){q1,q2}
({q1,q2},0){(q1,0), (q2,0)}={q1,q2}
({q1,q2},1){(q1,1), (q2,1)}={q1,q2,}={q1,q2}

{q1,q2}

q2

q2

X
q1

q1

q3

q3

q4

q4

Vous aimerez peut-être aussi