chomskyaway/CA215/jie_w2.pdf · 2009-10-08 · Personalities Languages Grammars Chomsky Hierarchy...

32
Personalities Languages Grammars Chomsky Hierarchy Summary CHOMSKY HIERARCHY Jie Jiang October 4, 2009 Jie Jiang CHOMSKY HIERARCHY

Transcript of chomskyaway/CA215/jie_w2.pdf · 2009-10-08 · Personalities Languages Grammars Chomsky Hierarchy...

Page 1: chomskyaway/CA215/jie_w2.pdf · 2009-10-08 · Personalities Languages Grammars Chomsky Hierarchy Summary Noam Chomsky Marcel Schu¨tzenberger Avram Noam Chomsky Born on December

PersonalitiesLanguagesGrammars

Chomsky HierarchySummary

CHOMSKY HIERARCHY

Jie Jiang

October 4, 2009

Jie Jiang CHOMSKY HIERARCHY

Page 2: chomskyaway/CA215/jie_w2.pdf · 2009-10-08 · Personalities Languages Grammars Chomsky Hierarchy Summary Noam Chomsky Marcel Schu¨tzenberger Avram Noam Chomsky Born on December

PersonalitiesLanguagesGrammars

Chomsky HierarchySummary

Noam ChomskyMarcel Schutzenberger

Avram Noam Chomsky

Born on December 7, 1928, currentlyprofessor emeritus of linguistics at MIT.

Americanlinguist, philosopher, cognitive scientist,political activist, author, and lecturer.

One of the fathers of modern linguistics.

Created the theory of generativegrammar, which has undergonenumerous revisions and has had a profound influence onlinguistics.

Sparkedthe cognitive revolution in psychology.

Jie Jiang CHOMSKY HIERARCHY

Page 3: chomskyaway/CA215/jie_w2.pdf · 2009-10-08 · Personalities Languages Grammars Chomsky Hierarchy Summary Noam Chomsky Marcel Schu¨tzenberger Avram Noam Chomsky Born on December

PersonalitiesLanguagesGrammars

Chomsky HierarchySummary

Noam ChomskyMarcel Schutzenberger

Biography

From1945, studied philosophy and linguisticsat the University of Pennsylvania.

PhD in linguistics fromUniversity of Pennsylvania in 1955.

1956, appointedfull Professor at MIT, Departmentof Linguistics and Philosophy.

1966,Ferrari P. Ward Chair; 1976, InstituteProfessor; currently Professor Emeritus.

Jie Jiang CHOMSKY HIERARCHY

Page 4: chomskyaway/CA215/jie_w2.pdf · 2009-10-08 · Personalities Languages Grammars Chomsky Hierarchy Summary Noam Chomsky Marcel Schu¨tzenberger Avram Noam Chomsky Born on December

PersonalitiesLanguagesGrammars

Chomsky HierarchySummary

Noam ChomskyMarcel Schutzenberger

Contribution

Linguistics

Transformational grammarsGenerative grammarLanguage aquisition

Computer Science

Chomsky hierarchyChomsky Normal FormContext Free Grammars

Psychology

Cognitive Revolution (1959)Universal grammar

Jie Jiang CHOMSKY HIERARCHY

Page 5: chomskyaway/CA215/jie_w2.pdf · 2009-10-08 · Personalities Languages Grammars Chomsky Hierarchy Summary Noam Chomsky Marcel Schu¨tzenberger Avram Noam Chomsky Born on December

PersonalitiesLanguagesGrammars

Chomsky HierarchySummary

Noam ChomskyMarcel Schutzenberger

Universal grammar

Noam Chomsky’s approach to the study of language is knownas universal grammar:

the human brain contains a limited set of rules for organizinglanguage. In turn, there is an assumption that all languageshave a common structural basis. This set of rules is known asuniversal grammaran innate set of linguistic principles shared by all humansattempts to explain language acquisition in general, notdescribe specific languagesproposes a set of rules intended to explain language acquisitionin child development

Jie Jiang CHOMSKY HIERARCHY

Page 6: chomskyaway/CA215/jie_w2.pdf · 2009-10-08 · Personalities Languages Grammars Chomsky Hierarchy Summary Noam Chomsky Marcel Schu¨tzenberger Avram Noam Chomsky Born on December

PersonalitiesLanguagesGrammars

Chomsky HierarchySummary

Noam ChomskyMarcel Schutzenberger

Marcel-Paul Schutzenberger

October24, 1920 − July 29, 1996.

French mathematicianand Doctor of Medicine.

Professor of the Facultyof Sciences, University of Paris

Full Memberof French Academy of Sciences.

Jie Jiang CHOMSKY HIERARCHY

Page 7: chomskyaway/CA215/jie_w2.pdf · 2009-10-08 · Personalities Languages Grammars Chomsky Hierarchy Summary Noam Chomsky Marcel Schu¨tzenberger Avram Noam Chomsky Born on December

PersonalitiesLanguagesGrammars

Chomsky HierarchySummary

Noam ChomskyMarcel Schutzenberger

Biography

First trained as a physician,doctorate in medicine in 1948.

PhD in mathematics in 1953

Professor at theUniversity of Poitiers, 1957-1963

Director of researchat the CNRS, 1963-1964

Professorin the Faculty of Sciences at theUniversity of Paris, 1964-1996

Jie Jiang CHOMSKY HIERARCHY

Page 8: chomskyaway/CA215/jie_w2.pdf · 2009-10-08 · Personalities Languages Grammars Chomsky Hierarchy Summary Noam Chomsky Marcel Schu¨tzenberger Avram Noam Chomsky Born on December

PersonalitiesLanguagesGrammars

Chomsky HierarchySummary

Noam ChomskyMarcel Schutzenberger

Contribution

Formallanguages with Noam Chomsky

Chomsky-SchutzenbergerhierarchyChomsky-Schutzenbergertheorem

Automatawith Samuel Ellenberger

Biology and Darwinism

Mathematical critique ofneodarwinism (1966)

Jie Jiang CHOMSKY HIERARCHY

Page 9: chomskyaway/CA215/jie_w2.pdf · 2009-10-08 · Personalities Languages Grammars Chomsky Hierarchy Summary Noam Chomsky Marcel Schu¨tzenberger Avram Noam Chomsky Born on December

PersonalitiesLanguagesGrammars

Chomsky HierarchySummary

AlphabetsLanguages

Alphabet

In computational practice, data are encoded in the computer’smemory as strings of bits or other symbols appropriate formanipulation by a computer.How to understand the mathematics of strings of symbols?Definition: An alphabet is a finite, nonempty set of symbols.We use Σ to denote this alphabet.

the Roman alphabet {a, b, . . . , z}.binary alphabet {0, 1} :the alphabet particularly pertinent to the theory ofcomputation.

Note: any object can be in an alphabet.In a formal point of view, an alphabet is simply a finite set ofany sort.For simplicity, however, we use as symbols only letters,numerals, and other common characters such as $, or #.

Jie Jiang CHOMSKY HIERARCHY

Page 10: chomskyaway/CA215/jie_w2.pdf · 2009-10-08 · Personalities Languages Grammars Chomsky Hierarchy Summary Noam Chomsky Marcel Schu¨tzenberger Avram Noam Chomsky Born on December

PersonalitiesLanguagesGrammars

Chomsky HierarchySummary

AlphabetsLanguages

String

A string is a finite sequence of symbols from Σ.

We simply juxtapose the symbols to denote a string.

watermelon is a string over the alphabet {a, b, . . . , z}.0111011 is a string over {0, 1}.

A string has no symbols at all⇒ the empty string

⇒ denoted by ǫ.

We generally use u, v, x, y, z, and Greek letters to denotestrings.

Example: we use w as a name for the string abc.

Jie Jiang CHOMSKY HIERARCHY

