Fall 2005Costas Busch - RPI1 Pushdown Automata PDAs.

Slides:



Advertisements
Similar presentations
Pushdown Automata Section 2.2 CSC 4170 Theory of Computation.
Advertisements

Pushdown Automata CPSC 388 Ellen Walker Hiram College.
Costas Busch - RPI1 Pushdown Automata PDAs. Costas Busch - RPI2 Pushdown Automaton -- PDA Input String Stack States.
Courtesy Costas Busch - RPI1 Non Deterministic Automata.
1 … NPDAs continued. 2 Pushing Strings Input symbol Pop symbol Push string.
Courtesy Costas Busch - RPI1 Pushdown Automata PDAs.
Costas Busch - RPI1 NPDAs Accept Context-Free Languages.
Fall 2006Costas Busch - RPI1 Deterministic Finite Automata And Regular Languages.
Courtesy Costas Busch - RPI1 NPDAs Accept Context-Free Languages.
1 Normal Forms for Context-free Grammars. 2 Chomsky Normal Form All productions have form: variable and terminal.
Courtesy Costas Busch - RPI1 Turing Machines. Courtesy Costas Busch - RPI2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
Fall 2004COMP 3351 Pushdown Automata PDAs. Fall 2004COMP 3352 Pushdown Automaton -- PDA Input String Stack States.
Fall 2006Costas Busch - RPI1 Pushdown Automata PDAs.
1 Normal Forms for Context-free Grammars. 2 Chomsky Normal Form All productions have form: variable and terminal.
Fall 2006Costas Busch - RPI1 Non-Deterministic Finite Automata.
Costas Busch - RPI1 Turing Machines. Costas Busch - RPI2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
Costas Busch - RPI1 CSCI-2400 Models of Computation.
Finite Automata Costas Busch - RPI.
Fall 2006Costas Busch - RPI1 PDAs Accept Context-Free Languages.
Costas Busch - LSU1 Non-Deterministic Finite Automata.
Prof. Busch - LSU1 Pushdown Automata PDAs. Prof. Busch - LSU2 Pushdown Automaton -- PDA Input String Stack States.
Prof. Busch - LSU1 Turing Machines. Prof. Busch - LSU2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
1 Pushdown Automata PDAs. 2 Pushdown Automaton -- PDA Input String Stack States.
1 Non-Deterministic Finite Automata. 2 Alphabet = Nondeterministic Finite Automaton (NFA)
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 8 Mälardalen University 2010.
Pushdown Automata CS 130: Theory of Computation HMU textbook, Chap 6.
Pushdown Automata (PDAs)
Fall 2006Costas Busch - RPI1 Deterministic Finite Automaton (DFA) Input Tape “Accept” or “Reject” String Finite Automaton Output.
Lecture Pushdown Automata. stack stack head finite control tape head tape.
1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 6 Mälardalen University 2010.
PushDown Automata. What is a stack? A stack is a Last In First Out data structure where I only have access to the last element inserted in the stack.
Foundations of (Theoretical) Computer Science Chapter 2 Lecture Notes (Section 2.2: Pushdown Automata) Prof. Karen Daniels, Fall 2010 with acknowledgement.
CSCI 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Pushdown.
Formal Languages, Automata and Models of Computation
1 Pushdown Automata Definition Moves of the PDA Languages of the PDA Deterministic PDA’s.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Pushdown.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Pushdown.
Pushdown Automata Hopcroft, Motawi, Ullman, Chap 6.
1.Draw a parse tree for the following derivation: S  C A C  C A b b  b b A b b  b b B b b  b b a A a a b b  b b a b a a b b 2. Show on your parse.
1.Draw a parse tree for the following derivation: S  C A C  C A b b  b b A b b  b b B b b  b b a A a a b b  b b a b a a b b 2. Show on your parse.
Grammar Set of variables Set of terminal symbols Start variable Set of Production rules.
1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 8 Mälardalen University 2011.
CS 154 Formal Languages and Computability March 10 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak.
Costas Busch - LSU1 PDAs Accept Context-Free Languages.
Formal Languages, Automata and Models of Computation
PDAs Accept Context-Free Languages
CSE 105 theory of computation
Busch Complexity Lectures: Turing Machines
NPDAs Accept Context-Free Languages
Pushdown Automata PDAs
Pushdown Automata PDAs
Pushdown Automata PDAs
Pushdown Automata PDAs
AUTOMATA THEORY VI.
Pushdown Automata PDAs
NPDAs Accept Context-Free Languages
Principles of Computing – UFCFA3-30-1
CSCI-2400 Models of Computation Costas Busch - RPI.
Non-Deterministic Finite Automata
CSE322 Definition and description of finite Automata
Pushdown automata a_introduction.htm.
CSE 105 theory of computation
… NPDAs continued.
Pushdown automata The Chinese University of Hong Kong Fall 2011
Formal Definitions for Turing Machines
CSE 105 theory of computation
Non Deterministic Automata
Normal Forms for Context-free Grammars
CSE 105 theory of computation
Presentation transcript:

