The language {aⁿbⁿcⁿ | n ∈ ℕ} #
For letters a, b and c, Language.anbncn a b c is the language of the words consisting of
n copies of a, then n copies of b, then n copies of c. For distinct letters it is not
context-free, the standard application of the pumping lemma: a window of the pumped word
aᵖbᵖcᵖ no longer than p cannot meet both the a block and the c block, so pumping it out
leaves the count of a or of c at p while removing letters.
The argument shows more: a language that contains aⁿbⁿcⁿ for infinitely many n, and whose
words all have as many a as b as c, is not context-free.
Main definitions #
Language.anbncn a b c: the language{aⁿbⁿcⁿ | n ∈ ℕ}.
Main results #
Language.not_isContextFree_of_replicate_mem_of_count_eq: a language containing infinitely many of the wordsaⁿbⁿcⁿ, whose words have as manyaasbasc, is not context-free.Language.not_isContextFree_anbncn: for distinct letters,{aⁿbⁿcⁿ}is not context-free.
References #
The language {aⁿbⁿcⁿ | n ∈ ℕ} of the words consisting of n copies of the letter a, then
n copies of b, then n copies of c.
Equations
- Language.anbncn a b c = {w : List α | ∃ (n : ℕ), List.replicate n a ++ List.replicate n b ++ List.replicate n c = w}
Instances For
A language containing aⁿbⁿcⁿ for infinitely many n, whose words have as many a as b
as c, is not context-free. Pumping out a window of aⁿbⁿcⁿ no longer than the pumping length
leaves a or c untouched, so by the counts no letter is removed at all.
For distinct letters, {aⁿbⁿcⁿ} is not context-free.