In homework we got to build a pushdown automaton for 2 languages, but in my opinion these are two exercises for which the automaton is the same for both.
As I understand it, we can build a non-deterministic pushdown automaton, and each time we read the character a, we can insert either a single A or twice A - at the 'discretion' of the automaton.
Next, a state is built for the character b, which each time he reads A he will pull it out of the stack. In this way, the automaton knows how to handle both languages where the amount of a is equal to the amount of b, and also languages where like a is twice the amount of b.
Am I right? Or am I missing something?
If not, I would love to understand how to deal with the “or” condition in the first exercise.
Thank you.