Fall 2005Costas Busch - RPI1 Pushdown Automata PDAs

Fall 2005Costas Busch - RPI2 Pushdown Automaton -- PDA Input String Stack States

Fall 2005Costas Busch - RPI3 Initial Stack Symbol Stack bottomspecial symbol stack head top Appears at time 0

Fall 2005Costas Busch - RPI4 The States Input symbol Pop symbol Push symbol

Fall 2005Costas Busch - RPI5 top input stack Replace

Fall 2005Costas Busch - RPI6 Push top input stack

Fall 2005Costas Busch - RPI7 Pop top input stack

Fall 2005Costas Busch - RPI8 No Change top input stack

Fall 2005Costas Busch - RPI9 Pop top input stack Empty Stack empty When the stack gets empty, the automaton HALTS (no more transitions after )

Fall 2005Costas Busch - RPI10 Pop top input stack A Possible Transition

Fall 2005Costas Busch - RPI11 Non-Determinism PDAs are non-deterministic Allowed non-deterministic transitions

Fall 2005Costas Busch - RPI12 Example PDA PDA :

Fall 2005Costas Busch - RPI13 Basic Idea: 1.Push the a’s on the stack 2. Match the b’s on input with a’s on stack 3. Match found

Fall 2005Costas Busch - RPI14 Execution Example: Input current state Time 0 Stack

Fall 2005Costas Busch - RPI15 Input Time 1 Stack

Fall 2005Costas Busch - RPI16 Input Stack Time 2

Fall 2005Costas Busch - RPI17 Input Stack Time 3

Fall 2005Costas Busch - RPI18 Input Stack Time 4

Fall 2005Costas Busch - RPI19 Input Stack Time 5

Fall 2005Costas Busch - RPI20 Input Stack Time 6

Fall 2005Costas Busch - RPI21 Input Stack Time 7

Fall 2005Costas Busch - RPI22 Input Time 8 accept Stack

Fall 2005Costas Busch - RPI23 A string is accepted if there is a computation such that: All the input is consumed AND The last state is an accepting state At the end of the computation, we do not care about the stack contents (the stack can be empty at the last state)

Fall 2005Costas Busch - RPI24 The input string is accepted by the PDA:

Fall 2005Costas Busch - RPI25 is the language accepted by the PDA: In general,

Fall 2005Costas Busch - RPI26 Rejection Example: Input current state Time 0 Stack

Fall 2005Costas Busch - RPI27 Rejection Example: Input current state Time 1 Stack

Fall 2005Costas Busch - RPI28 Rejection Example: Input current state Time 2 Stack

Fall 2005Costas Busch - RPI29 Rejection Example: Input current state Time 3 Stack

Fall 2005Costas Busch - RPI30 Rejection Example: Input current state Time 4 Stack

Fall 2005Costas Busch - RPI31 Rejection Example: Input current state Time 4 Stack reject

Fall 2005Costas Busch - RPI32 The input string is rejected by the PDA:

Fall 2005Costas Busch - RPI33 A string is rejected if there is no computation such that: All the input is consumed AND The last state is an accept state At the end of the computation, we do not care about the stack contents

Fall 2005Costas Busch - RPI34 Another PDA example PDA :

Fall 2005Costas Busch - RPI35 Basic Idea: 1.Push v on stack 2. Guess middle of input 3. Match on input with v on stack 4. Match found

Fall 2005Costas Busch - RPI36 Execution Example: Input Time 0 Stack

Fall 2005Costas Busch - RPI37 Input Time 1 Stack

