PDA to accept a language of strings containing more a's than b's

后端 未结 5 767
一生所求
一生所求 2021-02-11 01:30

Produce a PDA to recognise the following language : the language of strings containing more a\'s than b\'s

I have been struggling with this

5条回答
  •  遇见更好的自我
    2021-02-11 02:11

    I have come up with a more general solution to the problem concerning the number of as and bs, see the picture below:

    where a > b means more as than bs and so does a < b , a = b.

    Z means the bottom of stack, and A/B are stack symbols.

    I'm excited about it because this PDA seperates the 3 different states. In your problem, you can just set the a > b state to be the final state and let a = b be the start state.

    And if you want to step further, you can use this PDA to easily generate PDAs for a >= b, a - b >= 1, 2 <= a - b <= 3 etc, which is fascinating.

提交回复
热议问题