Presentation is loading. Please wait.

Presentation is loading. Please wait.

Copyright © 2011-2014 Curt Hill Other Automata Pushdown through Turing machines.

Similar presentations


Presentation on theme: "Copyright © 2011-2014 Curt Hill Other Automata Pushdown through Turing machines."— Presentation transcript:

1 Copyright © 2011-2014 Curt Hill Other Automata Pushdown through Turing machines

2 Copyright © 2011-2014 Curt Hill Finite State Machine We have previously seen these What can they not do? They are unable to handle the recursive nature of most programming languages Eg. C –A statement may be a for-statement –A for-statement contains a statement They cannot remember where they came from

3 Finite State Automata Two things (and only two things) determine the next state: –Current state –Input symbol To strengthen this we add a stack –The symbols on the stack may be different than input This results in the pushdown machine Copyright © 2011-2014 Curt Hill

4 Pushdown automata The transition function now has three parameters Three things choose the next state: –Current state –Input symbol –Symbol on top of stack Any state transition may push or pop a symbol on/off the stack –Or decline to do so Copyright © 2011-2014 Curt Hill

5 Pictures Copyright © 2011-2014 Curt Hill Finite Control acba… Finite State Automaton Finite Control acba… Pushdown Automaton xyw… Input (r/o) Stack (r/w)

6 Transition Relation A finite state automaton has a transition function A pushdown automaton has a transition relation The parameters are: –The current input value –The current state –The top of stack The result is: –The new state –The action on the stack Copyright © 2011-2014 Curt Hill

7 State Transitions The form is: (a, s, t) (s, n) a is the symbol on the input s is the state t is the top of the stack –0 means it is ignored n is the new action –0 means no action Copyright © 2011-2014 Curt Hill

8 A very simple grammar V – {X} T – {a,b,c} S – X P –X ::= b –X ::= a X c This will give expressions of the form: a n bc n –b–b –aaabccc Why is this not a Type 3 grammar? Copyright © 2011-2014 Curt Hill

9 Why is this not regular? The best we can do in a regular language is arbitrary string of a followed by one b and an arbitrary string of c a*bc* There is no way to force the number of as and cs to match The simple grammar above requires equal numbers Copyright © 2011-2014 Curt Hill

10 Grammar State Transitions (a, s1, 0) (s1, push x) (b, s1, 0) (s2, 0) (c, s2, x) (s3, pop) (c, s3, x) (s3, pop) (c, s3, empty) (s4, 0) Copyright © 2011-2014 Curt Hill

11 Graphics Copyright © 2011-2014 Curt Hill Finite State Automata are simple –There representation is simple Push Down Automata are somewhat more complex –This makes the picture more complicated We will attempt: : a n bc n

12 PDA Copyright © 2011-2014 Curt Hill s1s1 s2s2 s3s3 a,0 Push x b,0 c,x pop c,x pop s4s4 c,empty Transitions have two pieces to choose and one action –First is input, second is stack –Zero means ignore this input –Second line is action

13 What’s next? Turing machine A thought experiment devised by Alan Turing in 1936 –Original paper is 1937 Turing wanted to investigate what was and was not computable Copyright © 2011-2014 Curt Hill

14 Description A finite state machine The input is now a tape that is infinite in both directions The finite automaton may read forward or backward as many times as desired Any symbol read may be rewritten –Not read/only like Finite State Machine or Pushdown machine Copyright © 2011-2014 Curt Hill

15 In Practice and Theory In practice, this is a terrible way to make a computer In theory, there is no stronger means of computation –Strong: ability to compute a result This is one of the foundations of the theoretical computer science With the exception of the infinite storage a Turing machine is equivalent to Von Neumann machines Copyright © 2011-2014 Curt Hill

16 Equivalence A CPU is a finite state machine –Very many states If we consider the memory/secondary storage as equivalent to tape the parallels should be clear –We may simulate an array with a list so random access memory is faster but not stronger than the tape Copyright © 2011-2014 Curt Hill

17 Simulators There are a variety of simulators for a Turing machine on the web Here are few (2014) –http://morphett.info/turing/turing.htmlhttp://morphett.info/turing/turing.html –https://martinugarte.com/turingmachin e/https://martinugarte.com/turingmachin e/ –http://www.turing.org.uk/turing/scrapb ook/tmjava.htmlhttp://www.turing.org.uk/turing/scrapb ook/tmjava.html –http://www.superutils.com/products/ub er-turing-machine/http://www.superutils.com/products/ub er-turing-machine/ Copyright © 2011-2014 Curt Hill

18 Linear Bounded Recall that context sensitive languages may be handled by linear bounded automaton What is that? A Turing machine with limited tape that may make a limited number of passes through that tape Copyright © 2011-2014 Curt Hill

19 Equivalences A Finite State Automaton may recognize a Type 3 or Regular Language A Push Down Automaton may recognize a Type 2 or Context Free Language A Linear Bounded Automaton may recognize a Type 1 or Context Sensitive Language A Turing Machine may recognize a Type 0 or any phrase structured language Copyright © 2011-2014 Curt Hill


Download ppt "Copyright © 2011-2014 Curt Hill Other Automata Pushdown through Turing machines."

Similar presentations


Ads by Google