Fall 2005Costas Busch - RPI38 Input Time 2 Stack

Fall 2005Costas Busch - RPI39 Input Time 3 Stack Guess the middle of string

Fall 2005Costas Busch - RPI40 Input Time 4 Stack

Fall 2005Costas Busch - RPI41 Input Time 5 Stack

Fall 2005Costas Busch - RPI42 Input Time 6 Stack accept

Fall 2005Costas Busch - RPI43 Rejection Example: Input Time 0 Stack

Fall 2005Costas Busch - RPI44 Input Time 1 Stack

Fall 2005Costas Busch - RPI45 Input Time 2 Stack

Fall 2005Costas Busch - RPI46 Input Time 3 Stack Guess the middle of string

Fall 2005Costas Busch - RPI47 Input Time 4 Stack

Fall 2005Costas Busch - RPI48 Input Time 5 Stack There is no possible transition. Input is not consumed

Fall 2005Costas Busch - RPI49 Another computation on same string: Input Time 0 Stack

Fall 2005Costas Busch - RPI50 Input Time 1 Stack

Fall 2005Costas Busch - RPI51 Input Time 2 Stack

Fall 2005Costas Busch - RPI52 Input Time 3 Stack

Fall 2005Costas Busch - RPI53 Input Time 4 Stack

Fall 2005Costas Busch - RPI54 Input Time 5 Stack No final state is reached

Fall 2005Costas Busch - RPI55 There is no computation that accepts string

Fall 2005Costas Busch - RPI56 Another PDA example PDA

Fall 2005Costas Busch - RPI57 Execution Example: Input Time 0 Stack

Fall 2005Costas Busch - RPI58 Input Time 1 Stack

Fall 2005Costas Busch - RPI59 Input Time 2 Stack

Fall 2005Costas Busch - RPI60 Input Time 3 Stack accept

Fall 2005Costas Busch - RPI61 Rejection example: Input Time 0 Stack

Fall 2005Costas Busch - RPI62 Input Time 1 Stack

Fall 2005Costas Busch - RPI63 Input Time 2 Stack

Fall 2005Costas Busch - RPI64 Input Time 3 Stack

Fall 2005Costas Busch - RPI65 Input Time 4 Stack Halt and Reject

Fall 2005Costas Busch - RPI66 Pushing Strings Input symbol Pop symbol Push string

Fall 2005Costas Busch - RPI67 top input stack Push pushed string Example:

Fall 2005Costas Busch - RPI68 Another PDA example PDA

Fall 2005Costas Busch - RPI69 Time 0 Input current state Stack Execution Example:

Fall 2005Costas Busch - RPI70 Time 1 Input Stack

Fall 2005Costas Busch - RPI71 Time 3 Input Stack

Fall 2005Costas Busch - RPI72 Time 4 Input Stack

Fall 2005Costas Busch - RPI73 Time 5 Input Stack

Fall 2005Costas Busch - RPI74 Time 6 Input Stack

Fall 2005Costas Busch - RPI75 Time 7 Input Stack

Fall 2005Costas Busch - RPI76 Time 8 Input Stack accept

Fall 2005Costas Busch - RPI77 Formalities for PDAs

Fall 2005Costas Busch - RPI78 Transition function:

Fall 2005Costas Busch - RPI79 Transition function:

Fall 2005Costas Busch - RPI80 Formal Definition Pushdown Automaton (PDA) States Input alphabet Stack alphabet Transition function Accept states Stack start symbol Initial state

Fall 2005Costas Busch - RPI81 Instantaneous Description Current state Remaining input Current stack contents

Fall 2005Costas Busch - RPI82 Input Stack Time 4: Example:Instantaneous Description

Fall 2005Costas Busch - RPI83 Input Stack Time 5: Example:Instantaneous Description

Fall 2005Costas Busch - RPI84 We write: Time 4 Time 5

Fall 2005Costas Busch - RPI85 A computation:

Fall 2005Costas Busch - RPI86 For convenience we write:

Fall 2005Costas Busch - RPI87 Formal Definition Language accepted by PDA : Initial state Accept state

Fall 2005Costas Busch - RPI88 Example: PDA :

Fall 2005Costas Busch - RPI89 PDA :

Fall 2005Costas Busch - RPI90 PDA : Therefore: