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