Page 11: chomskyaway/CA215/jie_w2.pdf · 2009-10-08 · Personalities Languages Grammars Chomsky Hierarchy Summary Noam Chomsky Marcel Schu¨tzenberger Avram Noam Chomsky Born on December

PersonalitiesLanguagesGrammars

Chomsky HierarchySummary

AlphabetsLanguages

String

The length of a string s, denoted |s|, is the number ofsymbols in it.

|101| = 3|ǫ| = 0

A string w ∈ Σ∗, can be considered as a functionw : {1, . . . , |w |} → Σ,the value of w(j), where 1 ≤ j ≤ |w |, is the symbol in the jthposition of w .

Example: if w = accordion, thenw(3) = w(2) = c , and w(1) = a.

Occurrences of a symbol in a string:the symbol σ ∈ Σ occurs in the jth position of the stringw ∈ Σ∗ if w(j) = σ.

Jie Jiang CHOMSKY HIERARCHY

Page 12: chomskyaway/CA215/jie_w2.pdf · 2009-10-08 · Personalities Languages Grammars Chomsky Hierarchy Summary Noam Chomsky Marcel Schu¨tzenberger Avram Noam Chomsky Born on December

PersonalitiesLanguagesGrammars

Chomsky HierarchySummary

AlphabetsLanguages

Operations on strings

Concatenation: x ◦ y ( or simply xy )Formally, w = x ◦ y iff |w | = |x | + |y |, w(j) = x(j) forj = 1, . . . , |x |, and w(|x | + j) = y(j) for j = 1, . . . , |y |.Example: 01 ◦ 001 = 01001, beach ◦ boy = beathboy

Note: w ◦ ǫ = ǫ ◦ w for any string |w |Associative: (wx)y = w(xy) for any strings w , x and y .

A string v is a substring of a string w iff there are strings xand y such that w = xvy .

Note: every string is a substring of itself. (x = ǫ and y = ǫ)ǫ is a substring of every string.

If w = xv for some x , then v is a suffix of w .

If w = vy for some y , then v is a prefix of w .

Example: road is a prefix of roadrunner, a suffix of abroad,and a substring of both these and of broader.

Jie Jiang CHOMSKY HIERARCHY

Page 13: chomskyaway/CA215/jie_w2.pdf · 2009-10-08 · Personalities Languages Grammars Chomsky Hierarchy Summary Noam Chomsky Marcel Schu¨tzenberger Avram Noam Chomsky Born on December

PersonalitiesLanguagesGrammars

Chomsky HierarchySummary

AlphabetsLanguages

Operations on strings

Definition w i :for each string w and each natural number i , the string w i isdefined as

w0 = ǫ, the empty stringw i+1 = w i ◦ w , for each i ≥ 0

Definition by induction : w i+1 is defined in terms of w i .

Example: (do)2 = ?(do)2 = (do)1 ◦ do, (i = 1)(do)1 = (do)0 ◦ do, (i = 0)(do)0 = ǫ

⇒ (do)2 = (e ◦ do) ◦ do = dodo

Jie Jiang CHOMSKY HIERARCHY

Page 14: chomskyaway/CA215/jie_w2.pdf · 2009-10-08 · Personalities Languages Grammars Chomsky Hierarchy Summary Noam Chomsky Marcel Schu¨tzenberger Avram Noam Chomsky Born on December

PersonalitiesLanguagesGrammars

Chomsky HierarchySummary

AlphabetsLanguages

Operations on strings

Definition wR : reversal of a string w, denoted by wR , isdefined as

If |w | = 0, then wR = w = ǫ

If |w | = n + 1 ≥ 0, then w = ua for some a ∈ Σ, andwR = auR

The string ”spelled backwards”:

Example: reverseR = esrever .

Note: (wx)R = xRwR , for any strings w and x .

Jie Jiang CHOMSKY HIERARCHY

Page 15: chomskyaway/CA215/jie_w2.pdf · 2009-10-08 · Personalities Languages Grammars Chomsky Hierarchy Summary Noam Chomsky Marcel Schu¨tzenberger Avram Noam Chomsky Born on December

