1. MODELING OF REACTIVE SYSTEMS WITH FINITE AUTOMATA 1
MODELING OF REACTIVE SYSTEMS WITH
FINITE AUTOMATA
Asma Hameed Zarnigar Altaf Syeda Phool Zehra
asma.89leo@yahoo.com zaris_22@yahoo.com zehras_1@yahoo.com
Department of Computer Science, Fatima Jinnah Women University,
The Mall, Rawalpindi, Pakistan.
Abstract: 1. Introduction:
Finite automata are computing devices
that accept/recognize regular languages
and are used to model operations of many
systems we find in practice. Finite-state
machines can solve a large number of
R eactive system that computes by
reacting to stimuli from its
environment along its Overall
problems, among which are electronic computation. We have seen an example of
design automation, communication use of finite automata in describing the
protocol design, parsing and other operation of a simplified version of
engineering application. In biology and vending machine. Many other systems
artificial intelligence research, state operating in practice can also be modeled
machine or hierarchies of state machines by finite automata such as control circuits
are some time used to describe of computers, computer network
neurological systems and in linguistics— communication protocols, and lexical
to describe the grammars of natural analyzers for compilers etc. Many of those
languages .In this project we are systems fall into the class of systems called
describing modeling of reactive systems reactive system. A reactive system is a
with Finite automata. system that changes its actions, outputs
and conditions/status in response to stimuli
Keywords: from within or outside it. It is an event
Finite automata application ,modeling driven or control driven system
reactive system. continuously having to react to external
and/or internal stimuli. The inputs for a
reactive system are never ready unlike for
example when two numbers are added
together by an adder (Here we are
considering an adder at a higher level of
2. MODELING OF REACTIVE SYSTEMS WITH FINITE AUTOMATA 2
abstraction than physical devices level in the 1950's when they were viewed as
ignoring for example the transient states of abstract models of real circuits Finite
the electronic circuit that realizes an automata (also called finite state machines,
adder). An adder does not respond unless emerged during the 1940’s and 1950’s):
the input i.e. two numbers to be added are useful e.g. text search, protocol
ready. A system such as an adder is called verification, compilers, descriptions of
a transformational system. In the case of certain formal grammars (N. Chomsky,
vending machine or communication 1950’s).Since then finite automata is being
protocol, on the other hand, a system must used in different machines.
respond to each stimulus, even to a
fragment of input such as each coin tossed 4. Application Of Finite Automata
in for a can of soda or every message
Finite automata and various extensions of
received.
them, such as transducers, are used in areas
2. Background as diverse as compilers, spelling checking,
natural language grammar checking,
Modeling is a visual process used for communication protocol design, digital
constructing and documenting the design circuit simulation, digital flight control,
and structure of an application. It is a good speech recognition and synthesis, genetic
idea to make at least some outline of an sequencing, and Java program verification.
application, showing interdependencies Unfortunately, as the number of
and relationships between the components applications has grown, so has the variety
and subsystems, during development. Here of implementations and implementation
we are using finite automata for modeling techniques.
of reactive system. Finite automata is used
in software for verifying all kinds of 5. Advantages of FSM
systems with a finite number of states,
such as communication protocols. Also The advantages of finite automata is that
used in software for scanning text, to find their simplicity make it easy for
certain patterns. Used in “Lexical inexperienced developers to implement with
analyzers” of compilers (to turn program little to no extra knowledge (low entry
text into “tokens”, e.g. identifierz, level).Predictability (in deterministic FSM),
keywords, brackets, punctuation).Part of given a set of inputs and a known current
Turing machines and abacus machines state, the state transition can be predicted,
allowing for easy testing. Due to their
3. Overview simplicity, FSMs are quick to design, quick
to implement and quick in execution.FSM is
The term Finite automata' describes a class an old knowledge representation and system
of models of computation that are modeling technique, and its been around for
characterized by having a finite number of a long time, as such it is well proven even as
states. The use of the word `automata' an artificial intelligence technique, with lots
harks back to the early days of the subject
3. MODELING OF REACTIVE SYSTEMS WITH FINITE AUTOMATA 3
of examples to learn from. FSMs are 5.1 Finite Automata Of Login
relatively flexible. There are a number of Process
ways to implement a FSM based system in
terms of topology, and it is easy to For example consider the following very
incorporate many other techniques .Easy to simplified version of login process to a
transfer from a meaningful abstract computer from the computer point of view.
representation to a coded implementation Let us assume for simplicity that this
.Easy determination of reach ability of a computer accepts a single user at a time.
state, when represented in an abstract form, Initially the computer waits for a user
it is immediately obvious whether a state is name to be typed in. This is one state of
achievable from another state, and what is the system. When a name is typed in, it
required to achieve the state checks whether or not the name is valid. If
it is valid, then it asks for and then waits
5. Modeling Reactive Systems for the password, which is another state. If
With Finite Automata the user name typed in is not valid, it goes
back to the initial state. We could make it
It is generally agreed that finite automata go to a different state and count the
are a natural medium to describe dynamic number of login attempts for security
behaviors of reactive systems. Finite purpose. But let us make it simple. When a
automata are formal and rigorous and password is typed in and it is correct, then
computer programs can be easily written to it accepts the user and starts a session. That
simulate their behaviors. is another state though it could further be
To model a reactive system with finite broken down into a number of more states.
automaton, first the states the system goes When the session terminates, it gets a
in or the modes of its operation are signal, goes back to the initial state and
identified. These become the states of the waits for another login. If the password
finite automaton that models it. Then the typed in is incorrect, then it informs the
transitions between the states triggered by user of that and waits for the next try. That
events and conditions, external or internal is a fourth state. If the second password
to the system, are identified and they fails, it goes to the initial state and starts all
become arcs in the transition diagram of over again. Again what we have seen is a
the finite automaton. In addition actions model for one level of abstraction.
that may take place in those states can also Depending on how much detail we are
be added to the model. interested in, different states would be
identified and transitions would have to be
selected accordingly.
4. MODELING OF REACTIVE SYSTEMS WITH FINITE AUTOMATA 4
ACK.
Again depending on the level of abstraction,
different states and transitions would have to
be chosen.
5.2 Finite Automata Of
Communication Protocol
The next example is a protocol for a
computer to follow in communicating with
another computer. Again it is a very
simplified version. Initially the computer is
5.3 Finite Automata Of Number
in wait state waiting for "Request for Next
Message" (RFNM) to come from another Recognizer
computer. When a RFNM starts coming, it The third example is a system that
goes into the state of receiving it (Our recognizes numbers with or without a sign
interpretation is that the computer is in a such as 5.378, -15, +213.8 etc. One such
state of receiving an RFNM and it is taking system initially waits for the first symbol to
the action of receiving the RFNM) . Upon come in. If the first symbol is a sign, then it
completion of the RFNM, it sends goes into a state, denote it by G, that
"Acknowledgement" (ACK) to the other indicates that a sign has been received.
computer, which is another state. After If the first digit is received before a decimal
sending the ACK, it starts sending the point, regardless of whether a sign has been
requested message to the other party. When read or not, it goes into a state, denote it by
it is complete, it goes into another wait state D, that indicates a digit has been read before
waiting for an ACK to come from the other a decimal point. If a decimal point is
computer. If a negative ACK is received, it received before a digit, then it goes into a
resends the message. If a positive ACK is state, denote it by P, which indicates that a
received, it goes back to the initial state and decimal point has been read.
waits for another RFNM to come. Thus a If a decimal point has been read (i.e. in state
finite automaton that models this protocol P), then it must receive at least one digit
has the following five states: initial state after that. After one digit it can continue
(wait for RFNM), receiving RFNM, sending receiving digits. Therefore from state P it
ACK, sending message and waiting for goes to another state, denote it by Q, after
5. MODELING OF REACTIVE SYSTEMS WITH FINITE AUTOMATA 5
reading a digit and stays there as long as Conclusion
digits are read. This Q is an accepting state.
On the other hand if a digit has been read After completing this project we have found
before a decimal point, i.e. it is in state D, that finite automata is a part of many
then it can continue receiving digits and stay machine and by modeling reactive system
in D. D is another accepting state. If a with finite automata we have got a
decimal point is read while in D, then it goes diagrammatic representation of machines
to state P indicating that a decimal point has that how these machines work. Due to its
been read. This system can also be described advantages we use finite automata machine.
by a regular expression. Since these
numbers are represented by strings
Acknowledgement
consisting of a possible sign, followed by First of all I thank ALLAH, the Almighty,
zero or more digits, followed by a possible for bestowing me with determination and
decimal point, followed by one or more grit to undergo the project. I owe my
digits, they can be represented by the gratitude to many people for the guidance
following regular expression: they endowed me with. Foremost on the list
is Mr, Aihab Khan my supervisor, who was
(s+ + s- + ) ( d+.d+ + d+ + .d+ ),
sheer source of guidance and
where s+ and s- represent the positive and
encouragement. I am also gratified to my
negative signs, respectively and d belongs
family whose suggestions have helped me to
to { 0 , 1 , 2 , . . . , 9 } . This system can be
improve and render this project
modeled by the following finite automaton:
References:
[1]http://aidepot.com/FiniteStateMachines/FSM-
Background.html
[2]http://www.cs.umbc.edu/portal/help/theory/au
tomata_def.shtml
[3]http://www.informit.com/articles/article.aspx
?p=27792
[4]http://www.cs.odu.edu/~toida/nerzic/390tech
ed/regular/fa/intr_2_fa.html