Which of the following definitions below generate the same language as , where ?
-
-
)
-
View worked solution
Answer: A
We analyze each definition to see if it generates the language :
- Definition I: The context-free grammar has the base case (). Each recursive application of adds one to the left and one to the right, generating exactly for . Thus, Definition I is correct.
- Definition II: The expression generates strings of the form where . This includes strings like where the number of 's and 's are unequal. Thus, it does not generate .
- Definition III: The regular expression generates all strings with one or more 's followed by one or more 's (i.e., for ). Since the counts of and do not have to be equal, it does not generate .
Therefore, only definition I generates the language .
Free practice · Your answers on this page are not saved.
