Lecture 8 - Pushdown Automata Flashcards
What does a pushdown automata consist of?
- a finite input alphabet
- a finite set of states
- a start state
- a set of accepting states
- control relations
What does (Q1 , a , w) -> (q2 , v) mean?
if we are in q1 and a is at the head and w is on the top of the stack
then
move to q2 , push v onto stack and move head one position forward
When does PDA accept an input?
if the input has been fully read , stack is empty and control is in the accepting state
How can we check that the stack is empty?
There is no explicit check, however we can add a special symbol e.g. $ at the beginning, We know the stack is empty when we pop $
What is more powerful - deterministic or non-deterministic PDAs?
NDPDA
What can be recognised by an NDPDA that cannot be recognised by a PDA?
language of palindromes
What does it mean to be more ‘powerful’?
NDPDA recognises more languages that PDA.
What is a palindrome?
a sequence of characters that reads the same forwards and backwards
How can we recognise palindromes with PDAs?
push first half onto stack
then as we read check each character is the same as the one in the top of the stack (also pop)
enter accepting state if all checks succeed
aWhy do we need non-determinism for the palindrome problem?
as we need to guess where the middle of the stack is and also if the number of characters is even or odd
- cannot be done first as we can only read the string once
- also we may need an unbounded number of states as the string can be of any finite length
What is more powerful DFA or PDA?
PDA , as these can recognise more languages
What is the language that is recognisable by a PDA?
context-free language
What cannot be recognised by a PDA?
a^nb^nc^n