january - 26 thursday republic day february - 5 sunday...

32
II B.Tech(CSE) II Semester Academic Dairy for Formal Languages and Automata Theory Faculty Names: Mr. P. Anjaiah Mrs. S. Kalyani Mr. C. Pavan Kumar 1

Upload: hoangxuyen

Post on 13-May-2018

227 views

Category:

Documents


11 download

TRANSCRIPT

Page 1: January - 26 Thursday Republic Day February - 5 Sunday …anurag.edu.in/wp-content/uploads/HANDO…  · Web view · 2016-05-17Minimization of FSM, Minimization of FSM, ... not include

II B.Tech(CSE) II Semester Academic Dairy

for

Formal Languages and Automata Theory

Faculty Names: Mr. P. Anjaiah Mrs. S. Kalyani Mr. C. Pavan Kumar

Formal Languages and Automata Theory1

Page 2: January - 26 Thursday Republic Day February - 5 Sunday …anurag.edu.in/wp-content/uploads/HANDO…  · Web view · 2016-05-17Minimization of FSM, Minimization of FSM, ... not include

( II B.TECH(CSE) II SEM )

Micro Level Teaching PlanUnit No Topic hours Lecture Date

I

Fundamentals : Strings, Alphabet, Language, Operations, Finite state machine

2

Definitions, finite automaton model

1

Acceptance of strings, and languages

1

Acceptance of strings, and languages

1

Deterministic finite automation 1

Deterministic finite automation 1Non deterministic finite automation

1

Non deterministic finite automation

1

Transition diagrams Language recognizers.

1

10

II

Finite Automata : NFA with ε- transitionsNFA with ε- transitionsNFA with ε- transitionsSignificance, acceptance of languagesConversions and Equivalence : Equivalence between NFA with and without Î transitions

NFA to DFA conversionMinimization of FSM,

Minimization of FSM,Equivalence between two FSM’sFinite Automata with outputMoore and Melay machines.

Moore and Melay machines.

1 1 1 1 1

1

1 1 1 1

1 11

Regular Languages :Regular sets, regular expressions, identity rules,

1

Constructing finite Automata for a given regular expressions

1

Conversion of Finite Automata 12

Page 3: January - 26 Thursday Republic Day February - 5 Sunday …anurag.edu.in/wp-content/uploads/HANDO…  · Web view · 2016-05-17Minimization of FSM, Minimization of FSM, ... not include

III to Regular expressionsPumping lemma of regular sets 1Closure properties of regular sets

1 6

IV

Grammar Formalism :Regular grammars-right linear and left linear grammars

2

Equivalence between regular linear grammar and FA

1

Inter conversion Context free grammar, derivation trees

1

Sentential forms Right most and leftmost derivation of strings.

1 6

V

Context Free Grammars :Ambiguity in context free grammars

1

Minimization of Context Free Grammars.

1

Chomsky normal form, Greiback normal form

1

Pumping Lemma for Context Free Languages

1

Pumping Lemma for Context Free Languages

1

Enumeration of properties of CFL

1

Enumeration of properties of CFL

1

8

VI

Push Down Automata :Push down automata, definition, model, acceptance of CFL,

1

Push down automata, definition, model, acceptance of CFL,

1

Acceptance by final state and acceptance by empty state and its equivalence

1

Acceptance by final state and acceptance by empty state and its equivalence 1

Equivalence of CFL and PDA, interconversion

1

Introduction to DCFL and DPDA

1

Introduction to DCFL and 1

3

Page 4: January - 26 Thursday Republic Day February - 5 Sunday …anurag.edu.in/wp-content/uploads/HANDO…  · Web view · 2016-05-17Minimization of FSM, Minimization of FSM, ... not include

DPDA

8

VII

Turing Machine :Turing Machine, definition, model, design of TMComputable functions, recursively enumerable languages.

Computable functions, recursively enumerable languages.Types of Turing machines

2

1

1

1 6

VIII

Computability Theory :Chomsky hierarchy of languages

1

Linear bounded automata and context sensitive language 1

LR(0) grammar, decidability of, problems

1

Universal Turing Machine 1

Undecidability of posts 1

Correspondence problem 1

Turing reducibility, Definition of P and NP problems,

1

NP complete and NP hard problems.

1

Total no of hours

8

64

4

Page 5: January - 26 Thursday Republic Day February - 5 Sunday …anurag.edu.in/wp-content/uploads/HANDO…  · Web view · 2016-05-17Minimization of FSM, Minimization of FSM, ... not include

Formal Languages and Automata Theory

UNIT I

Fundamentals : Strings, Alphabet, Language, Operations, Finite state machine, definitions, finite automaton model, acceptance of strings, and languages, deterministic finite automaton and non deterministic finite automaton, transition diagrams and Language recognizers.

