MHB What logic is used to build context free grammar for L= a^m b^n; m>n

  • Thread starter Thread starter shivajikobardan
  • Start date Start date
  • Tags Tags
    Build Logic
Click For Summary
The discussion centers on understanding the derivation process in context-free grammars (CFG) and how to arrive at a specific solution for generating the string "aaab." The key points include the application of grammar rules, specifically starting with the rule S→aS to build strings of the form a^nS, followed by the transition to aT to create a^{n+1}T. The process continues with the rule T→aTb, which allows for the generation of strings that include both 'a's and 'b's, culminating in the application of T→ε to finalize the derivation. The focus is on grasping the underlying patterns and problem-solving skills necessary for CFG derivations rather than rote memorization.
shivajikobardan
Messages
637
Reaction score
54
1636741535608.png
I have the solution but I am unable to decode the solution, how did we come up here? can you tell me that?
 
Technology news on Phys.org
Is the problem "Derive $aaab$? Then you are given an explicit derivation. Do you know the definition of a derivation in the context of grammars? What exactly is not clear?
 
No. I understand derivation. My problem is that I am not understanding how we came up to this solution of CFG. I want that problem solving skill to learn rather than trying to memorize this. So I am asking this. There must be some patterns of questions there right? Can you guide me a bit in this question?
 
Applying rule $S\to aS$ $n$ times where $n\ge0$ allows building strings of the form $a^nS$ from $S$. Then the only different thing to do is to apply $S\to aT$ to produce $a^{n+1}T$. After that, applying $T\to aTb$ $m$ times where $m\ge0$ produces $a^{n+1}a^mTb^m$. Finally, $T\to\varepsilon$ finishes the derivation and produces $a^{n+m+1}b^m$. These are the only strings (for some $n,m\ge0$) that one can generate using this grammar.
 

Similar threads