CSE 135: Introduction to Theory of Computation Pushdown Automata

CSE 135: Introduction to Theory of Computation Pushdown Automata

CSE 135: Introduction to Theory of Computation Pushdown Automata Sungjin Im University of California, Merced 03-05-2015 I So far we considered automata with finite memory or machines with infinite memory I Today: automata with access to an infinite stack | infinite memory but restricted access I The stack can contain an unlimited number of characters. But I can read/erase only the top of the stack: pop I can add to only the top of the stack: push I On longer inputs, automaton may have more items in the stack Restricted Infinite Memory: The Stack I Today: automata with access to an infinite stack | infinite memory but restricted access I The stack can contain an unlimited number of characters. But I can read/erase only the top of the stack: pop I can add to only the top of the stack: push I On longer inputs, automaton may have more items in the stack Restricted Infinite Memory: The Stack I So far we considered automata with finite memory or machines with infinite memory I The stack can contain an unlimited number of characters. But I can read/erase only the top of the stack: pop I can add to only the top of the stack: push I On longer inputs, automaton may have more items in the stack Restricted Infinite Memory: The Stack I So far we considered automata with finite memory or machines with infinite memory I Today: automata with access to an infinite stack | infinite memory but restricted access But I can read/erase only the top of the stack: pop I can add to only the top of the stack: push I On longer inputs, automaton may have more items in the stack Restricted Infinite Memory: The Stack I So far we considered automata with finite memory or machines with infinite memory I Today: automata with access to an infinite stack | infinite memory but restricted access I The stack can contain an unlimited number of characters. I can add to only the top of the stack: push I On longer inputs, automaton may have more items in the stack Restricted Infinite Memory: The Stack I So far we considered automata with finite memory or machines with infinite memory I Today: automata with access to an infinite stack | infinite memory but restricted access I The stack can contain an unlimited number of characters. But I can read/erase only the top of the stack: pop I On longer inputs, automaton may have more items in the stack Restricted Infinite Memory: The Stack I So far we considered automata with finite memory or machines with infinite memory I Today: automata with access to an infinite stack | infinite memory but restricted access I The stack can contain an unlimited number of characters. But I can read/erase only the top of the stack: pop I can add to only the top of the stack: push Restricted Infinite Memory: The Stack I So far we considered automata with finite memory or machines with infinite memory I Today: automata with access to an infinite stack | infinite memory but restricted access I The stack can contain an unlimited number of characters. But I can read/erase only the top of the stack: pop I can add to only the top of the stack: push I On longer inputs, automaton may have more items in the stack I On reading a 0, push it onto the stack I After the 0s, on reading each 1, pop a 0 I (If a 0 comes after a 1, reject) I If attempt to pop an empty stack, reject I If stack not empty at the end, reject I Else accept Keeping Count Using the Stack n n I An automaton can use the stack to recognize f0 1 g I After the 0s, on reading each 1, pop a 0 I (If a 0 comes after a 1, reject) I If attempt to pop an empty stack, reject I If stack not empty at the end, reject I Else accept Keeping Count Using the Stack n n I An automaton can use the stack to recognize f0 1 g I On reading a 0, push it onto the stack I (If a 0 comes after a 1, reject) I If attempt to pop an empty stack, reject I If stack not empty at the end, reject I Else accept Keeping Count Using the Stack n n I An automaton can use the stack to recognize f0 1 g I On reading a 0, push it onto the stack I After the 0s, on reading each 1, pop a 0 I If attempt to pop an empty stack, reject I If stack not empty at the end, reject I Else accept Keeping Count Using the Stack n n I An automaton can use the stack to recognize f0 1 g I On reading a 0, push it onto the stack I After the 0s, on reading each 1, pop a 0 I (If a 0 comes after a 1, reject) I If stack not empty at the end, reject I Else accept Keeping Count Using the Stack n n I An automaton can use the stack to recognize f0 1 g I On reading a 0, push it onto the stack I After the 0s, on reading each 1, pop a 0 I (If a 0 comes after a 1, reject) I If attempt to pop an empty stack, reject I Else accept Keeping Count Using the Stack n n I An automaton can use the stack to recognize f0 1 g I On reading a 0, push it onto the stack I After the 0s, on reading each 1, pop a 0 I (If a 0 comes after a 1, reject) I If attempt to pop an empty stack, reject I If stack not empty at the end, reject Keeping Count Using the Stack n n I An automaton can use the stack to recognize f0 1 g I On reading a 0, push it onto the stack I After the 0s, on reading each 1, pop a 0 I (If a 0 comes after a 1, reject) I If attempt to pop an empty stack, reject I If stack not empty at the end, reject I Else accept I On seeing a ( push it on the stack I On seeing a ) pop a ( from the stack I If attempt to pop an empty stack, reject I If stack not empty at the end, reject I Else accept I e.g. (())() is balanced, but ())() and (() are not Matching Parenthesis Using the Stack I An automaton can use the stack to recognize balanced parenthesis I On seeing a ( push it on the stack I On seeing a ) pop a ( from the stack I If attempt to pop an empty stack, reject I If stack not empty at the end, reject I Else accept Matching Parenthesis Using the Stack I An automaton can use the stack to recognize balanced parenthesis I e.g. (())() is balanced, but ())() and (() are not I On seeing a ) pop a ( from the stack I If attempt to pop an empty stack, reject I If stack not empty at the end, reject I Else accept Matching Parenthesis Using the Stack I An automaton can use the stack to recognize balanced parenthesis I e.g. (())() is balanced, but ())() and (() are not I On seeing a ( push it on the stack I If attempt to pop an empty stack, reject I If stack not empty at the end, reject I Else accept Matching Parenthesis Using the Stack I An automaton can use the stack to recognize balanced parenthesis I e.g. (())() is balanced, but ())() and (() are not I On seeing a ( push it on the stack I On seeing a ) pop a ( from the stack I If stack not empty at the end, reject I Else accept Matching Parenthesis Using the Stack I An automaton can use the stack to recognize balanced parenthesis I e.g. (())() is balanced, but ())() and (() are not I On seeing a ( push it on the stack I On seeing a ) pop a ( from the stack I If attempt to pop an empty stack, reject I Else accept Matching Parenthesis Using the Stack I An automaton can use the stack to recognize balanced parenthesis I e.g. (())() is balanced, but ())() and (() are not I On seeing a ( push it on the stack I On seeing a ) pop a ( from the stack I If attempt to pop an empty stack, reject I If stack not empty at the end, reject Matching Parenthesis Using the Stack I An automaton can use the stack to recognize balanced parenthesis I e.g. (())() is balanced, but ())() and (() are not I On seeing a ( push it on the stack I On seeing a ) pop a ( from the stack I If attempt to pop an empty stack, reject I If stack not empty at the end, reject I Else accept I Like an NFA with -transitions, but with a stack I Stack depth unlimited: not a finite-state machine I Non-deterministic: accepts if any thread of execution accepts Pushdown Automata (PDA) input a b b a a b finite-state control x y x stack $ A Pushdown Automaton I Stack depth unlimited: not a finite-state machine I Non-deterministic: accepts if any thread of execution accepts Pushdown Automata (PDA) input a b b a a b finite-state control x y x stack $ A Pushdown Automaton I Like an NFA with -transitions, but with a stack I Non-deterministic: accepts if any thread of execution accepts Pushdown Automata (PDA) input a b b a a b finite-state control x y x stack $ A Pushdown Automaton I Like an NFA with -transitions, but with a stack I Stack depth unlimited: not a finite-state machine Pushdown Automata (PDA) input a b b a a b finite-state control x y x stack $ A Pushdown Automaton I Like an NFA with -transitions, but with a stack I Stack depth unlimited: not a finite-state machine I Non-deterministic: accepts if any thread of execution accepts I At every step: I Consume next input symbol (or none) and pop the top symbol on stack (or none) I Based on current state, consumed input symbol and popped stack symbol, do (non-deterministically): 1.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    79 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us