This language is not context-free. Suppose it were, and define the homomorphism
Then closure under inverse homomorphism and intersection of a context-free language with a regular language would make
context-free. The equality holds because the midpoint of a square with four nonempty alternating runs must lie between its second and third runs.
Apply the pumping lemma for context-free languages to . A pumpable window of length at most meets at most two adjacent blocks. Pumping changes at least one block but cannot reach its equal-count partner two blocks away, so either the counts or the counts cease to agree. This contradiction proves the claim.
The equations force , , , and . Hence the language is
It is context-free; one explicit context-free grammar is
This language is not context-free. Let be a proposed pumping length and choose with . In any pumping decomposition of the unary word , pumping once more increases its length by an integer with . But
so the pumped length is not a power of three, contrary to the pumping lemma for context-free languages. This is also an instance of the fact that a unary context-free language is regular, whereas the powers of three are not ultimately periodic.

Articles by others on the same topic (0)

There are currently no matching articles.