Construct PDA that accepts the language $ L = \{ w \in \{ a,b,c\}^*; |w|_c=|w|_a + |w|_b \} $

196 Views Asked by At

Problem Construct PDA that accepts the language $ L = \{ w \in \{ a,b,c\}^*; |w|_c=|w|_a + |w|_b \} $

My first idea was this:

  • There can be an "a","b" or a "c" at the beginning of a word
  • Then we have to differentiate for every new character we read:
    • First letter was a: we need at least one "c" to finish
    • First letter was b: we need at least one "c" to finish
    • First letter was c: we need at least one "a" OR "b" to finish

And here is my PDA:

enter image description here

Are my thoughts correct? Any idea or suggestion would be greatly appreciated. Thank you very much.