0

I want to design a pushdown automata for the language

L = { a^i b^j c^k | i = j or k <= j <= 2k}

The solution proposed by the instructor is as pictured in the following diagram. PDA diagram

But my concern here is, that it does not handle string of the form when |2c| > |b|. That is when in the q8 state, what if the all the B's are stacked out, but the input C is not finished yet. That transition is not captured here.

Is my concern correct? Or the proposed solution is a correct PDA.

yogeshagr
  • 819
  • 2
  • 11
  • 20

1 Answers1

0

Remember that j >= k, so that means |b| >= |c|.

If all the "b"s in input were read, then the number of B's stacked is greater than (or equal to) the number of "c"'s to be read in the input.

  • If j = k, then it will use the transiction from q8 to q8 until the input is finished.
  • If j = 2k, it will read a "c" (q8 -> q9) and take two B's out of the stack (q9 -> q8), so only strings with |b| = 2|c| can be accepted.
  • If j < 2k, it will use q8 -> q9 and q9-> q8 until the number of B's stacked is equal to the number of "c"s to be read in the input. Then it will use q 8-> q8 until the input is finished.
  • I get what you are saying. In the proposed PDA, for q8 -> q8, the transition condition is: (C, B-> E). What happens when the |b| = 6 and the |c| = 4. String of this form should is acceptable. But this PDA does not take care of this case, right? – yogeshagr Mar 15 '17 at 15:40
  • It does. After it reads all the "b"s in the input, there will be 6 B's stacked. Then two "c"s are read in the input using the q8 -> q9 and q9 -> q8 twice, which takes 4 B's from the stack. So we have two "c"s left to be read in the input and two B's stacked. Then, q8 -> q8 is used twice and the string is accepted. – Luciana Abud Mar 15 '17 at 16:28
  • Okay yeah it does. Your third point correctly explains that. I was actually exhausting all Bs by reading 3 "c"s and stack out 6 Bs. Then I was left with 1 "c" and 0 B in stack, and I had no where to go from q8. So does the order of transitions also matter in a NFA? Can we convert this PDA into a program, and then can computer take of the order in which it should do transitions? I mean does this PDA help in writing a correct/better program? – yogeshagr Mar 16 '17 at 02:15