PersonalitiesLanguagesGrammars

Chomsky HierarchySummary

AlphabetsLanguages

Languages definition

Σ∗ denotes the set of all sequences of strings that arecomposed of zero or more symbols of Σ.Σ+ denotes the set of all sequences of strings composed ofone or more symbols of Σ.

Σ+ = Σ∗ − {ǫ}

A language is a subset of Σ∗.A language is a collection of sentences of finite length allconstructed from a finite alphabet of symbols.

Σ∗, ∅ and Σ are languages.{aba, czr , d , f } is a language over {a, b, . . . , z}.

The infinite languages are specified by the scheme:

L = {w ∈ Σ∗ : w has property P}

{w ∈ {0, 1}∗ : w has an equal number of 0’s and l’s}{w ∈ Σ∗ : w = wR}

Jie Jiang CHOMSKY HIERARCHY

Page 16: chomskyaway/CA215/jie_w2.pdf · 2009-10-08 · Personalities Languages Grammars Chomsky Hierarchy Summary Noam Chomsky Marcel Schu¨tzenberger Avram Noam Chomsky Born on December

PersonalitiesLanguagesGrammars

Chomsky HierarchySummary

AlphabetsLanguages

Operations on languages

Concatenation: if L1 and L2 are languages over Σ, theirconcatenation is L = L1 ◦ L2, or simply L = L1L2, where

L = {w ∈ Σ∗ : w = x ◦ y for some x ∈ L1 and y ∈ L2}

Example: Σ = {0, 1},L1 = {w ∈ Σ∗ : w has an even number of 0’s},L2 = {w ∈ Σ∗ : w starts with a 0 and the rest of the symbolsare l’s}⇒ L1 ◦ L2 = {w ∈ Σ∗ : w has an odd number of 0’s}

Jie Jiang CHOMSKY HIERARCHY

Page 17: chomskyaway/CA215/jie_w2.pdf · 2009-10-08 · Personalities Languages Grammars Chomsky Hierarchy Summary Noam Chomsky Marcel Schu¨tzenberger Avram Noam Chomsky Born on December

PersonalitiesLanguagesGrammars

Chomsky HierarchySummary

AlphabetsLanguages

Operations on languages

Kleene star of a language L, denoted by L∗, is the set of allstrings obtained by concatenating zero or more strings from L:

L∗ = {w ∈ Σ∗ : w = w1 ◦ · · · ◦ wk for some k ≥ 0 and somew1, . . . ,wk ∈ L}

Example: Σ = {0, 1},L = {01, 1, 100}, ⇒ 110001110011 ∈ L∗

since 110001110011 = 1 ◦ 100 ◦ 01 ◦ 1 ◦ 100 ◦ 1 ◦ 1, and each ofthese strings is in Ls.

Jie Jiang CHOMSKY HIERARCHY

Page 18: chomskyaway/CA215/jie_w2.pdf · 2009-10-08 · Personalities Languages Grammars Chomsky Hierarchy Summary Noam Chomsky Marcel Schu¨tzenberger Avram Noam Chomsky Born on December

PersonalitiesLanguagesGrammars

Chomsky HierarchySummary

IntroductionFormal definitionExamples

Grammars

A grammar can be regarded as a device that enumerates thesentences of a language.

Types of grammars

Prescriptive: prescribes authoritative norms for a languageDescriptive: attempts to describe actual usage rather thanenforce arbitrary rulesFormal: a precisely defined grammar, such as context-freeGenerative: a formal grammar that can generate naturallanguage expressions

Jie Jiang CHOMSKY HIERARCHY

Page 19: chomskyaway/CA215/jie_w2.pdf · 2009-10-08 · Personalities Languages Grammars Chomsky Hierarchy Summary Noam Chomsky Marcel Schu¨tzenberger Avram Noam Chomsky Born on December

PersonalitiesLanguagesGrammars

Chomsky HierarchySummary

IntroductionFormal definitionExamples

Formal grammars

Two broad categories of formal languages: generative andanalytic

