Search code examples
computation-theorynfapushdown-automaton

Push down automata for a language


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.


Solution

  • 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.