Finite State Machines A Graph Automaton Copyright © 2011 Curt Hill Introduction • We generally think of graphs as models of real world things – Airline flights – Pre-requisite courses • We may also use them to model computations Copyright © 2011 Curt Hill Names • • • • • • • Not all of these are equivalent Finite State Machines Finite State Automata Deterministic Finite Automata Non-deterministic Finite Automata Push Down Automata Turing Machines Copyright © 2011 Curt Hill Automata • Lets imagine a simple machine as a model of computation • It must have: • Input – Assume a string of characters from some alphabet • A control unit with an internal state • Output – Output is determined by input and state Copyright © 2011 Curt Hill Transition Function • Each Finite State Automaton must have a transition function • This transition function requires two parameters: – The current state – The current input value • The result is the new state • Any pair of parameters that has no defined result generates an error state Copyright © 2011 Curt Hill Models • This simple automaton may be modeled in several ways • A state chart – On one side is the state – On the other is the inputs • A graph – Each node represents a state – Each arc an input that causes the state change Copyright © 2011 Curt Hill Examples a b s0 s0 s1 s1 s2 s0 s2 s1 s2 b a s1 b a s0 s2 b a Copyright © 2011 Curt Hill We need some more • Every Finite State Machine needs a couple of other things • The initial state – where does the machine start • One or more terminal states – where may the machine end • Did you notice that it accepts a language? Copyright © 2011 Curt Hill Exercise • Recall the FSM that we just saw – I will show again on next slide • Lets assume that the initial and terminal state is s0 • Find three strings that this automaton accepts • What is shortest string it may accept • What is the longest string it may accept Copyright © 2011 Curt Hill Exercise a b s0 s0 s1 s1 s2 s0 s2 s1 s2 b a s1 b a s0 s2 b a Copyright © 2011 Curt Hill Which are not legal? • • • • • • aaabb bbaa abaab bababba abababa Bbbbabab a b s0 s0 s1 s1 s2 s0 s2 s1 s2 b a s1 b a s0 s2 b Copyright © 2011 Curt Hill a Time Out • It is now time to talk about Regular Expressions • Any language specified by this type of FSM may be represented by a regular expression Copyright © 2011 Curt Hill
© Copyright 2026 Paperzz