I having trouble constructing NPDAs for these two languages:
$L_1 = \{a^nb^m \mid 2n \le m \le 3n\}$
$L_2 = \{a^nb^mc^k \mid n = m \: or \: m \ne k\}$
Would these be the proper states for the first one?
- $q_0$ – reading $a$’s (initial state)
- $q_1$ – reading $b$’s and popping $A$’s
- $q_2$ – reading $b$’s
- $q_f$ – final state
Would these be the proper states for the second one?
- $q_0$ – reading $a$’s (initial state)
- $q_1$ – reading $b$’s and popping $A$’s
- $q_2$ – reading $b$’s and pushing $B$’s
- $q_3$ – reading $c$’s
- $q_f$ – final state
I do not think I am approaching this properly. This is not non deterministic right? How should I do this?
bsymbols. When the machine is in state $s_0$ it knows it has not seen anybsymbols yet. When it is in state $s_1$, it knows it has seen onebsymbol, because $\delta(s_0, \mathtt{b}) = s_1$. Similarly in state $s_2$ the machine knows it has seen twobsymbols. To reset the counter simply means to return to state $s_0$. – MJD Apr 10 '14 at 14:430s and one counting how many1s it has seen. The machine accepts the input if it has seen at least two0s and at most two1s. – MJD Apr 10 '14 at 14:46Is that right?
– user314159 Apr 11 '14 at 01:02