Objectives: To know the fundamentals of automata To learn about the DFA & NFA. To learn about the transition diagrams.

Topic Lecture Date

Hours

Fundamentals : Strings, Alphabet, Language, Operations, Finite state machine

2

Definitions, finite automaton model 1

Acceptance of strings, and languages 1

Acceptance of strings, and languages 1

Deterministic finite automation 1

Deterministic finite automation 1

Non deterministic finite automation 1

Non deterministic finite automation 1

Transition diagrams Language recognizers.

1

10

Applications:1). The finite automata concept is useful in design and development of any kind of application.2). This concept is useful in design and construction of compilers.Important Questions:1. Define DFA and NFA. Explain the difference between them with example. (May/june 2009 set1)2. Construct a smallest DFA over Σ = {a,b} accepting all strings which have number a’s divisible by 6 and number of b’s divisible by 8.( . (May/june 2009 set 1)

5

Page 6: January - 26 Thursday Republic Day February - 5 Sunday …anurag.edu.in/wp-content/uploads/HANDO…  · Web view · 2016-05-17Minimization of FSM, Minimization of FSM, ... not include

3. Define a finite state machine and explain model of finite automaton.? (. (May/june 2009 set2)4. Provide an NFA with at most six states for the following language:

L={w | w contains an even number of 0’s , or exactly two 1’s}.. (May/june 2009 set2)

5. What is the Block diagram of F.A? Explain the characteristics of F.A?. . (May/june 2009 set3)6. Provide DFA recognizing L={w a {0,1}* | w contains at least two 0’s and at most one 1}. (May/june 2009 set3)7. Find the language accepted by following finite automaton: . (May/june 2009 set4)

8. Construct DFA and NFA for L={w å {0,1}* | w contains the substring 0101}. (May/june 2009 set4)9. Design a DFA for the following language. L = {0m1n/m _ 0 and n _ 1} . . (Nov 2008 set1)10. Represent all five tuples for below transition and decide whether it is DFA or NFA. (Nov 2008 set1)

11 Design a DFA that accepts the language L(M) = {W/W< {a,b)*} and does not contains 3 consicutive b’s.( (Nov 2008 set2)12. Draw the transition diagram for below FA. (Nov 20087 set3)( (Feb08 set2)

M= { {A,B,C,D}, {0,1}, δ,C, {A,C} }δ (A,0) = δ (A,1) = {A,B,C}δ(B,0) = B, δ(B,1) = { A, C }δ(C,0) = {B,C}, δ(C,1) ={ B, D }δ (D,0) = { A, B, C, D }δ(D,1) = {A}.

13. Design DFA to accept strings c and d such that number d’s are divisible by 4 (Nov 2008 set3)14 Design DFA which accept the language L={0,000,00000 ……..} Over {0}(Nov 2008 set4)15.Construct DFA for the following: (Nov 2009 set12) (Feb 2008 set3)( (Feb 2007 set4)

(a) L={w/w has both an even number of 0’s and even number of 1’s }(b) L= { w/w is in the form of ‘x01y’ for some strings x and y consisting of 0’s and 1’s}.

6

Page 7: January - 26 Thursday Republic Day February - 5 Sunday …anurag.edu.in/wp-content/uploads/HANDO…  · Web view · 2016-05-17Minimization of FSM, Minimization of FSM, ... not include

16. Construct NFAs for the following languages (Nov 2007 set1&set 3)(a). The set of strings over alphabet {0,1,.........,9} such that the final digit has appeared before.(b). The set of strings over alphabet {0,1,........,9} such that the final digit has not appeared before.(c). The set of strings of 0’s and 1’s such that there are two 0’s separated by A number of positions that is a multiple of 4. Note that 0 is an allowable multiple of 4.

17. Design DFA Which accept all strings which are ending with 101 over an alphabet {0,1} Nov 2003 set 3)Assignment:1).Define FA. Give the mathematical representation of it and explain its significance.2).List out various real time applications of FA.3).Explain the difference between NFA and DFA with examples. Which one is efficient?

Case Study :1. Consider a real world problem and explain its solution which uses Finite

Automata in an important role.

UNIT II

Finite Automata:NFA with ε- transitions - Significance, acceptance of languages. Conversions and Equivalence: Equivalence between NFA with and without Î transitions, NFA to DFA conversion, minimization of FSM, equivalence between two FSM’s, Finite Automata with output- Moore and Melay machines.Objective:

To learn about the significance of ε-transitions. To know about the conversions in Finite Automata. To know about the Melay and Moore’s machines.

Topic Lecture Date hoursFinite Automata : NFA with ε- transitions

1

NFA with ε- transitions 1NFA with ε- transitions 1Significance, acceptance of languages

1

Conversions and Equivalence : Equivalence between NFA with and without Î transitions

1

NFA to DFA conversion 1

NFA to DFA conversion 1Minimization of FSM, 1Minimization of FSM, 1

7

Page 8: January - 26 Thursday Republic Day February - 5 Sunday …anurag.edu.in/wp-content/uploads/HANDO…  · Web view · 2016-05-17Minimization of FSM, Minimization of FSM, ... not include

Equivalence between two FSM’s

1

Finite Automata with output 1Moore and Melay machines. 1

10Applications:

NFAs and DFAs are equivalent in that if a language is recognized by an NFA, it is also recognized by a DFA and vice versa. This equivalence is important and useful because constructing an NFA to recognize a given language is sometimes much easier than constructing a DFA for that language.

Important Questions:1. Design a Finite State acceptor to accept the language of all binary strings that do not include the substring 1011(May/June 2009 set 1)2 Reduce the Moore machine: (May/June 2009 set 1)

3. What is the significance of NFA with ε-transitions? Explain. (May/June 2009 set 3)4. Show the equivalence between NFA with and without ε-transitions. (May/June 2009 set 3)5. Draw an equivalent deterministic finite automaton for the following automaton:

(May/June 2009 set 4) 6. Give an example of a regular language L containing Ë that cannot be accepted by any NFA having only one accepting state, and show that your answer is correct. (Nov 2009 set2)7. Design a Moore Machine to determine the residue mod 4 for each binary string treated as integer.(NOV 2008 set 1)8. Design a Mealy machine that uses its state to remember the last symbol Read and emits output ‘y’ whenever current input matches to previous one, and emits n otherwise. (Nov 2008 set 1)9. For the following NFA with €-moves convert it into an NFA without €-moves and show that NFA with €-moves accepts the same language as shown in figure below. (Nov 2008 set 3)(Feb 2008 set 2)(Nov 2007 set 01)

8

Page 9: January - 26 Thursday Republic Day February - 5 Sunday …anurag.edu.in/wp-content/uploads/HANDO…  · Web view · 2016-05-17Minimization of FSM, Minimization of FSM, ... not include

10. Design a Moore machine to determine the residue mod 5 for each binary string treated as integer. (Feb 2008 set 1) (Nov 2007, set 4)11. Convert the following Mealy machine into equivalent Moore machine as shown in figure 2b. )(Nov 2004 set 1) (Nov 2005, set1 )

12. Construct DFA for given (figure 2) NFA with 2-moves (16) (Nov 2008 set 2) (Feb 2008 set 4)( NOV2007 SET 2)

14. Find NFA With out epsilon for the following diagram.13. Minimize Finite Automata given below and show both given and reduced are equal.(FEB 2007, SET 2) (Nov 2004 set 2)

0 1q0 q1 q2q1 q3 q4q2 q5 q6q3 q3 q4q4 q5 q7 q5 q3 q4q6 q5 q6

9

Page 10: January - 26 Thursday Republic Day February - 5 Sunday …anurag.edu.in/wp-content/uploads/HANDO…  · Web view · 2016-05-17Minimization of FSM, Minimization of FSM, ... not include

Assignment: 1).Convert the following NFA to a DFA using the method described in class. Specify the DFA by its transition diagram. The alphabet is Σ = {0,1}.

2). Consider the following languages over Σ = {0, 1}. L1 is the language described by 1*(0111*)*. L2 is the language of strings with at least one 0 and at least two 1s. L3 is the language of the following NFA:

L4 is the language described by (0 + 1)*01(0 + 1)*1. L5 is the language described by (011 + 101 + 110)*. L6 is the language of the following NFA:

L7 is the language of all strings that do not contain 00, 010 and do not end in 0 or 01. (Optional) L8 is the language of the following DFA:

Which of these languages are the same and which are different? To show two languages are the same give a short argument, and to show two languages are different give a string that is in one but not in the other.(You must provide an explanation)

Case Study:10

Page 11: January - 26 Thursday Republic Day February - 5 Sunday …anurag.edu.in/wp-content/uploads/HANDO…  · Web view · 2016-05-17Minimization of FSM, Minimization of FSM, ... not include

1. Explain the role of NFA and DFA in text search.

UNIT IIIRegularLanguages: :Regular sets, regular expressions, identity rules, Constructing finite Automata for a given regular expressions, Conversion of Finite Automata to Regular expressions. Pumping lemma of regular sets, closure properties of regular sets (proofs not required).

Objective:

To learn the fundamentals for the construction finite automata. To know about the conversion of finite automata to regular expressions. To know about the pumping lemma and closure properties of regular sets.

Topic Lecture Date Hours

Regular Languages :Regular sets, regular expressions, identity rules,

2

Constructing finite Automata for a given regular expressions

1

Conversion of Finite Automata to Regular expressions

1

Pumping lemma of regular sets 1

Closure properties of regular sets

1 6

Applications :Useful in writing the expressions for the regular languages and defining properties for

the expressions uses in the languages. This helps in designing the compilers.Important Questions:1. Given that A is regular and (A U B) is regular, does it follow that B is necessarily regular? Justify your answer. (16m) (May/June 2009 set 1)2. (a) Draw ε -NFA recognizing regular expression 010*+0(01+10)*11 over {0,1} (May/June 2009 set 1) (b) Explain Pumping lemma for regular sets. (May/June 2009 set 1)3. (a) Define regular expression and find regular expression for the following: L = {w | every odd position of w is a 1} defined over . = {0,1}(May/June 2009 set 1) (b) Convert the following regular expression into NFA: (((00)*(11))U01)* (May/June 2009 set 1)4. (a) Convert the following finite automata to regular expressions: (May/June 2009 set 1)

11

Page 12: January - 26 Thursday Republic Day February - 5 Sunday …anurag.edu.in/wp-content/uploads/HANDO…  · Web view · 2016-05-17Minimization of FSM, Minimization of FSM, ... not include

(b). Using pumping lemma, show the following language is not regular: L={w å {0,1}* | the number of 0’s in w is a perfect square}: (May/June 2009 set 1)5. Find a Regular expression corresponding to each of the following subsets over {0,1}*. (a). The set of all strings containing no three consecutive 0’s. (b). The set of all strings where the 10th symbol from right end is a 1. (c). The set of all strings over {0,1} having even number of 0’s & odd number of 1’s. (d). The set of all strings over {0,1} in which the number of occurrences of is divisible by 3.6. Construct NFA for the following regular expressions (a) 0+10* +01*0 (b) (0+1)*(01+110).7. Give the English description and NFA for the following regular expressions. (a). r=(1+01+001)*(+0+00) (b). r=[00+11+(01+10)(00+11)*(01+10)]*8. Give a regular expression for the set of all strings over {a, b} accepting all strings which have number of a’s divisible by 6 and number of b’s divisible by 89. Construct a DFA accepting language represented by 0*1*2*.

Assignment:1). Which of the following languages are regular, and which are not? To show a language is regular, describe a DFA, NFA, or regular expression for it (with explanation). To show a language is not regular, prove it using the pumping lemma. The alphabet is Σ={a,b,c}. (a). L1 = {wz:|w|=|z|,w Є (a+b)* and z Є (b+c)*}. (b). L2 = {w: every a in w is followed by at least one b and at least one c}. For example, ε, abaacb Є L2, but abacc L2

(c). L3 = {w:w does not have the same number of as, bs, and cs}. (d). L4 = {w:w contains the same number of patterns ac and abc}.

2). Which of the following statements are correct? If you think a statement is correct, give a proof. If you think it is incorrect, give a counterexample. You may assume the alphabet is ∑= {a,b}

(a) If L is regular, then L' = {x: ax Є L or xb Є L} is regular.(b) If L is regular, then L' = {xx¯ : x Є L} is regular.Here x¯ is x without its last symbol, e.g. (bab)¯ = ba, b¯ = ε. (We let ε¯ = ε.)(c) If L is regular, then L' = {x: xy ∈ L for some string y} is regular.(d) If L1L2 is regular, then L2L1 is regular. (L1 and L2 can be any pair of languages, not necessarily regular.)(e). If L is regular, then L' = {wz : zw Є L for some strings w, z} is regular.

Case Study:1. Explain how regular expressions are used in finding patterns in text.

12

Page 13: January - 26 Thursday Republic Day February - 5 Sunday …anurag.edu.in/wp-content/uploads/HANDO…  · Web view · 2016-05-17Minimization of FSM, Minimization of FSM, ... not include

UNIT IV

Grammar Formalism: Regular grammars-right linear and left linear grammars, equivalence between regular linear grammar and FA, inter conversion, Context free grammar, derivation trees, and sentential forms. Right most and leftmost derivation of strings.

Objective: The main objective to learn about the regular grammars including left and right

linear grammar. To know about the equivalence between grammar and automata. To know about the derivations and trees.Topic Lecture Date hours

Grammar Formalism :Regular grammars-right linear and left linear grammars

2

Equivalence between regular linear grammar and FA 1

Inter conversion Context free grammar, derivation trees

1

Sentential forms Right most and leftmost derivation of strings.

1 5

Appications:This concept is useful in defining the expressions for the languages. It helps in

construction of compilers by deriving and constructing tree for the expressions.Important Questions:1. (a) Define Regular grammar, right linear and left linear grammars. Give examples. (b) Find DFA and CFG for the following language: L={odd-length strings in {a,b}* with middle symbol a.2. (a) Define and distinguish regular grammar and context free grammar. (b) Describe the language of the following grammar

S . A->BA . 000->εB . 000B->εAlso find whether the language is regular or not?

3. (a) Define the following and give examples: (i). CFG, (ii). Derivation Tree, (iii). Sentential form and (iv). Right most and left most derivation of strings (b).Find regular grammar for the following finite automata:4. (a). Convert the following grammar into regular grammar that generates same language: S -> AB A . aAa->| bAb->| a->| b B . aB-> bB -> Ë (b). Find the language generated by the following CFG: S . aSbScS -> aScSbS -> bSaScS-> bScSaS-> cSaSbS -> cSbSaS-> Ë5. (a). Obtain a CFG to generate unequal number of a’s and b’s. (b). Obtain a CFG to obtain balanced set of parentheses.(i.e every left parentheses should match with the corresponding right parentheses). RR6. (a). Obtain a regular grammar to obtain the set of all strings not containing three Consecutive 0’s.

13

Page 14: January - 26 Thursday Republic Day February - 5 Sunday …anurag.edu.in/wp-content/uploads/HANDO…  · Web view · 2016-05-17Minimization of FSM, Minimization of FSM, ... not include

(b). Obtain a CFG to generate the set of all strings over alphabet {a ,b} with exactly twice as many a as b’s7. (a). Obtain a Right Linear Grammar for the language L = {anbm |n >= 2,m >= 3 } (b). Obtain a Left Linear Grammar for the DFA as shown in figure 4b.

8. (a)Obtain regular grammar for the following FA as shown in figure 4a.

(b) What is the language accepted by above FA?Assignment:1). Consider the following context-free grammar G:

E ->E + T | TT -> x | (E)

It generates expressions like x, x + (x + x) + (x + x), and so on.(a) Write all items in this grammar and construct an NFA for the valid item updates.(b) Convert the NFA to a DFA. Which of the states are shift states and which are reduce states? Are there any conicts?(c) Using the DFA, show an execution of the LR(0) parsing algorithm on the input x + (x + x) + (x + x): Show the state of the stack, input, and DFA throughout the execution.(d) Now consider the following extended context-free grammar G0:

E -> E + T | TT -> T * F | FF -> x | (E)

Show that G0 is not an LR(0) grammar. (e).Give an LR(1) DFA for G0. Show an execution of the LR(1) parsing algorithm on input (x + x) _ (x + x _ x).Case Study:

1. Construct a regular grammar which can generate the set of all string starting with a letter (A to Z) followed by a string of letters or digits (0 to 9).

14

Page 15: January - 26 Thursday Republic Day February - 5 Sunday …anurag.edu.in/wp-content/uploads/HANDO…  · Web view · 2016-05-17Minimization of FSM, Minimization of FSM, ... not include

UNIT V

Context Free Grammars :Ambiguity in context free grammars. Minimisation of Context Free Grammars. Chomsky normal form, Greiback normal form, Pumping Lemma for Context Free Languages. Enumeration of properties of CFL (proofs omitted).Objective:

To define and elimination of ambiguity in cfg To learn about pumping lemma and forms for languages. To know about the properties of cfl

Topic Lecture Date

hours

Context Free Grammars :Ambiguity in context free grammars

1

Minimization of Context Free Grammars.

1

Chomsky normal form, Greiback normal form

1

Pumping Lemma for Context Free Languages

1

Pumping Lemma for Context Free Languages

1

Enumeration of properties of CFL

1

Enumeration of properties of CFL

1

7

Applications:The identification and avoidance of ambiguity helps in constructing the compilers for

programming languages. Important Questions:1. (a) Define ambiguous grammar and give example. (b) Find an unambiguous CFG equivalent to the grammar with productions S -> aaaaS |aaaaaaaS|ε2. (a) What is Chomsky Normal Form? Explain in detail. (b) Convert the following grammar into GNF:

S->ABA->BS|bB->SA|a

3. (a) For each of the following languages over Σ = {0, 1}, write a context-free grammar with the minimal number of variables that generates the language: (i) {w | w = wR} (wR denotes the reverse of w). (ii) {w | w . wR}. (b) What is Greenback normal form? Explain.4. Explain pumping lemma for Context Free Languages and Prove that the following 15

Page 16: January - 26 Thursday Republic Day February - 5 Sunday …anurag.edu.in/wp-content/uploads/HANDO…  · Web view · 2016-05-17Minimization of FSM, Minimization of FSM, ... not include

language is context free: L= {xy | x, y _ {0, 1}_, |x| = |y| and x . y}.5. (a) What do you mean by ambiguity? Show that the grammar S ! S/S, S ! a is ambiguous. (b) Show that the grammar G with production

S -> a|aAb|abSbA->AAb|bS is ambiguous.

6. (a) Show that L = {aibj|j = i2} is not context free language. (b) List the properties of CFLs. (c) Find if the given grammar is finite or infinite. S->AB, A->B C->a, B->C,C->b, C->a.7. (a) Reduce the Grammar G given by

S!aAaA->Sb->bcc->DaAC!abb->DDE->acD->aDA

into an equivalent grammar by removing useless symbols and useless productions from it. (b) Convert the following grammar into CNF.

S->aADA->aB->bABB->bD->d.

8. Simplify the Grammar Σ={{S,A,B,C,E},{a,b,c},P,S} Where P is S->AB

A->aB->bB->CE->c/^

(b) Prove that the following language is not context-free language L={www|w€{a,b}*} is not context free.

Assignment1). Consider the following context-free grammar G that describes (nontrivial) regular expressions over the alphabet f0; 1g:

R ->(R) | R+R | RR | R* | 0 | 1 | e The alphabet of G consists of the symbols (, ), +, *, 0, 1, and e. Here + and * describe the union and star operators, while e describes the empty string. (a) Convert G to Chomsky Normal Form. (b) Apply the Cocke-Younger-Kasami algorithm (algorithm 2 from lecture 9) to obtain parse trees for the following strings: (1+0)*, 0+01, (1+e)1*. Some of these expressions several parse trees; which ones describe the intended meaning of the expression? (c) Give a CFG G0 that describes the same language as G but is not ambiguous. Moreover, each parse tree in G0 should describe the intended meaning of the corresponding regular expression. 2. Consider the following languages. For each of the languages, say whether the language is (1) regular, (2) context-free but not regular, or (3) not context free. Explain your answer (e.g. give a DFA or argue why one exists, give a CFG, apply the appropriate pumping lemma).

16

Page 17: January - 26 Thursday Republic Day February - 5 Sunday …anurag.edu.in/wp-content/uploads/HANDO…  · Web view · 2016-05-17Minimization of FSM, Minimization of FSM, ... not include

(a) L1 = {anbnanbn : n ≥ 0} Σ = {a; b}..(b) L2 = {wR#z : w is a substring of z, w; z Є {a; b}*} Σ = {a; b,#}.(c) L3 = {w#z : w is a substring of z, w; z Є {a; b}*} Σ= {a; b,#}.(d) L4 = {x+y=z : x + y=z in unary where x, y, z Є 11*}, Σ = {1;=;+}. For example, 1+11 =111 2 L4 but +1 = 1 =2 L4; 1 + 1 = 111 =2 L4.3). Consider the following context-free grammar G that describes (nontrivial) regular expressions over the alphabet f0; 1g: R -> (R) | R+R | RR | R* | 0 | 1 | e The alphabet of G consists of the symbols (, ), +, *, 0, 1, and e. Here + and * describe the union and star operators, while e describes the empty string. (a) Convert G to Chomsky Normal Form. (b) Apply the Cocke-Younger-Kasami algorithm (algorithm 2 from lecture 9) to obtain parse trees for the following strings: (1+0)*, 0+01, (1+e)1*. Some of these expressions several parse trees; which ones describe the intended meaning of the expression? (c) Give a CFG G' that describes the same language as G but is not ambiguous. Moreover, each parse tree in G' should describe the intended meaning of the corresponding regular expression.

Case Study:1. Consider the grammar S SbS/a .

Check whether it is ambiguous or not for input string abababa. Give parse tree, LMD and RMD.

UNIT VI

Push Down Automata :Push down automata, definition, model, acceptance of CFL, Acceptance by final state and acceptance by empty state and its equivalence. Equivalence of CFL and PDA, interconversion. (Proofs not required). Introduction to DCFL and DPDA.Objective:

It is to learn the extension of ε-NFA transitions i.e., PDA To show the equivalence and interconversion between CFL and PDA

Topic Lecture Date hoursPush Down Automata :Push down automata, definition, model, acceptance of CFL,

2

Push down automata, definition, model, acceptance of CFL,

1

Acceptance by final state and acceptance by empty state and its equivalence

1

Acceptance by final state and acceptance by empty state and its equivalence

1

Equivalence of CFL and PDA, interconversion

1

Introduction to DCFL and DPDA

1

Introduction to DCFL and DPDA

1 8

17

Page 18: January - 26 Thursday Republic Day February - 5 Sunday …anurag.edu.in/wp-content/uploads/HANDO…  · Web view · 2016-05-17Minimization of FSM, Minimization of FSM, ... not include

Applications:It helps in defining a symbol tables for the PLs while compilers. The compilers can be

constructed by using the concept of PDA.Important Questions:1. (a) Define Push Down Automata and explain its model with a neat diagram. (b) Construct PDA for L={x å {a,b}* ¦na(x) > nb(x)}.2. Show the equivalence of CFL and PDA.3. Draw a pushdown automaton, and describe a context-free grammar for the language L = {aibjck : i < j or j < k}.4. Define formally the model of pushdown automata with two stacks, and prove that it is equivalent to standard TM’s.5 (a) Explain the terms: Push Down Automata and context free language. (b) Let G be a CFG with the following productions.

S -> a B cA -> a b cB ->a A bC ->A BC -> c

Construct a PDA M such that the language generated by M and G are equivalent. 6. Show that the languages

(a) L1={0n1m/n = m and n_ 1}(b) L2={0n1m / n=2m and n_ 1}

Are deterministic context free languages?7. (a) Let G be the grammar given by

S->aABB->aAA,A->aBB->a,B->bBB->A

Construct the PDA that accepts the language generated by this grammar G. (b) Define Deterministic pushdown automata. Explain with an example.Assignment:1). For each of the following languages, give a context-free grammar and a pushdown automaton. Give a short explanation of how the PDA works.(a) L1 = {wywR : the length of y is even}, Σ = {a, b}. (Recall that wR is the reverse of w.)(b) L2 = {w : w has the same number of as as bs and cs together}, Σ = {a, b, c}.(c) L3 = {aibjck : i > j or j > k, where i,j,k≥0},Σ={a,b,c} Σ={a,b,c},(d) L4 = {xy : |x| = |y| and x ≠ y},Σ = {a; b}.

