how to figure out what language a PDA recognizes

3.2k views Asked by At

Im trying to figure out how to deduce what language a PDA recognizes, and feel like im close but am still missing out. Take the following PDA for example. I can make a transition chart to figure out what my delta (transitions) are but im lost from there on out. This isnt a homework assignment, just an example from the book. Heres the problem and the transition table:

enter image description here

enter image description here

1

There are 1 answers

1
Patrick87 On BEST ANSWER

If I'm reading the notation correctly, it looks like it's L*, where L is the language you get by doing the loop once only. To go round the loop, you see a "c", some number of "a", the same number of "b", then another "c". So L = ca^nb^nc and the language of this PDA is (ca^nb^nc)*.

Naturally, check this and please tell me if I'm wrong. I can also explain better the process I went throug to try to figure this out.

EDIT: Explaining where I get a^nb^n from.

So the stack starts out with only the bottom-of-the-stack symbol Z. So initially, we're in state 1 with stack Z - (1, Z). We then see a c, and we transition to state 2, pushing a $ onto the stack; so we are in (2, $ Z). Then let's say we see n instances of a in a row; each time, we will add a new c to the stack and return to state 2. Therefore, we are now in configuration (2, c^n $ Z). Let's say we then see an instance of b. We transition to state 3 and remove a c from the stack; our configuration is now (3, c^(n-1) $ Z). Now we need to see instances of b until we have $ back on top of the stack; so, in state 3, we can see (n-1) instances of b, each of which will cause a single instance of c to be popped from the stack. After seeing these instances of b, we will be in configuration (3, $ Z). Finally, we will see another instance of c and, $ being on top of the stack, we can pop it and move back to state 1, in our initial configuration of (1, Z).

The (a^n)(b^n) comes from the fact that we put as many instances of c onto the stack as we see 'a' in state 2, and we remove from the stack in states 2 and 3 as many instances of c from the stack as we see instances of b. The choice of n to represent the length is completely arbitrary... it's only used to indicate that the number of instances of a and b must be the same, if we are able to see the $ on top of the stack and transition back to the accepting state.