2

I am working on finding a PDA that accepts the following language:

L = {0^i 1^j 0^k 1^l | i < j and k < l}

I am having trouble figuring out how to break this down/ where to start. I am able to form simpler PDA's such as when there are twice as many 0's as 1's but am drawing a blank on what approach to take to begin to solve.

Are there any methods or algorithmic approaches to forming a PDA for a given language?

edit: this is NOT a duplicate of the question that was flagged, that question asks how to determine if a grammar is context-free, this is completely different.

So far I have developed this PDA but for some reason it accepts 0101 which should fail, I haven't figured out how it manages to pass through the first portion from the first accepting state:

enter image description here

foobarbaz
  • 177
  • 7

1 Answers1

1

If you can find a PDA for the language $L_0 = \{ 0^i 1^j : i < j \}$, then you can probably find a PDA for your language as well, which is just $L_0^2$. Hence I suggest the following plan:

  • Figure out a PDA for $L_0$.
  • Figure out a general construction that, given PDAs for languages $L_1,L_2$, outputs a PDA for their concatenation $L_1 L_2$.
  • Apply the construction to the PDA you found in the first step.
Yuval Filmus
  • 276,994
  • 27
  • 311
  • 503
  • This makes a lot of sense. To concatenate the two languages in a PDA can I have two accepting states connected by an epsilon input that sees an epsilon (empty) on the stack and pushes another epsilon to initiate the second language? – foobarbaz Feb 24 '18 at 21:16
  • The answer depends on your acceptance condition. At any rate, I believe you can figure this out on your own. – Yuval Filmus Feb 24 '18 at 21:24