HOME

TheInfoList



OR:

In
formal language theory In logic, mathematics, computer science, and linguistics, a formal language is a set of string (computer science), strings whose symbols are taken from a set called "#Definition, alphabet". The alphabet of a formal language consists of symbol ...
, a
grammar In linguistics, grammar is the set of rules for how a natural language is structured, as demonstrated by its speakers or writers. Grammar rules may concern the use of clauses, phrases, and words. The term may also refer to the study of such rul ...
is noncontracting (or monotonic) if for all of its production rules, α → β (where α and β are strings of
nonterminal In formal languages, terminal and nonterminal symbols are parts of the ''vocabulary'' under a formal grammar. ''Vocabulary'' is a finite, nonempty set of symbols. ''Terminal symbols'' are symbols that cannot be replaced by other symbols of the v ...
and terminal symbols), it holds that , α, ≤ , β, , that is β has at least as many symbols as α. A grammar is essentially noncontracting if there may be one exception, namely, a rule ''S'' → ε where ''S'' is the start symbol and ε the
empty string In formal language theory, the empty string, or empty word, is the unique String (computer science), string of length zero. Formal theory Formally, a string is a finite, ordered sequence of character (symbol), characters such as letters, digits ...
, and furthermore, ''S'' never occurs in the right-hand side of any rule. A
context-sensitive grammar A context-sensitive grammar (CSG) is a formal grammar in which the left-hand sides and right-hand sides of any Production (computer science), production rules may be surrounded by a context of terminal symbol, terminal and nonterminal symbols. Cont ...
is a noncontracting grammar in which all rules are of the form αAβ → αγβ, where A is a nonterminal, and γ is a nonempty string of nonterminal and/or terminal symbols. However, some authors use the term context-sensitive grammar to refer to noncontracting grammars in general. A noncontracting grammar in which , α, < , β, for all rules is called a
growing context-sensitive grammar In formal language theory, a growing context-sensitive grammar is a context-sensitive grammar in which the productions increase the length of the sentences being generated. These grammars are thus noncontracting and context-sensitive. A growing con ...
.


History

Chomsky (1959) introduced the
Chomsky hierarchy The Chomsky hierarchy in the fields of formal language theory, computer science, and linguistics, is a containment hierarchy of classes of formal grammars. A formal grammar describes how to form strings from a formal language's alphabet that are v ...
, in which context-sensitive grammars occur as "type 1" grammars; general noncontracting grammars do not occur. Chomsky (1963) calls a noncontracting grammar a "type 1 grammar", and a context-sensitive grammar a "type 2 grammar", and by presenting a conversion from the former into the latter, proves the two weakly equivalent . Kuroda (1964) introduced Kuroda normal form, into which all noncontracting grammars can be converted.


Example

This grammar, with the start symbol ''S'', generates the language , which is not context-free due to the pumping lemma. A context-sensitive grammar for the same language is shown
below Below may refer to: *Earth *Ground (disambiguation) *Soil *Floor * Bottom (disambiguation) *Less than *Temperatures below freezing *Hell or underworld People with the surname * Ernst von Below (1863–1955), German World War I general * Fred Belo ...
.


Expressive power

Every
context-sensitive grammar A context-sensitive grammar (CSG) is a formal grammar in which the left-hand sides and right-hand sides of any Production (computer science), production rules may be surrounded by a context of terminal symbol, terminal and nonterminal symbols. Cont ...
is a noncontracting grammar. There are easy procedures for * bringing any noncontracting grammar into
Kuroda normal form In formal language theory, a noncontracting grammar is in Kuroda normal form if all production rules are of the form: :''AB'' → ''CD'' or :''A'' → ''BC'' or :''A'' → ''B'' or :''A'' → ''a'' where A, B, C and D are nonterminal symbols and ...
, and * converting any noncontracting grammar in
Kuroda normal form In formal language theory, a noncontracting grammar is in Kuroda normal form if all production rules are of the form: :''AB'' → ''CD'' or :''A'' → ''BC'' or :''A'' → ''B'' or :''A'' → ''a'' where A, B, C and D are nonterminal symbols and ...
into a context-sensitive grammar. Hence, these three types of grammar are equal in expressive power, all describing exactly the
context-sensitive language In formal language theory, a context-sensitive language is a language that can be defined by a context-sensitive grammar (and equivalently by a noncontracting grammar). Context-sensitive is known as type-1 in the Chomsky hierarchy of formal langu ...
s that do not include the empty string; the essentially noncontracting grammars describe exactly the set of
context-sensitive language In formal language theory, a context-sensitive language is a language that can be defined by a context-sensitive grammar (and equivalently by a noncontracting grammar). Context-sensitive is known as type-1 in the Chomsky hierarchy of formal langu ...
s.


A direct conversion

A direct conversion into context-sensitive grammars, avoiding Kuroda normal form: For an arbitrary noncontracting grammar (''N'', Σ, ''P'', ''S''), construct the context-sensitive grammar (''N''’, Σ, ''P''’, ''S'') as follows: # For every terminal symbol ''a'' ∈ Σ, introduce a new nonterminal symbol 'a''∈ ''N''’, and a new rule ( 'a''→ ''a'') ∈ ''P''’. # In the rules of ''P'', replace every terminal symbol ''a'' by its corresponding nonterminal symbol 'a'' As a result, all these rules are of the form → for nonterminals ''X''''i'', ''Y''''j'' and ''m''≤''n''. # Replace each rule → with ''m''>1 by 2''m'' rules:For convenience, the non-context part of left and right hand side is shown in boldface. :: ::where each ''Z''''i'' ∈ ''N''’ is a new nonterminal not occurring elsewhere. Exercise 9.9, p.230. In the 2003 edition, the chapter on noncontracting / context-sensitive languages has been omitted. For example, the
above Above may refer to: *Above (artist) Tavar Zawacki (b. 1981, California) is a Polish, Portuguese - American abstract artist and internationally recognized visual artist based in Berlin, Germany. From 1996 to 2016, he created work under the ...
noncontracting grammar for leads to the following context-sensitive grammar (with start symbol ''S'') for the same language:


See also

*
Context-sensitive grammar A context-sensitive grammar (CSG) is a formal grammar in which the left-hand sides and right-hand sides of any Production (computer science), production rules may be surrounded by a context of terminal symbol, terminal and nonterminal symbols. Cont ...
*
Growing context-sensitive grammar In formal language theory, a growing context-sensitive grammar is a context-sensitive grammar in which the productions increase the length of the sentences being generated. These grammars are thus noncontracting and context-sensitive. A growing con ...
*
Kuroda normal form In formal language theory, a noncontracting grammar is in Kuroda normal form if all production rules are of the form: :''AB'' → ''CD'' or :''A'' → ''BC'' or :''A'' → ''B'' or :''A'' → ''a'' where A, B, C and D are nonterminal symbols and ...


Notes


References

* * {{Formal languages and grammars, state=collapsed Formal languages