Formally, a context-sensitive language is a formal grammar , such that given any production in , it
either has the form
where , , and , the empty word,
or is , provided that the start symbol does not occur on the right side of any productions in .
In other words, if does not contain the production , then any production will have the form in condition 1. On the other hand, if does contain , then for any production of , does not occur in .
The reason for including the second condition is to ensure the possibility that may be generated by the grammar.
One may interpret the first condition as follows: the non-terminal symbol can only be transformed into the word if it is surrounded by and , or that it is in the “context” of . If in each production of , , (so that no longer has a “context”), then is a context-free grammar.
Given a context-sensitive grammar , the context-sensitive language generated by is . In other words,
where is the set of terminals, and means that the word over is produced after a finite number of applications of the productions in to .
With condition 2, we see that a context-sensitive language contains iff it is generated by a context-sensitive grammar containing . With condition 2, every context-free language is context-sensitive. Without condition 2, every -free context-free language is -free context-sensitive.
and are examples of context-sensitive languages that are not context-free, the second of which is -free.
A formal grammar is said to be length-increasing if for every production of , the length of is at most the length of : . Every context-sensitive grammar not containing (condition 2) is length-increasing. Conversely, any language generated by a length-increasing grammar is context-sensitive.
Given a context-sensitive language and a word , it is decidable whether .
|Date of creation||2013-03-22 16:28:40|
|Last modified on||2013-03-22 16:28:40|
|Last modified by||CWoo (3771)|