-1
$\begingroup$

create a grammer for {a^nb^m, n>0, m=2^n+1}

itS unrestricted grammer. I tried to but couldnt understand. if you know the answer please breif it. coz i m new in this subject

$\endgroup$

marked as duplicate by D.W. Sep 14 '15 at 23:04

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ Hello! We discourage posts that simply state a problem out of context, and expect the community to solve it. Assuming you tried to solve it yourself and got stuck, it may be helpful if you wrote your thoughts and what you could not figure out. It will definitely draw more answers to your post. Until then, the question will be voted to be closed / downvoted. You may also want to check out our reference questions, or use the search engine of this site to find similar questions that were already answered. $\endgroup$ – D.W. Sep 14 '15 at 23:05
  • $\begingroup$ Anyway, one approach is to create a Turing machine that recognizes that language, then convert it to a grammar using the answers in the duplicate. Since you haven't provided us any context, you haven't shown us what you have tried and what you are stuck on or confused by, and you haven't asked a question (but just asked us to solve your exercise for you -- which helps neither you nor future visitors), I've put this on hold as a duplicate of that question. $\endgroup$ – D.W. Sep 14 '15 at 23:05
0
$\begingroup$

Hint 1. try build some automaton (Turing machine, etc.) that accept strings of given pattern, then encode both states and transitions in the grammar.

Hint 2. try some scanning process to generate $\{b^m|m=2^n+1\}$, then generate $\{a^n\}$ USING THE SAME TECHNIQUE, and try to merge them.

Some examples:

  1. Start from n=0, the sequence is bb,abbb,aabbbbb,aaabbbbbbbbb,... noticing the changes from adjacent items.
  2. Using a state variable to scan from left to right and processing, then back. $$Acc \to aAcc \to abbAc \to abbbbA \to \underline{abbbB} \to Aaccc$$ $$Aaccc\to aaAccc \to aabbAcc \to aabbbbAc \to aabbbbbbA \to \underline{aabbbbbB} \to Aaaccccc$$
  3. To make up for the direction change, and extra processing at both ends, using delimiters $\#$. Now start symbol $S\to\#Acc\#$
  4. Get rid of the state variable and delimiters at the end. But only get rid of them on accepted state.
$\endgroup$
  • $\begingroup$ uhmmm problem is i dnt know how turning machine works and i dnt get it the 2nd one $\endgroup$ – apcoder Sep 14 '15 at 23:08

Not the answer you're looking for? Browse other questions tagged or ask your own question.