Chomsky hierarchy

Within the fields of computer science and linguistics, specifically in the area of formal languages, the Chomsky hierarchy (occasionally referred to as Chomsky-Schützenberger hierarchy) is a containment hierarchy of classes of formal grammars. This hierarchy of grammars was described by Noam Chomsky in 1956.[1] It is also named after Marcel-Paul Schützenberger, who played a crucial role in the development of the theory of formal languages.

Formal grammars

Main article: Formal grammar

A formal grammar of this type consists of a finite set of production rules (left-hand side right-hand side), where each side consists of a sequence of the following symbols:

A formal grammar defines (or generates) a formal language, which is a (usually infinite) set of finite-length sequences of symbols that may be constructed by applying production rules to another sequence of symbols (which initially contains just the start symbol). A rule may be applied by replacing an occurrence of the symbols on its left-hand side with those that appear on its right-hand side. A sequence of rule applications is called a derivation. Such a grammar defines the formal language: all words consisting solely of terminal symbols which can be reached by a derivation from the start symbol.

Nonterminals are often represented by uppercase letters, terminals by lowercase letters, and the start symbol by S. For example, the grammar with terminals {a, b}, nonterminals {S, A, B}, production rules

S ABS
S ε (where ε is the empty string)
BA AB
BS b
Bb bb
Ab ab
Aa aa

and start symbol S, defines the language of all words of the form  a^n b^n (i.e. n copies of a followed by n copies of b).

The following is a simpler grammar that defines the same language: Terminals {a, b}, Nonterminals {S}, Start symbol S, Production rules

S aSb
S ε

As another example, a grammar for a toy subset of English language is given by:

terminals
{generate, hate, CIA, great, green, ideas, bane, linguists}
nonterminals
{SENTENCE, NOUNPHRASE, VERBPHRASE, NOUN, VERB, ADJ}
production rules
SENTENCE NOUNPHRASE VERBPHRASE
NOUNPHRASE ADJ NOUNPHRASE
NOUNPHRASE NOUN
VERBPHRASE VERB NOUNPHRASE
VERBPHRASE VERB
NOUN ideas
NOUN linguists
VERB generate
VERB hate
ADJ great
ADJ green

and start symbol SENTENCE. An example derivation is

SENTENCE NOUNPHRASE VERBPHRASE ADJ NOUNPHRASE VERBPHRASE ADJ NOUN VERBPHRASE ADJ NOUN VERB NOUNPHRASE ADJ NOUN VERB ADJ NOUNPHRASE ADJ NOUN VERB ADJ ADJ NOUNPHRASE ADJ NOUN VERB ADJ ADJ NOUN great NOUN VERB ADJ ADJ NOUN great linguists VERB ADJ ADJ NOUN great linguists generate ADJ ADJ NOUN great linguists generate great ADJ NOUN great linguists generate great green NOUN great linguists generate great green ideas.

Other sequences that can be derived from this grammar are: "ideas hate great linguists", and "ideas generate". While these sentences are nonsensical, they are syntactically correct. A syntactically incorrect sentence ( e.g. "ideas ideas great hate") cannot be derived from this grammar. See "Colorless green ideas sleep furiously" for a similar example given by Chomsky in 1957; see Phrase structure grammar and Phrase structure rules for more natural language examples and the problems of formal grammar in that area.

The hierarchy

The Chomsky hierarchy
Set inclusions described by the Chomsky hierarchy

The Chomsky hierarchy consists of the following levels:

Note that the set of grammars corresponding to recursive languages is not a member of this hierarchy; these would be properly between Type-0 and Type-1.

Every regular language is context-free, every context-free language (not containing the empty string) is context-sensitive, every context-sensitive language is recursive and every recursive language is recursively enumerable. These are all proper inclusions, meaning that there exist recursively enumerable languages which are not context-sensitive, context-sensitive languages which are not context-free and context-free languages which are not regular.

Summary

The following table summarizes each of Chomsky's four types of grammars, the class of language it generates, the type of automaton that recognizes it, and the form its rules must have.

Grammar Languages Automaton Production rules (constraints)
Type-0 Recursively enumerable Turing machine \alpha \rightarrow \beta (no restrictions)
Type-1 Context-sensitive Linear-bounded non-deterministic Turing machine \alpha A \beta \rightarrow \alpha \gamma \beta
Type-2 Context-free Non-deterministic pushdown automaton A \rightarrow \gamma
Type-3 Regular Finite state automaton A \rightarrow a
and
A \rightarrow aB

There are further categories of formal languages, some of which are given in the expandable navigation box at the bottom of this page.

References

  1. Chomsky, Noam (1956). "Three models for the description of language" (PDF). IRE Transactions on Information Theory (2): 113–124. doi:10.1109/TIT.1956.1056813.

This article is issued from Wikipedia - version of the Sunday, May 01, 2016. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.