context-free – Test complement to ^ nb ^ nc ^ n has no context


So the complement of L1 = {$ a n n b n n c n | north $ geq $ 1} would be L2 = {a, b, c} * {$ a n n b n n c n | north $ geq $ one}.

In other words, any combination of a, b and c where we do not have an equal number of the three letters and w = $ varepsilon $ It is also legit.

However, although I am sure there should be a context-free grammar for L2, it seems that I can not find a grammar that allows you to generate the terminals freely without allowing $ a n n b n n c n with n $ geq $ one.

My attempt was to make a Boot Rule S -> $ Q _ {a} ; $ Q _ {b}} $ ; $ Q _ {c}} ; $ varepsilon $
so that the individual Q rules would allow two of the terminals a, b, and c to have an equal number, but not for the third. (in $ Q _ {a}, a is restricted by max (b, c), in $ Q _ {b}} $, b is restricted by max (a, c), in $ Q _ {c}}, c is restricted by the maximum (a, b) so that the restricted terminal can never appear as often as the unrestricted terminal with the highest count)

However, the rules I set only allow for an unlimited number of terminals without restrictions in any order. I am not sure how to implement a rule for the restricted terminal, without allowing it to have a count as high as the unrestricted ones, if the unrestricted ones have the same count.

Here is my P for G$ _ {L2} $ up to this point

S $ rightarrow $ $ Q _ {a} ; $ Q _ {b}} $ ; $ Q _ {c}} ; $ varepsilon $

$ Q _ {a} $ rightarrow $ $ Q _ {a}second $ Q _ {a} ; $ Q _ {a}do $ Q _ {a} ; $ varepsilon $

$ Q _ {b}} $ $ rightarrow $ $ Q _ {b}} $a $ Q _ {b}} $ ; $ Q _ {b}} $do $ Q _ {b}} $ ; $ varepsilon $

$ Q _ {c}} $ rightarrow $ $ Q _ {c}}a $ Q _ {c}} ; $ Q _ {c}}second $ Q _ {c}} ; $ varepsilon $

The rules for the individual restricted variable are still missing.
In what way can I add those, without breaking the

The[[$ a n n b n n c n | n = 0]ruler?

Edit: it occurred to me that I could refine the restriction rules, so that the restricted terminal can be derived from an if rule, and only if one (and only one) of the unrestricted ones is always created with it. For example:

S $ rightarrow $ $ Q _ {a} ; $ Q _ {b}} $ ; $ Q _ {c}} ; $ varepsilon $

$ Q _ {a} $ rightarrow $ $ Q _ {ab}}second $ Q _ {ab}} ; $ Q _ {ac}}do $ Q _ {ac}}

$ Q _ {ab}} $ rightarrow $ $ Q _ {ab}}second $ Q _ {ab}} ; $ Q _ {ab}}do $ Q _ {ab}} ; $ Q _ {ab}} a $ Q _ {ab}} second $ Q _ {ab}} ; $ Q _ {ab}} second $ Q _ {ab}} a $ Q _ {ab}} ; $ varepsilon $

$ Q _ {ac}} $ rightarrow $ $ Q _ {ac}}second $ Q _ {ac}} ; $ Q _ {ac}}do $ Q _ {ac}} ; $ Q _ {ac}} a $ Q _ {ac}} do $ Q _ {ac}} ; $ Q _ {ac}} do $ Q _ {ac}} a $ Q _ {ac}} ; $ varepsilon $

At this point my brain starts to run in circles. Would this put me on the right path?