If the strings of a language can be effectively enumerated in lexicographic (i.e., alphabetic) order, which of the following statements is true?
View worked solution
Answer: D
A language is recursive (decidable) if and only if its strings can be effectively enumerated in lexicographic (alphabetic) order.
1. Why is recursive?
To show that is recursive, we must design a Turing Machine (decider) that halts on all inputs and decides membership for any string :
- If is finite, it is trivially recursive.
- If is infinite, we can run the lexicographic enumerator for . Since the enumerator outputs strings in strictly increasing lexicographic order (first by length, then alphabetically):
- If the enumerator outputs , we halt and accept.
- If the enumerator outputs a string lexicographically larger than , we know will never appear. We halt and reject.
Since the enumerator is effective and the order is lexicographic, this decision procedure is guaranteed to terminate in finite steps for any string . Thus, is recursive.
2. Why is not necessarily context-free?
There are many recursive languages that are not context-free. For example, the language is recursive and can be easily enumerated in lexicographic order, but it is a well-known non-context-free language.
Therefore, is recursive but not necessarily context-free.
Free practice · Your answers on this page are not saved.