A generative grammar formalizes an algorithm that generatesvalid strings in a language

An analytic grammar is a set of rules to reduce an inputstring to a boolean result that indicates the validity of thestring in the given language

A generative grammar describes how to write a language, andan analytic grammar describes how to read it (a parser).

Jie Jiang CHOMSKY HIERARCHY

Page 20: chomskyaway/CA215/jie_w2.pdf · 2009-10-08 · Personalities Languages Grammars Chomsky Hierarchy Summary Noam Chomsky Marcel Schu¨tzenberger Avram Noam Chomsky Born on December

PersonalitiesLanguagesGrammars

Chomsky HierarchySummary

IntroductionFormal definitionExamples

Formal Grammars

How to determine whether a string is valid within a givenlangauge?

A grammar is a set of formation rules that describe whichstrings formed from the alphabet of a language aresyntactically valid within the language.

Grammars are composed of:a set of string rewriting rulesan assigned start symbol

The language described by a grammar is the set of stringsthat can be generated by applying these rules arbitrarily,starting with the start symbol.

Grammars could be thought of language generators or string

recognizers for languages.

Jie Jiang CHOMSKY HIERARCHY

Page 21: chomskyaway/CA215/jie_w2.pdf · 2009-10-08 · Personalities Languages Grammars Chomsky Hierarchy Summary Noam Chomsky Marcel Schu¨tzenberger Avram Noam Chomsky Born on December

PersonalitiesLanguagesGrammars

Chomsky HierarchySummary

IntroductionFormal definitionExamples

Example

Assume the alphabet consists of a and b, the start symbol isS , rules are:1. S → aSb

2. S → ba

Operations: start with S , and choose a rule to apply to it

choose rule 1, obtain the string aSb

choose rule 1 again, replace S with aSb ⇒ aaSbb

repeated at will until all occurrences of S are removed, andonly symbols from the alphabet remain (i.e., a and b).choose rule 2, replace S with ba ⇒ aababb

S ⇒ aSb ⇒ aaSbb ⇒ aababb

The language of the grammar is the set of all the strings thatcan be generated using this process:

{ba, abab, aababb, aaababbb, . . .}

Jie Jiang CHOMSKY HIERARCHY

Page 22: chomskyaway/CA215/jie_w2.pdf · 2009-10-08 · Personalities Languages Grammars Chomsky Hierarchy Summary Noam Chomsky Marcel Schu¨tzenberger Avram Noam Chomsky Born on December

PersonalitiesLanguagesGrammars

Chomsky HierarchySummary

IntroductionFormal definitionExamples

Grammars

Defined as a quadruple 〈Vt ,Vn,P ,S〉, where:

Vt = the terminal vocabulary

i.e. the words of the language: finite (but productive ...)

Vn = the non-terminals

i.e. the set of categories, used for the benefit of the grammarto express generalizations over items in Vt

P = the set of productions,

i.e. rules in the grammar: finite, and of the form

α → β

where α, β ∈ (Vn ∪ Vt)

S = the distinguished symbol, or ‘start’ symbol (’sentence’)

S ∈ Vn,P must include at least one rule α → β where α = S .

Jie Jiang CHOMSKY HIERARCHY

Page 23: chomskyaway/CA215/jie_w2.pdf · 2009-10-08 · Personalities Languages Grammars Chomsky Hierarchy Summary Noam Chomsky Marcel Schu¨tzenberger Avram Noam Chomsky Born on December

PersonalitiesLanguagesGrammars

Chomsky HierarchySummary

IntroductionFormal definitionExamples

Generative

A grammar is generative if it predicts (explicitly defines, orcharacterizes) all and only all strings ∈ the language.

The language of a grammar G , denoted as L(G ), is defined asall those strings over Σ that can be generated by G .

L(G) = {w ∈ Σ∗ : S ⇒∗

Gw}

Jie Jiang CHOMSKY HIERARCHY

Page 24: chomskyaway/CA215/jie_w2.pdf · 2009-10-08 · Personalities Languages Grammars Chomsky Hierarchy Summary Noam Chomsky Marcel Schu¨tzenberger Avram Noam Chomsky Born on December

