Finite State Machines.

Slides:



Advertisements
Similar presentations
4b Lexical analysis Finite Automata
Advertisements

THE CHURCH-TURING T H E S I S “ TURING MACHINES” Pages COMPUTABILITY THEORY.
Finite state machines.
Computability and Complexity 3-1 Turing Machine Computability and Complexity Andrei Bulatov.
COMS 3261, Lecture 2 Strings, Languages, Automata September 6, 2001.
Turing Machines CS 105: Introduction to Computer Science.
Copyright © Cengage Learning. All rights reserved.
Theory of Computation. Computation Computation is a general term for any type of information processing that can be represented as an algorithm precisely.
Presented by Ravi Teja Pampana
Turing Machines A more powerful computation model than a PDA ?
Finite State Machines – Page 1CSCI 1900 – Discrete Structures CSCI 1900 Discrete Structures Graphs and Finite State Machines Reading: Kolman, Sections.
Rosen 5th ed., ch. 11 Ref: Wikipedia
Host and Application Security Lesson 3: What is Information?
Finite-State Machines with Output
The Turing machine Olena Lastivka. Definition Turing machine is a theoretical device that manipulates symbols on a strip of tape according to a table.
Lecture 23: Finite State Machines with no Outputs Acceptors & Recognizers.
Alan Turing WWII code-breaker mathematical proof of ‘Turing machines’ …in particular, “Universal Turing machine” laid foundations of computer science father.
THE CHURCH-TURING T H E S I S “ TURING MACHINES” Part 1 – Pages COMPUTABILITY THEORY.
Computer Science 101 Theory of Computing. Computer Science is... The study of algorithms, with respect to –their formal properties –their linguistic realizations.
CS1Q Computer Systems Lecture 11 Simon Gay. Lecture 11CS1Q Computer Systems - Simon Gay 2 The D FlipFlop The RS flipflop stores one bit of information.
Digital System Design using VHDL
Computing Machinery Chapter 4: Finite State Machines.
Turing Machines Lecture 26 Naveen Z Quazilbash. Overview Introduction Turing Machine Notation Turing Machine Formal Notation Transition Function Instantaneous.
Automata & Formal Languages, Feodor F. Dragan, Kent State University 1 CHAPTER 3 The Church-Turing Thesis Contents Turing Machines definitions, examples,
1 Introduction to Turing Machines
Turing Machine Model Are there computations that no “reasonable” computing machine can perform? –the machine should not store the answer to all possible.
Theory of Computation Automata Theory Dr. Ayman Srour.
Lecture #4 Thinking of designing an abstract machine acts as finite automata. Advanced Computation Theory.
1 Chapter 2 Finite Automata (part a) Hokkaido, Japan.
Theory of Computation Automata Theory Dr. Ayman Srour.
Modeling Arithmetic, Computation, and Languages Mathematical Structures for Computer Science Chapter 8 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesTuring.
Finite-State Machines (FSM) Chuck Cusack Based partly on Chapter 11 of “Discrete Mathematics and its Applications,” 5 th edition, by Kenneth Rosen.
WELCOME TO A JOURNEY TO CS419 Dr. Hussien Sharaf Dr. Mohammad Nassef Department of Computer Science, Faculty of Computers and Information, Cairo University.
Finite Automata.
A Universal Turing Machine
1.3 Finite State Machines.
Finite State Machines Dr K R Bond 2009
COMPUTER ARCHITECTURE AND THE CYNAIDE COATED APPLE.
Turing Machines Finite State Machines.
Lexical analysis Finite Automata
Discrete Mathematics and its Applications
Copyright © Cengage Learning. All rights reserved.
10.3 Finite State Machines.
CS21 Decidability and Tractability
Finite Automata a b A simplest computational model
Theory of Computation Lecture 22: Turing Machines III
Turing Machines 2nd 2017 Lecture 9.
Jaya Krishna, M.Tech, Assistant Professor
Chapter 9 TURING MACHINES.
فصل سوم The Church-Turing Thesis
§11.2 – Finite State Machines with Output
Turing Machines (TM) Deterministic Turing Machine (DTM)
Theory of Computation Turing Machines.
4b Lexical analysis Finite Automata
CS21 Decidability and Tractability
Copyright © Cengage Learning. All rights reserved.
Deterministic Finite Automaton (DFA)
Recall last lecture and Nondeterministic TMs
4b Lexical analysis Finite Automata
Decidability and Tractability
P.V.G’s College of Engineering, Nashik
CSE S. Tanimoto Turing Completeness
Recap lecture 19 NFA corresponding to Closure of FA, Examples, Memory required to recognize a language, Example, Distinguishing one string from another,
§11.2 – Finite State Machines with Output
Lecture One: Automata Theory Amjad Ali
Finite State Machine Continued
Turing Machines Everything is an Integer
Theory of Computation Lecture 23: Turing Machines III
What is it? The term "Automata" is derived from the Greek word "αὐτόματα" which means "self-acting". An automaton (Automata in plural) is an abstract self-propelled.
Discrete Mathematics and its Applications
Presentation transcript:

Finite State Machines

State Machines A machine that has input, an internal memory that can keep track of information about the input history, and an optional output is called a state machine. The complete internal condition of the [state] machine and all of its memory, at any particular time, is said to constitute the state of the machine at that time.

More Informal Definition of a State The current condition of any machine is defined by certain properties including: the inputs that brought the machine to this state; the current output of the machine; and the response the machine will have to new inputs. These conditions are referred to as states.

Finite State Machine Assume that we have a finite set of states that a machine can be in, S, and a finite set of possible inputs to that machine, I. A machine is a Finite State Machine (FSM) if when any input from the set I is input to the machine causing it to change state, the state it changes to will be contained in the finite set of states, S.

