0

I'm stuck on a PDA question. The question is as follows:

Find push-down automata for the following languages: L={xcy : x, y ∈ (a+b)*, y is not the reverse of x, c is literal}

I've built the following machine: https://i.stack.imgur.com/ZqBkW.jpg

My machine does not accept strings of form xc (where y is the empty string), or any string of form xcy, |y| < |x|, y is not the reversal of x.

I need to make the machine transition from q1 to q2 when the input ends, but the stack is not empty... But adding an empty input transition from q1 to q2 would cause my machine to accept all strings of form xcy, regardless of whether y is the reversal of x.

Any insight is appreciated.

connorbode
  • 3,015
  • 1
  • 28
  • 31

1 Answers1

0

A real brain-teaser, since 'pure' PDAs are unable to explicitly match end of input.

With only empty input transitions at your disposal, you'll need to point the empty input transitions (with anything but Z atop the stack) at a new accepting state q3 which has no further transitions possible; nondeterminism will make q3 an irrelevant sideline whenever there is more input to be read and an accepting path when q1 hits end of input with stuff still on the stack.

EDIT: this modification in JFLAP: JFLAP screenshot

Jeffrey Hantin
  • 35,734
  • 7
  • 75
  • 94
  • I had initially: 1) marked q1 as final; 2) had another non-final state q3; 3) had a transition function from q1 to q3 __lambda, F, F__ .. I was running simulations using JFlap and it was accepting strings which emptied the stack.. ie they weren't taking that final transition.. – connorbode Nov 06 '13 at 05:17
  • Thanks for the pointer, I wasn't even aware of JFlap until you mentioned it. – Jeffrey Hantin Nov 06 '13 at 05:52