PersonalitiesLanguagesGrammars

Chomsky HierarchySummary

IntroductionFormal definitionExamples

Example

Consider the grammar G where Vn = {S ,B}, Vt = a, b, c , S

is the start symbol, and P consists of :1. S → aBSc

2. S → abc

3. Ba → aB

4. Bb → bb

Some examples of the derivation of strings in L(G ) are:

S ⇒2 abc

S ⇒1 aBSc ⇒2 aBabcc ⇒3 aaBbcc ⇒4 aabbcc

S ⇒1 aBSc ⇒1 aBaBScc ⇒2 aBaBabccc ⇒3 aaBBabccc ⇒3

aaBaBbccc ⇒3 aaaBBbccc ⇒4 aaaBbbccc ⇒4 aaabbbccc

Jie Jiang CHOMSKY HIERARCHY

Page 25: chomskyaway/CA215/jie_w2.pdf · 2009-10-08 · Personalities Languages Grammars Chomsky Hierarchy Summary Noam Chomsky Marcel Schu¨tzenberger Avram Noam Chomsky Born on December

PersonalitiesLanguagesGrammars

Chomsky HierarchySummary

Chomsky Hierarchy

Type Grammar Language Automata

3 Finite State Regular Finite

2 Context-Free C-F Pushdown

1 Context-Sensitive C-S Linear-Bounded

0 General Rewrite Unrestricted Turing Machines

occasionally referred to as Chomsky−Schutzenberger hierarchy

described by Noam Chomsky in 1956

hierarchy of grammars

Type 3 ⊂ Type 2 ⊂ Type 1 ⊂ Type 0

Jie Jiang CHOMSKY HIERARCHY

Page 26: chomskyaway/CA215/jie_w2.pdf · 2009-10-08 · Personalities Languages Grammars Chomsky Hierarchy Summary Noam Chomsky Marcel Schu¨tzenberger Avram Noam Chomsky Born on December

PersonalitiesLanguagesGrammars

Chomsky HierarchySummary

Type-3 grammars

Type Grammar Language Automata

3 Finite State Regular Finite

2 Context-Free C-F Pushdown

1 Context-Sensitive C-S Linear-Bounded

0 General Rewrite Unrestricted Turing Machines

regular grammars: A → a, and A → aBa single nonterminal on the left-hand side.a single terminal, possibly followed (or preceded, but not both)by a single nonterminal on the right-hand side.S → ǫ is allowed if S is NOT on the right side of any rule

generate the regular languages:can be decided by finite state automata.can be obtained by regular expressions (search patterns &lexical structure of programming languages)

Jie Jiang CHOMSKY HIERARCHY

Page 27: chomskyaway/CA215/jie_w2.pdf · 2009-10-08 · Personalities Languages Grammars Chomsky Hierarchy Summary Noam Chomsky Marcel Schu¨tzenberger Avram Noam Chomsky Born on December

PersonalitiesLanguagesGrammars

Chomsky HierarchySummary

Type-2 grammars

Type Grammar Language Automata

3 Finite State Regular Finite

2 Context-Free C-F Pushdown

1 Context-Sensitive C-S Linear-Bounded

0 General Rewrite Unrestricted Turing Machines

context-free grammars: A → γ

a single nonterminal on the left-hand side.a string of terminals and nonterminals on the right-hand side.(less restrictive than Type-3)

generate the context-free languages:can be recognized by non-deterministic pushdown automata.theoretical basis for the syntax of most programminglanguages.

Jie Jiang CHOMSKY HIERARCHY

Page 28: chomskyaway/CA215/jie_w2.pdf · 2009-10-08 · Personalities Languages Grammars Chomsky Hierarchy Summary Noam Chomsky Marcel Schu¨tzenberger Avram Noam Chomsky Born on December

PersonalitiesLanguagesGrammars

Chomsky HierarchySummary

Type-1 grammars