Definition of a Finite State Machine Formally, a Finite Automaton (FA) is defined as a 5-tuple (Q, S, d, q0, F) where, (1) Q is a finite set of states. (2) S is a finite set of symbols or the alphabet. (3) d: Q x S -> Q is the transition function (4) q0 is an element of Q called the start state, and (5) F is a subset of Q called the set of accept states.

Real World Examples All of the math aside, many common items or even non-technical tasks can be modeled with a finite state machine. Examples: Soda machine Software applications Spell checker Driving to school/work

Example: Maze FSM Given the maze Define the following Q = {1, 2, 3, 4, 5, 6} S = {U, D, L, R} q0 = 1 (start state) F = {6} The state table is:

Example: Maze FSM As a digraph:

Example – Soda Vending Machine Assume a soda vending machine that accepts only nickles, dimes, and quarters sells only one kind of soda for 25¢ a piece. Identify all of the possible states 0¢: no money at all – waiting for any money 5¢, 10¢, 15¢, and 20¢: some money, but not enough – waiting for coin return or more money. 25¢, 30¢, 35¢, 40¢, and 45¢: enough money – waiting for select button, or coin return button Finite states (10) and finite inputs (5¢, 10¢, 25¢, select button and coin return button)

Soda Machine Block Diagram Nickles Dimes Quarters Select Button Coin Return Soda Change

State Transitions A state transition is the definition of the destination state based on the current state and the system input. A state transition must be defined for every input out of every state. Exactly one destination state is defined for every allowable input. Example: In testing software for quality control, every possible user input from every possible state must be considered even if the input makes no sense. In addition, no user input can take the system to more than one state.

State Transition Functions The function, fx, that defines which state the machine will go to after an input, x, is called the state transition function. Denoted fx(s) where x denotes the input and s denotes the current state. Example: If the soda machine is in the state representing 10¢ received, inserting a nickle will move it to the state representing 15¢ received. fNickle(10¢) = 15¢

Set of State Transitions = Relation Since the state transition function defines every transition of an FSM, a set of tuples of the form (sm, sn) can be created where sm is the state where a transition starts and sn is the state where that transition ends. Assume a relation RM is the set of tuples described above. An FSM then can be defined as the set of all states, S, the set of inputs, I, and the relation defining the state transitions, RM. RM = {(sm, fsm(x)) |  x  I and  sm  S}

State Transition Table A table summarizing all of the state transitions of a finite state machine is called a state transition table. Each row of a state transition table represents the current state while the columns for that row show the destination or next states based on different possible inputs.

Soda Machine State Transition Table Current state Nickle Dime Quarter Select button Coin return button 0¢ 5¢ 1 10¢ 1 25¢ 1 0¢ 4 5¢ 15¢ 1 30¢ 1 10¢ 20¢ 1 35¢ 1 15¢ 40¢ 1 20¢ 45¢ 1 25¢ 25¢ 2 0¢ 3 30¢ 30¢ 2 35¢ 35¢ 2 40¢ 40¢ 2 45¢ 45¢ 2 1 – Accepts inserted money 2 – Any money inserted is returned 3 – Soda delivered and change returned 4 – All inserted money is returned

FSM Labeled Digraph Since a relation RM can be defined for an FSM using a state transition function, then a digraph can be created to represent the relation. It must be a labeled digraph to indicate which input specifies which transition RM = {(s0, fa(s0) = s0), (s0, fb(s0) = s1), (s1, fa(s1) = s2), (s1, fb(s1) = s0), (s2, fa(s2) = s1), (s2, fb(s2) = s2)} Current state a b s0 s1 s2

FSM Labeled Digraph (continued)

Soda Machine Digraph (Select button transitions are missing) 25¢ 30¢ Q Q Coin return button 5¢ D 0¢ D N 35¢ 15¢ Q N N D Q N 40¢ 10¢ N D D 20¢ Q 45¢

Turing Machines

Turing Machines Finite state machines were presented as a simple model of computation FSMs are effective in some settings, such as modeling devices with limited input and output capabilities FSMs are unable to solve even simple computational tasks such as determining whether a 0 or a 1 appears the majority of the time in a binary string

Turing Machines Another model of computation presented here is the Turing machine, named after the famous mathematician Alan Turing Turing developed his model in the 1930's in order to reason about general purpose computers Does a machine exist that can determine whether any arbitrary machine on its tape is "circular" (e.g. freezes, or fails to continue its computational task) Does a machine exist that can determine whether any arbitrary machine on its tape ever prints a given symbol

Turing Machines The descriptions of a Turing machine is much simpler than the description of a modern processor, but Turing machines are believed to be every bit as powerful The Church-Turing conjecture says that any problem that can be solved efficiently on any computing device can be solved efficiently by a Turing machine.

Turing Machines A Turing machine consists of: A tape divided into cells, one next to the other. Each cell contains a symbol from some finite alphabet. The alphabet contains a special blank symbol and one or more other symbols A head that can read and write symbols on the tape and move the tape left and right one (and only one) cell at a time A state register that stores the state of the Turing machine, one of finitely many

Turing Machines And finally, a Turing machine consists of: A finite table of instructions that, given the state(qi) the machine is currently in and the symbol(aj) it is reading on the tape (symbol currently under the head), tells the machine to do the following in sequence (for the 5-tuple models): Either erase or write a symbol (replacing aj with aj1), and then Move the head (which is described by dk and can have values: 'L' for one step left or 'R' for one step right or 'N' for staying in the same place), and then Assume the same or a new state as prescribed (go to state qi1).

Turing Machines See Zyante 7.5