If the strings of a language <math>L</math> can be effectively enumerated in lexicographic (i.e., alphabetic) order, which of the following statements is true?

(A) <math>L</math> is necessarily finite

(B) <math>L</math> is regular but not necessarily finite

(C) <math>L</math> is context free but not necessarily regular

(D) <math>L</math> is recursive but not necessarily context free


Solution by Arjun Suresh

Since, the strings of <math>L</math> can be enumerated it means <math>L</math> is recursively enumerable. That is we have a <math>TM</math> which accepts all strings in <math>L</math>. Now, to be recursive the <math>TM</math> should reject all strings not in <math>L</math>. Since, the strings of the language can be enumerated in lexicographic order, it's easy to do this. For any word <math>w</math>, if we see a word in the enumeration which is lexicographically higher than <math>x</math> but no <math>w</math>, it means <math>w</math> is not in the language. This makes <math>L</math> recursive.

Now, why is <math>L</math> need not be context free? Consider <math>L = \{a^nb^nc^n | n\ge 0\}</math>. The strings of this language can be enumerated in lexicographic order. But we know <math>L</math> is not context free as no <math>PDA</math> can accept <math>L</math>.




blog comments powered by Disqus

If the strings of a language <math>L</math> can be effectively enumerated in lexicographic (i.e., alphabetic) order, which of the following statements is true?

(A) <math>L</math> is necessarily finite

(B) <math>L</math> is regular but not necessarily finite

(C) <math>L</math> is context free but not necessarily regular

(D) <math>L</math> is recursive but not necessarily context free


Solution by Arjun Suresh[edit]

Since, the strings of <math>L</math> can be enumerated it means <math>L</math> is recursively enumerable. That is we have a <math>TM</math> which accepts all strings in <math>L</math>. Now, to be recursive the <math>TM</math> should reject all strings not in <math>L</math>. Since, the strings of the language can be enumerated in lexicographic order, it's easy to do this. For any word <math>w</math>, if we see a word in the enumeration which is lexicographically higher than <math>x</math> but no <math>w</math>, it means <math>w</math> is not in the language. This makes <math>L</math> recursive.

Now, why is <math>L</math> need not be context free? Consider <math>L = \{a^nb^nc^n | n\ge 0\}</math>. The strings of this language can be enumerated in lexicographic order. But we know <math>L</math> is not context free as no <math>PDA</math> can accept <math>L</math>.




blog comments powered by Disqus