Type Grammar Language Automata

3 Finite State Regular Finite

2 Context-Free C-F Pushdown

1 Context-Sensitive C-S Linear-Bounded

0 General Rewrite Unrestricted Turing Machines

context-sensitive grammars: αAβ → αγβα and β may be empty.A is a single nonterminal. (less restrictive than Type-2)γ is a nonempty string of nonterminals and terminals. (lessrestrictive)S → ǫ is allowed if S is NOT on the right side of any rule.

generate the context-sensitive languages:can be recognized by linear bounded automata (anondeterministic Turing machine whose tape is bounded by aconstant times the length of the input).

Jie Jiang CHOMSKY HIERARCHY

Page 29: chomskyaway/CA215/jie_w2.pdf · 2009-10-08 · Personalities Languages Grammars Chomsky Hierarchy Summary Noam Chomsky Marcel Schu¨tzenberger Avram Noam Chomsky Born on December

PersonalitiesLanguagesGrammars

Chomsky HierarchySummary

Type-0 grammars

Type Grammar Language Automata

3 Finite State Regular Finite

2 Context-Free C-F Pushdown

1 Context-Sensitive C-S Linear-Bounded

0 General Rewrite Unrestricted Turing Machines

unrestricted grammars: α → β

generate the recursively enumerable languages:

can be recognized by Turing machines.

Jie Jiang CHOMSKY HIERARCHY

Page 30: chomskyaway/CA215/jie_w2.pdf · 2009-10-08 · Personalities Languages Grammars Chomsky Hierarchy Summary Noam Chomsky Marcel Schu¨tzenberger Avram Noam Chomsky Born on December

PersonalitiesLanguagesGrammars

Chomsky HierarchySummary

Exercise 1

Given Σ = {0, 1}, please provide the specifications for thefollowing languages:The language consists of all strings begin with 0.

{0}{0, 1}∗

The language consists of all strings begin with 0, and endwith 1.

{0}{0, 1}∗{1}The language consists of all strings with odd lengths.

{0, 1}2n−1, n = 1, 2, . . .

The language consists of all strings with substring of threeconsecutive 0.

{0, 1}∗000{0, 1}∗

The language consists of all strings without substring of threeconsecutive 0.

{001, 01, 1}∗

Jie Jiang CHOMSKY HIERARCHY

Page 31: chomskyaway/CA215/jie_w2.pdf · 2009-10-08 · Personalities Languages Grammars Chomsky Hierarchy Summary Noam Chomsky Marcel Schu¨tzenberger Avram Noam Chomsky Born on December

PersonalitiesLanguagesGrammars

Chomsky HierarchySummary

Exercise 2

Consider the grammar G where Vn = {S ,B ,C}, Vt = a, b, c ,S is the start symbol, and P consists of :1. S → aBC

2. S → aSBC

3. aB → ab

4. bB → bb

5. CB → BC

6. bC → bc

7. cC → cctry to provide one derivation for sentence aaabbbccc.

S ⇒2 aSBC ⇒2 aaSBCBC ⇒1 aaaBCBCBC ⇒3

aaabCBCBC ⇒5 aaabBCCBC ⇒4 aaabbCCBC ⇒5

aaabbCBCC ⇒5 aaabbBCCC ⇒4 aaabbbCCC ⇒6

aaabbbcCC ⇒7 aaabbbccC ⇒7 aaabbbccc

Jie Jiang CHOMSKY HIERARCHY

Page 32: chomskyaway/CA215/jie_w2.pdf · 2009-10-08 · Personalities Languages Grammars Chomsky Hierarchy Summary Noam Chomsky Marcel Schu¨tzenberger Avram Noam Chomsky Born on December

PersonalitiesLanguagesGrammars

Chomsky HierarchySummary

1 PersonalitiesNoam ChomskyMarcel Schutzenberger

2 LanguagesAlphabetsLanguages

3 GrammarsIntroductionFormal definitionExamples

4 Chomsky Hierarchy

Jie Jiang CHOMSKY HIERARCHY