Notes on Ambiguity and Pushdown Automata

An example of Ambiguity

A key example:

We showed that MATH cannot be recognized by a DFA.

However consider a finite automaton with a "stack." We will implement the following program:

MATH

String s;

int i=0;

if( length(s)==0) return Accept; //empty string

$\vspace{1pt}$

while ( s[i]==0){

$\qquad $push(s[i]);

$\qquad $if(i==(length(s)-1))return Reject; // all zeros

i++;

}

MATH

while ( i $\leq \ $(length(s)-1){

if (s[i]==1){

if (stack_empty )return Reject; // too few zeros

$\qquad \qquad $pop();

$\qquad $}

$\qquad $if( s[i]==0 ) return Reject; // a zero after a one

$\qquad $}

i++;

}

MATH

if($\lnot $stack_empty )return Reject; // too many zeros

if(stack_empty )return Accept;

}

__________________________________________________

Formal Definition of a Pushdown Automaton(PDA)

A (PDA) is a 6-tuple

MATH, where

__________________________________________________

Formal Definition of The Transition Function

The domain of the transition function MATHare ordered triples. Each triple consists of :

The range of the transition function MATH are SETS of ordered pairs. Each pair of the set consists of:

________________________________________________________

Notation for PDA state diagrams

a transition MATH is understood to mean:

________________________________________________________

The key example: