national chiao tung university€¦ · web viewhow a standard turing machine can simulate this...

6
Introduction to Formal Languages Assignment 2(with solutions) (交交交交交交交交 2016 Spring) (交交 A4 交交交交交交, 交交交交交交交) 8 problems and 100 points in total) [1] Construct a nondeterministic pushdown automaton for L= {ww R: w∈ {a,b } ¿ } . (10 points) [2] Construct a deterministic pushdown automaton for L= {a n b n : n0} . (10 points) 1

Upload: others

Post on 10-Jul-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: National Chiao Tung University€¦ · Web viewhow a standard Turing machine can simulate this 3-track Turing machine. (7 points) (b) Describe the universal Turing machine. (Draw

Introduction to Formal Languages Assignment 2(with

solutions)(交大資工在職專班2016 Spring)

(請用 A4紙按順序作答, 並列出演算過程)8 problems and 100 points in total)

[1] Construct a nondeterministic pushdown automaton for L= {wwR: w∈ {a ,b }¿} . (10

points)[2] Construct a deterministic pushdown automaton for L= {anbn: n≥0} . (10 points)

1

Page 2: National Chiao Tung University€¦ · Web viewhow a standard Turing machine can simulate this 3-track Turing machine. (7 points) (b) Describe the universal Turing machine. (Draw

[3] (14 points)

(a) Show that the language L= {anbncn: n≥0} is not context-free.(b) Show that the language L= {an : n is a prime number} is not context-free.

2

Page 3: National Chiao Tung University€¦ · Web viewhow a standard Turing machine can simulate this 3-track Turing machine. (7 points) (b) Describe the universal Turing machine. (Draw

[4] Let Σ={a}, and consider the set of all Turing machines with this input alphabet. By Theorem 10.3, this set is countable, so we can associate an order M1, M2, … with its elements. Now we define L={ai : ai ∈ L(Mi)}. Prove that L is not recursively enumerable. (10 points)

[5] (a) Describe a Turing machine with 3 tracks. (Draw a picture for it.) And explain how a standard Turing machine can simulate this 3-track Turing machine.(7 points)

(b) Describe the universal Turing machine. (Draw a picture for it.) (7 points)

[6] LetΣ={0,1}. There is an enumeration process to give the elements of Σ¿ the sequenceλ, 0, 1, 00, 01, 10, 11, 000, 001, 010, 011, …

Then any language over Σ can be denoted as an infinite bits. E.g. L(0*1*)={λ,0,1,00,01,11,000,001,011,…} can be expressed as 11111011101…Use diagonalization method to prove that 2Σ

¿(the set of all languages over Σ) is

uncountable. (10 points)

[7] Consider a deterministic Turing machine M and a language L.

3

Page 4: National Chiao Tung University€¦ · Web viewhow a standard Turing machine can simulate this 3-track Turing machine. (7 points) (b) Describe the universal Turing machine. (Draw

What is the difference between (a) M accepts L and (b) M decides L? (8 points)

[8] (True and False是非題) Denote the following language classes as LCS: the context-sensitive languages

LCF: the context-free languagesLDCF: the deterministic context-free languagesLLIN: the linear languagesLREG: the regular languages

(1) ( F ) L={anbn: n≥0} is in LREG. (2) ( T ) L={anbncn: n≥0} is in LCS.

(3) ( T ) L={wwR: w∈ {a ,b }¿} is in LCF.

(4) ( F ) L={ww:w∈ {a ,b }¿} is in LCF.

(5) ( T ) L={ww:w∈ {a ,b }¿} is in LCS.

(6) ( T ) L={anbn : n≥0}∪{anb2n : n≥0} is in LLIN.

(7) ( T ) L={anbm : n≤m≤ 2n} is in LCF.

(8) ( T ) L={w∈ {a ,b }¿: na(w)=nb(w)} is in LDCF.

(9) ( F ) L={w∈ {a ,b }¿: na(w)=nb(w)} is in LLIN.

(10) ( T ) L={w1cw2: w1, w2∈ {a ,b }¿, w1≠w2} is in LCF.

(11) ( F ) L={w1cw2: w1, w2∈ {a ,b }¿, w1¿w2} is in LCF.

(12) ( T ) L={w1cw2: w1, w2∈ {a ,b }¿, w1¿w2} is in LCS.

(24 points)

4

Page 5: National Chiao Tung University€¦ · Web viewhow a standard Turing machine can simulate this 3-track Turing machine. (7 points) (b) Describe the universal Turing machine. (Draw

5