Case Study:1. Use pumping lemma to show the following languages are not context free.a) {0n02n03n/n>=0}b) {w#t/w is a substring of t where w,t E{a,b}*}

UNIT VII

Turing Machine :Turing Machine, definition, model, design of TM, Computable functions, recursively enumerable languages. Church’s hypothesis, counter machine, types of Turing machines (proofs not required).

Objective:

18

Page 19: January - 26 Thursday Republic Day February - 5 Sunday …anurag.edu.in/wp-content/uploads/HANDO…  · Web view · 2016-05-17Minimization of FSM, Minimization of FSM, ... not include

To know about the turing machines and its significance in solving complex problems

Topic Lecture Date hoursTuring Machine :Turing Machine, definition, model, design of TM

2

Computable functions, recursively enumerable languages.

1

Computable functions, recursively enumerable languages.

1

Types of Turing machines 1 5

Applications:The concept of turing machines helps in solving the complex or specific problems

which are not possible by other machines.Model Questions:1. Define Turing Machine and give example. Also explain different types of TM’s.2 .(a) What is recursively enumerable language? Explain with example. (b) Explain counter machine in detail.3. (a) Describe the TM that accepts the language L = {w å{a,b,c}_ | w contains equal number of a’s, b’s, and c’s}. (b) Explain in detail Church’s hypothesis.4. (a) Define Turing machine and explain its model. (b) Describe Church’s hypothesis.5. Give a Turing machine for the following: (a) That computes ones complement of a binary number (b) That shifts the input string, over the alphabet (0,1) by one position right by inserting ‘#'as the first character.6. (a) Design a Turing Machine that accepts the set of all even palindromes over {0,1}. (b) Given _ = {0,1}, design a Turing machine that accepts the language denoted by the regular expressions 00*.7. Define Turing machine formally; explain how Turing machine can be used to compute integer functions. Design the Turing machine to compute following function,Show its transition diagram also f(x,y)=xy where x and y are positive integers represented in unary.Assignment:1). In this problem, you will design Turing machines for the following three languages:

(a) L1 = {an#an#an : n ≥ 0}, Σ = {a,#}. Give both a high-level description and a state diagram of your Turing Machine.

(b) L2 = {an#b2n : n ≥ 0} Σ = {a, b}. Give only a high-level description of the Turing Machine. A state diagram is not necessary. 2). The Church-Turing Thesis claims that Turing Machines are a universal model of computation: Any computation that can be performed on any computer we will ever build can also be done on a Turing Machine. Here are some possible

19

Page 20: January - 26 Thursday Republic Day February - 5 Sunday …anurag.edu.in/wp-content/uploads/HANDO…  · Web view · 2016-05-17Minimization of FSM, Minimization of FSM, ... not include

objections to the Church-Turing Thesis. For each of these objections, say if you think it is reasonable or not, and explain why. (You won't be graded based on whether your answer is \right" or \wrong", but based on how well you explain your answer.)(a) Suppose I want to know what is the smallest country in the world. In real life, I would use google, type in "smallest country", and I find out the answer after a few clicks. But I cannot do this on a Turing Machine. How do I even connect a Turing Machine to the internet? Since there are computations we can do in real life but not on a Turing Machine, the Church-Turing thesis is false. (b) Look at this computer program:

int F(int n) {if (n == 1) return 1;else return F(n - 1) + F(n - 2);}

This program uses recursion: A procedure makes a subroutine call to itself. But Turing Machines do not support recursion. Therefore Turing Machines are not as powerful as ordinary programming languages, and the Church-Turing thesis is false.

(b) Humans can also be modeled as computers: We take inputs from the environment (by seeing, hearing, touching) and produce outputs (via speaking and gestures). If the Church-Turing thesis is true, then any task that humans can do can also be done on a Turing Machine, and so on any machine. But there are tasks that humans are better at than machines: Learning foreign languages, identifying objects in images, winning basketball games, and so on. Therefore the Church-Turing Thesis cannot be true.

Case Study:1. Design a Turing machine M to recognize the language {1n2n3n/n>=1}.

UNIT-VIII

Computability Theory:Chomsky hierarchy of languages,linear bounded automata and context sensitive languages.LR(0) Grammar decidability of problems,Universal Turing machine, Undecidability of posts, Correspondence problems,Turing reducibility,Definition of P and NP problems,NP complete and NP hard Problems

Objective: To learn aboutr the significance of thje Chomsky hierarchy of language. To know about the PCPs in detail.

Topic Lecture Date Hours Computability Theory :Chomsky hierarchy of languages

1

Linear bounded automata and context sensitive language 1

LR(0) grammar, decidability of, problems

1

Universal Turing Machine 1

Undecidability of posts 1

20

Page 21: January - 26 Thursday Republic Day February - 5 Sunday …anurag.edu.in/wp-content/uploads/HANDO…  · Web view · 2016-05-17Minimization of FSM, Minimization of FSM, ... not include

Correspondence problem 1

Turing reducibility, Definition of P and NP problems,

1

NP complete and NP hard problems.

1

ApplicationsThe new languages can be design and develop and/or enhance the features of existing

languages.Model Questions:1.a) Explain Chomsky hierarchy of languages with a neat diagram. b) Define LR(0) grammar and give example.2.(a) Describe linear bounded automata. (b) Explain Universal Turing Machine.3. Define P and NP problems. Also write notes on NP complete and NP hard problems.4. (a) Write notes on decidability of problems (b) Explain linear bounded automata and context sensitive language.5. (a) What is decidability? Explain any two undecidable problems. (b) Show that the following post correspondence problem has a solution and give the solution.

I List A List B1 11 112 100 0013 111 11

6. (a) Find whether the post correspondence problem P={(10,101),(011,11),(101,011)} has a match. Give the solution. (b) Explain Turing reducibility machines. (c) Show that if L and L? are recursively enumerable, and then L is recursive.7.( a) Find whether the post correspondence problem P={(10,101),(011,11),(101,011)} has a match. Give the solution. (b) Explain Turing reducibility machines. (c) Show that if L and L? are recursively enumerable, and then L is recursive.8. (a) Explain about Deterministic context free language and Deterministic PDA. (b) Show that is a CSL.9. Give LR(0) items for the grammar S->aAB, A->aAb->ab, B->aB->a. Find its Equivalent DFA. Check the parsing by taking a suitable string.Assignment:1). For each of these languages, say whether it is decidable. Justify your answer. Here M,M1 and M2 are all Turing Machines.

(a) L1 = {‹M›: M accepts 0 within 999 transitions}:(b) L2 = {‹M›i: M doesn't accept input 0}:(c) L3 = {‹M›: M accepts a _nite number of inputs}.:(d) L4 = {‹M1;M2› : M1 rejects input M2 or M2 accepts input M1 (or both)}.

2). For each of the following variants of the Post Correspondence Problem (PCP), say if it is recidable or not. Justify your answer by describing a decider, or by 21

Page 22: January - 26 Thursday Republic Day February - 5 Sunday …anurag.edu.in/wp-content/uploads/HANDO…  · Web view · 2016-05-17Minimization of FSM, Minimization of FSM, ... not include

reducing from (standard) PCP. (a) PCP* = {‹P› : P is in PCP and every tile in P is a *-tile.} A *-tile is a tile where both the top and bottom strings begin with *, for example

(b) PCP1 = {‹P› : P is in PCP and every tile in P is one-symbol tile}A one-symbol tile is a tile where the top and bottom strings have length at most one, so

are all one-symbol tilesCase study:

1. Let A be the language containing only the single string s whereS= 0 if life never will be found on mars.S= 1 if life will be found on mars someday.

Is A decidable? Why or whynot?

22