Modeling of reactive system with finite automata


Published on

Modeling of reactive system with finite automata

  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Modeling of reactive system with finite automata

  1. 1. MODELING OF REACTIVE SYSTEMS WITH FINITE AUTOMATA 1 MODELING OF REACTIVE SYSTEMS WITH FINITE AUTOMATA Asma Hameed Zarnigar Altaf Syeda Phool Zehra Department of Computer Science, Fatima Jinnah Women University, The Mall, Rawalpindi, Pakistan.Abstract: 1. Introduction:Finite automata are computing devicesthat accept/recognize regular languagesand are used to model operations of manysystems we find in practice. Finite-statemachines can solve a large number of R eactive system that computes by reacting to stimuli from its environment along its Overallproblems, among which are electronic computation. We have seen an example ofdesign automation, communication use of finite automata in describing theprotocol design, parsing and other operation of a simplified version ofengineering application. In biology and vending machine. Many other systemsartificial intelligence research, state operating in practice can also be modeledmachine or hierarchies of state machines by finite automata such as control circuitsare some time used to describe of computers, computer network neurological systems and in linguistics— communication protocols, and lexicalto describe the grammars of natural analyzers for compilers etc. Many of thoselanguages .In this project we are systems fall into the class of systems calleddescribing modeling of reactive systems reactive system. A reactive system is awith Finite automata. system that changes its actions, outputs and conditions/status in response to stimuliKeywords: from within or outside it. It is an eventFinite automata application ,modeling driven or control driven systemreactive 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. 2. MODELING OF REACTIVE SYSTEMS WITH FINITE AUTOMATA 2abstraction than physical devices level in the 1950s when they were viewed asignoring for example the transient states of abstract models of real circuits Finitethe 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, protocolready. A system such as an adder is called verification, compilers, descriptions ofa transformational system. In the case of certain formal grammars (N. Chomsky,vending machine or communication 1950’s).Since then finite automata is beingprotocol, on the other hand, a system must used in different machines.respond to each stimulus, even to afragment of input such as each coin tossed 4. Application Of Finite Automatain for a can of soda or every message Finite automata and various extensions ofreceived. them, such as transducers, are used in areas2. Background as diverse as compilers, spelling checking, natural language grammar checking,Modeling is a visual process used for communication protocol design, digitalconstructing and documenting the design circuit simulation, digital flight control,and structure of an application. It is a good speech recognition and synthesis, geneticidea to make at least some outline of an sequencing, and Java program verification.application, showing interdependencies Unfortunately, as the number ofand relationships between the components applications has grown, so has the varietyand subsystems, during development. Here of implementations and implementationwe are using finite automata for modeling techniques.of reactive system. Finite automata is usedin software for verifying all kinds of 5. Advantages of FSMsystems with a finite number of states,such as communication protocols. Also The advantages of finite automata is thatused in software for scanning text, to find their simplicity make it easy forcertain patterns. Used in “Lexical inexperienced developers to implement withanalyzers” of compilers (to turn program little to no extra knowledge (low entrytext into “tokens”, e.g. identifierz, level).Predictability (in deterministic FSM),keywords, brackets, punctuation).Part of given a set of inputs and a known currentTuring machines and abacus machines state, the state transition can be predicted, allowing for easy testing. Due to their3. Overview simplicity, FSMs are quick to design, quick to implement and quick in execution.FSM isThe term Finite automata describes a class an old knowledge representation and systemof models of computation that are modeling technique, and its been around forcharacterized by having a finite number of a long time, as such it is well proven even asstates. The use of the word `automata an artificial intelligence technique, with lotsharks back to the early days of the subject
  3. 3. MODELING OF REACTIVE SYSTEMS WITH FINITE AUTOMATA 3of examples to learn from. FSMs are 5.1 Finite Automata Of Loginrelatively flexible. There are a number of Processways to implement a FSM based system interms of topology, and it is easy to For example consider the following veryincorporate many other techniques .Easy to simplified version of login process to atransfer 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 userit is immediately obvious whether a state is name to be typed in. This is one state ofachievable from another state, and what is the system. When a name is typed in, itrequired to achieve the state checks whether or not the name is valid. If it is valid, then it asks for and then waits5. Modeling Reactive Systems for the password, which is another state. IfWith Finite Automata the user name typed in is not valid, it goes back to the initial state. We could make itIt is generally agreed that finite automata go to a different state and count theare a natural medium to describe dynamic number of login attempts for securitybehaviors of reactive systems. Finite purpose. But let us make it simple. When aautomata are formal and rigorous and password is typed in and it is correct, thencomputer programs can be easily written to it accepts the user and starts a session. Thatsimulate their behaviors. is another state though it could further beTo 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 ain or the modes of its operation are signal, goes back to the initial state andidentified. These become the states of the waits for another login. If the passwordfinite automaton that models it. Then the typed in is incorrect, then it informs thetransitions between the states triggered by user of that and waits for the next try. Thatevents and conditions, external or internal is a fourth state. If the second passwordto the system, are identified and they fails, it goes to the initial state and starts allbecome arcs in the transition diagram of over again. Again what we have seen is athe 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 arebe added to the model. interested in, different states would be identified and transitions would have to be selected accordingly.
  4. 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 OfCommunication ProtocolThe next example is a protocol for acomputer to follow in communicating withanother computer. Again it is a verysimplified version. Initially the computer is 5.3 Finite Automata Of Numberin wait state waiting for "Request for NextMessage" (RFNM) to come from another Recognizercomputer. When a RFNM starts coming, it The third example is a system thatgoes into the state of receiving it (Our recognizes numbers with or without a signinterpretation is that the computer is in a such as 5.378, -15, +213.8 etc. One suchstate of receiving an RFNM and it is taking system initially waits for the first symbol tothe action of receiving the RFNM) . Upon come in. If the first symbol is a sign, then itcompletion 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, which is another state. After If the first digit is received before a decimalsending the ACK, it starts sending the point, regardless of whether a sign has beenrequested message to the other party. When read or not, it goes into a state, denote it byit is complete, it goes into another wait state D, that indicates a digit has been read beforewaiting for an ACK to come from the other a decimal point. If a decimal point iscomputer. If a negative ACK is received, it received before a digit, then it goes into aresends the message. If a positive ACK is state, denote it by P, which indicates that areceived, 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 statefinite automaton that models this protocol P), then it must receive at least one digithas 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 itACK, sending message and waiting for goes to another state, denote it by Q, after
  5. 5. MODELING OF REACTIVE SYSTEMS WITH FINITE AUTOMATA 5reading a digit and stays there as long as Conclusiondigits are read. This Q is an accepting state.On the other hand if a digit has been read After completing this project we have foundbefore a decimal point, i.e. it is in state D, that finite automata is a part of manythen it can continue receiving digits and stay machine and by modeling reactive systemin D. D is another accepting state. If a with finite automata we have got adecimal point is read while in D, then it goes diagrammatic representation of machinesto state P indicating that a decimal point has that how these machines work. Due to itsbeen read. This system can also be described advantages we use finite automata a regular expression. Since thesenumbers are represented by strings Acknowledgementconsisting 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 anddecimal point, followed by one or more grit to undergo the project. I owe mydigits, they can be represented by the gratitude to many people for the guidancefollowing 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 andwhere s+ and s- represent the positive and encouragement. I am also gratified to mynegative signs, respectively and d belongs family whose suggestions have helped me toto { 0 , 1 , 2 , . . . , 9 } . This system can be improve and render this projectmodeled by the following finite automaton: References: [1] Background.html [2] tomata_def.shtml [3] ?p=27792 [4] ed/regular/fa/intr_2_fa.html