-7

Please help me find a grammar or automaton to decide the following language:

anbncn where n≥1

kennytm
  • 510,854
  • 105
  • 1,084
  • 1,005
rahul
  • 9
  • you could at least try to give a more precise description of your problem... – Milan Mar 22 '10 at 15:31
  • 1
    You need to elaborate on this more. What programming language are you using, what is this for, what have you done already? We're not mind readers and we're not monkeys. – John B Mar 22 '10 at 15:31
  • 3
    As a telepathic simian, I resent your attempts to divide the community. – Tom Mar 22 '10 at 15:32
  • Someone voted this question up? I defy them to defend that upvote as a non-sympathy upvote. – Beska Mar 22 '10 at 15:34
  • First, this really should include what the poster means by "a grammar or automaton". Second, writing a grammar of the sort that will actually work is pretty trivial, so if this were reopened I'd be tempted to vote to close as "too specific". SO really isn't a place to ask overly specific homework questions. – David Thornley Mar 22 '10 at 15:56
  • 5
    @David: Yes, SO is a place to ask overly specific homework questions, as long as it's understood that the question is homework. Moreover, anyone with a background in computer science knows what the terms "grammar" and "automaton" mean, especially given the context of deciding languages. – Welbog Mar 22 '10 at 16:06
  • 2
    @Welbog: SO is an excellent place for homework questions, but the question here is not labeled homework. It's an excellent place for specific questions, but this appears to me to be too specific. And, yes, I know what those terms are. I wasn't as precise as I should have been; what I'd like is some indication that the questioner has an actual clue about the question. I don't think that's too much to ask. – David Thornley Mar 22 '10 at 16:46
  • @David: I agree that a clue is a nice thing for askers to have, but there's often a language barrier. What we perceive as lack of knowledge might in fact be lack of vocabulary instead. Since this is this user's first question, I tend to side on the vocabulary side. If he establishes a history of not knowing what he's talking about I will change my mind. The way I see it, the question is better left open and answered until such time as the user reveals his true intentions, if he does at all. – Welbog Mar 22 '10 at 16:55
  • @Welbog: Could be; either this question is triggering my spidey sense, or it's Monday, or something else, or some combination. I do like the answer you provided. – David Thornley Mar 22 '10 at 17:29

1 Answers1

4

This language fails the pumping lemma for context-free languages (in fact, this very language is used as the example for the CFL pumping lemma), so it's neither regular nor context-free. Meaning your best bet is with a Turing machine.

It's definitely a decidable language. Hopefully knowing what type of automaton to use will help you find the problem on your own. Since this look like homework that's the most clues I will give you.

Welbog
  • 59,154
  • 9
  • 110
  • 123