title: Context-free grammar for the language L = {a^(n)b^(m)c^(k): m = |i - k|}
body: <p>I have this language <code>L = {a^n b^m c^k: m = |n - k|}</code>. <br /><br />
  I know <code>m = |n - k|</code> can be expressed in two ways
  <code>
  1) m = n - k for n &gt;= k or n = m + k
  2) m = k - n for k &gt;= n or k = m + n
  </code><br />
  Therefore, I get two languages where <br />
  <code>L1 = {a^n b^m c^k: n = m + k}</code> and
  <code>L2 = {a^n b^m c^k: k = m + n}</code>. <br />
  Then I claimed <code>L</code> is the union of the two, <code>L = L1 U L2</code>.</p>
  
  <p>I don't quite understand how to generate a grammar where one exponent of a terminal is the summation of the other two terminals. i.e, in <code>L1</code> you have <code>n = m + k</code>. <br />
  Also <code>L1</code> can be simplified further to <br />
  <code>a^n =&gt; a^(m+k) =&gt; a^(m)a^(k)</code> so <code>L1</code> becomes <br />
  <code>L1 = {a^m a^k b^m c^k: m, k &gt;= 0}</code>
  <br /><br />
  Attempt answer for
  <code>L1 = {a^m a^k b^m c^k: m, k &gt;= 0}</code> <br />
  A grammar G1 <br />
  <code>S -&gt; A|B</code> <br />
  <code>A -&gt; aAb|lambda</code> <br />
  <code>B -&gt; aBc|lambda</code></p>