Hello,
Above are two examples of pushdown automata. I'm trying to make sense of how the stack works with a step by step process of an actual string in the language. The first attachment is an example of how I'm trying to do this, I see one mistake already(I think q6 should be included in current states for #3) but I think it's a good example of the kind of explanation I would like for the next example. I've been trying several different ways of conceptualizing how example 2.18 works but it seems no matter what I do I expect the machine to push whatever is read at the input(0 or 1) and then if the input=stack, pop. In other words the stack either gets larger(input=/=stack) or stays the same size(input=stack). The author's informal description of the machine does nothing to help me understand how the machines processes an actual string step by step.(Both of these examples are from the text Introduction to the Theory of Conputation by Sipser). Below is a quote from the text:
"Begin by pushing the symbols that are read onto the stack. At each point nondeterministically guess that the middle of the string has been reached and then change into popping off the stack for each symbol read, checking to see that they are the same. If they were always the same symbol and the stack empties at the same time as the input is finished, accept; otherwise reject."
I think ok, maybe you can only read one input symbol at a time but you can perform many stack operations as long as they're satisfied by conditions on arrows(transition function). But then I do not understand why the input symbol from q2 isn't pushed indefinitely. It's not explained at all well in the book. I suppose if someone could point out the error in my description of the computation of string 1001(this example accepts strings of form ww^R, where w^R is the reverse of the string w) by M3 and correct it for me that would greatly help.
1. Start at q1. Goto q2,q3(through q2) push $
2. Input:1001 Stack: $
q2: read 1 ---> push 1 Stack: 1$ q2--->q2,q3
q3: read 1 ---> (since input=1 AND stack=1) pop 1 stack: $ q3--->q3
GOTO NEXT INPUT
Now my understanding is we take all states with arrows pointing to them(q2,q3) to be the current states
3. Input: 1001 Stack: $
q2: read 0 ---> push 0 Stack: 0$ q2--->q2,q3
q3: read 0 ---> pop 0 Stack: $ q3--->q3
GOTO NEXT INPUT
4. Input: 1001 Stack: $
q2: read 0 ---> push 0 Stack: 0$ q2--->q2,q3
q3: read 0 ---> pop 0 Stack: $ q3--->q3
GOTO NEXT INPUT
5. Input: 1001 Stack: $
q2: read 0 ---> push 0 Stack: 0$ q2--->q2,q3
q3: read 0 ---> pop 0 Stack: $ q3--->q3
There are obviously some problems with this. For one I left out that q3--->q4 when stack=$, also I haven't read anything yet that says I should process q2 before q3, and the results are different if I do q3 first. And also the way I'm doing it ALL strings will be accepted by this machine because we always get stack=$ at the end of each step so q3--->q4, so I'm doing it wrong. The epsilons in this example really have me confused. Any help would be appreciated.
This post has been edited by macosxnerd101: 21 April 2015 - 08:23 AM
Reason for edit:: Added spoiler tags for large images- Please don't undo my edit. The images took a while to load for me due to their size. The spoiler tag helps folks with this.

New Topic/Question
Reply




MultiQuote






|