0

I'm currently struggling to construct a nondeterministic PDA with an amount of states in $O(n)$ that accepts the following language: $L = \{wcx \, | \, w,x \in \{a,b\}^n \land w \not= x\}$ with c being a delimiter.

In lectures we discussed DPDA that accept $wcw^R$ or NPDA that guess the middle of the word with an $\varepsilon$-transtion and accept $ww^R$.

My idea has been to save $w$ in the stack but then I can't really assure the inequality of $w$ and $x$ then.

Raphael
  • 72,336
  • 29
  • 179
  • 389
PeterMcCoy
  • 227
  • 1
  • 6
  • Have you searched thoroughly? I feel pretty confident this has been asked and answered before. See, e.g., http://cs.stackexchange.com/q/13866/755 – D.W. Jun 29 '15 at 20:32
  • @D.W. You mean like this one? – Raphael Jun 29 '15 at 20:40
  • Thanks for finding that, @Raphael! That's exactly what I was thinking of. – D.W. Jun 29 '15 at 20:43
  • @D.W I looked for similar threads and found cs.stackexchange.com/q/307/ and cs.stackexchange.com/q/18774/ and I get the idea that the automaton uses it's non-determinism to check whether $w_i$ and $x_i$ are inequal - the length can be checked by pushing every letter on the stack and popping it later but how do I combine the two methods? – PeterMcCoy Jun 29 '15 at 20:44
  • @PeterMcCoy, in the future, if you know of approaches that you considered but rejected, or you know of other questions that partially answer your question or are relevant but you rejected for some reason, you should describe them in your question and explain why you rejected them or explain your particular uncertainty. We can't read your mind, so we can only go on what's written in the question. In your case, can you build a finite-state machine to check the length? Can you build a PDA to check that $w_i \ne x_i$? Do you know any facts about the composition of a FSM and a PDA? – D.W. Jun 29 '15 at 21:00
  • @D.W Alright, I keep that in my mind altough to be honest I forgot to look in the PDA section before asking this question. A DFA to check the length would need n states and the basic $\delta(s_i,x) = s_{i+1}$ with $0 \leq i \leq n-1$ and $s_0$ as start state, $s_n$ as accepting state and $x \in {a,b}$. $\delta(s_n, x) = s_t$ with $s_t$ as trap/sink state. I found the needed construction for the composition of a DFA and PDA (it is basically a tuple construciton). The PDA would basically read/push some letters than decide to check the $w_i$ read the $c$ pop and check the following letter. – PeterMcCoy Jun 29 '15 at 21:41

0 Answers0