Theory of Computation (Classroom Practice Booklet Solutions)
|
|
- Gerard Rich
- 5 years ago
- Views:
Transcription
1
2 Theory of Computation (Classroom Practice Booklet Solutions) 1. Finite Automata & Regular Sets 01. Ans: (a) & (c) Sol: (a) The reversal of a regular set is regular as the reversal of a regular expression is a regular expression. (c) The intersection of a regular set & a finite set is a finite set which is regular. n n (b) a b / n 1 is the intersection of a regular set and a CFL & is very much a CFL. So (b) is false. n n (d) a b / n 1 is the intersection of a regular set and a DCFL & is very much a DCFL. So (d) is false. The above NFA accepts all strings over {0, 1} where the third symbol from the right end is a 1. It has 2 3 or 8 states in the minimal DFA. So (d) is the answer. 03. Ans: (c) Sol: The string ba is both (i) & (ii) (a) is there in (ii) & not in (i) (b) a is in (ii) & not in (i) (c) b is in (i) & in (ii) 04. Ans: (b) Sol: (a) S (c) S 02. Ans: (d) A B A B Sol: Consider the DFA a, b a A B B B A B The DFA is also an NFA and has the same number of states. So (a), (b) & (c) can be ruled out. Consider the NFA B B b A B b a b aabbb can be derived AB AB a b a b a b ababab can be derived 0,
3 : 2 : Theory of Computation (d) S A B a A B BB b b b abbb can be derived 05. Ans: (c) Sol: (a) (a +b a ) = (a+ b) (b) (a b + b a ) (a b ) = (a b ) = (a+b) (c) (a(b) +a ) will never yield a b by itself so it cannot be the same as (a) or (b). By elimination (c) is the odd man out. 06. Ans: (a) Sol: (d) can be ruled out ( +0) (101) (+0) contains ( + 0) ( + 0) contain 00 (c) 010 can not be generated (b) (0+10) ( + 1) contains (0+10) containing 00 By elimination (a) is the answer. 07. Ans: (a) Sol: (d) The minimal DFA is unique (c) (0+1) can be accepted by a 1 state minimal DFA (b) The empty set accepts 08. Ans: (a) Sol: A, D, B are not in the grammar. 09. Ans: (a) Sol: 1. As ( +R) = R, C -3 must be in the answer, This rules out choice (b) 2. =, so in D ( a+(b) ) = a + b. So D - 6 cannot be in the answer. This rules out choice (d) 3. =, So in D (a+(b) ) = a+(b), same as choice b. So D 4 must be in the answer. So by elimination (a) is the answer. 10. Ans: (a) Sol: (b) (0+1) 110 has (0+1) 110 has (c) has 1 1 has 111 (d) has 11 has 111 By elimination the answer is (a) 11. Ans: (a) Sol: a(a) + a(a(a) ) + aaaaa a = aa + (even number of a s) a + aaa = a + aa + aa(a ) 12. Ans: (a) Sol: 0,1 0 0 H P M C 0
4 : 3 : CSIT Postal Coaching Solutions 0 1 H HP H HP HPM H HPM HPMC H HPMC HPMC H H 0 HP 0 0 HPM HPMC Ans: (a) Sol: a q 0 a q 2 b b b b a q 1 q 3 a 14. Ans: (b) Sol: (a) This choice contains a c which is a negative string. (c) This choice contains babb which is a negative string. (b) Only the 1 st symbol is a b & the rest of a s. So this is ok. 15. Ans: (b) Sol: (c) (a) L contain {} which is not a infinite language so (c) is false. L contains the finite sets so this is false. (b) L is closed under concatenation as L 1 L 2 will still be infinite. 16. Ans: (c) Sol: (a) This is the palindrome language which is a CFL & not regular (b) {ww R x/ x, w (0+1) + } = {0 n 110 n 1/n1} is a CFL which is not regular. (c) {wxw R /w, x(0+1) + } = 0(0+1) 0 +1(1+1) is a regular set. (d) {xww R / x, w(0+1) + } = {110 n 10 n /n1} is a CFL that is not Regular. 17. Ans: (a) Sol: Any formal language, even if not R.E., can be considered to be the infinite union of singleton sets & hence the infinite union of regular sets is not necessarily infinite.
5 : 4 : Theory of Computation 18. Ans: (a) Sol: (a) 0B / 0 1 A A 0 1 0B C Since (a) is correct, by the method of elimination (b), (c), (d) can be excluded. 19. Ans: (a) Sol: By the pumping lemma for regular sets there can only one sliding window. If two parts of a string depend on each other then the language cannot be regular. This rules out (b), (c), (d) as the a s, b s & c s depend on each other. 20. Ans: (a) Sol: E a A B a B a b b E aabab 21. Ans: (a) & (b) Sol: (d) {a p / p Prime} is not a regular set. It is a CSL. (a) (c) a k /k is multiple of n =a kn =(a k ) n is a Regular Expression. 22. Ans: (d) Sol: (d) L = {a m b n / m 1, n1} = a + b + is regular (a) L={x/x has equal number of a s & b s} L a b = {a n b n / n0}is a CFL. So L is not regular. (b) L = {a n b n /n1} is not regular by the pumping lemma for regular sets. (c) L a b = {a i b j / i j} is not regular by the pumping lemma for regular sets. 23. Ans: (c) Sol: To accept the complement interchange the final & non-final states. So the two final states become non-final & m 2 non-final states become final in 24. Ans: (a) & (b) c L. 1 Sol: (a) L = {wxw R w, x(0,1) + } = 0 (0 + 1) 0 + 1(0 + 1) 0 is regular (b) L = {wxw R w(a,b) + } = a(a+b) a + b(a+b) b is regular (c) L = {ww R w(a+b) + }is the palindrome 25. Ans: (c) language which is a CFL & not regular. Sol: (a+b ) = (a + + b +b ) = (a + b) So (a) & (b) are valid.
6 : 5 : CSIT Postal Coaching Solutions 26. Ans: (d) Sol: 1. This is un-decidable as it is the halting problem of TMs 2. The complement of a CFL can represent the valid computations of a Turing Machine & so this is un-decidable. 3. The regular sets are closed under complement. So this is decidable. 4. The recursive sets are closed under complement so this is decidable. 27. Ans: (d) Sol: L = {equal number of a s & b s} L a b = {a n b n n 1}. So L is a CFL which is not regular So L is a CSL as it is a CFL So L is accepted by LBA. The class of DFA, NFA & 2DFA all accept only the regular sets. So they cannot accept L. 28. Ans: (d) Sol: does not contain 100. So must be in the answer. This rules out choices (b) & (c). (a) is 0 (1+0) = (0+1) So it contains all strings. So it cannot be the answer. By elimination (d) is the answer. 29. Ans: (c) Sol: P1 is decidable as we simply trace the string through the state diagram. P2 is a known un-decidable problem. 30. Ans: (d) Sol: L = (0+1) 00 dfa 31. Ans: (a) Sol: [a] is true as L is a standard CFL that is not a regular set. The reason [r] is true & is the reason why L is not a regular set. 32. Ans: (a) 0,1 0 0 H P C 0 1 H HP H HP HPC H HPC HPC H 33. Ans: (b) Sol: S AB/DA B BCD/ABD/CC/b A a/bc C abd/a C abcad/dab A abcad/da A abd/acbd/asbcd
7 : 6 : Theory of Computation Reduced grammar S AB B b A a/bc C a S Ab A a/bc C a Or S Ab A a/ba Or S ba/bab So the language is finite. 34. Ans: (a) Sol: (a) This is the modulo 5 machine it has 5 states plus one state move to reject state starting with 0. This is true. (b) The NFA is complement of 0/1 0 0 And also the FA cannot have more than 4 states. (d) This is false as the minimal FA is unique. The above is a CSL & not CFL. L 2 = set of all palindromes in unary = a Now L 1 a = L Ans: (c) Sol: A modulo N machine has N states. 37. Ans: (b) Sol: L x is not regular. If L is regular L 1/2 is regular. L x is not regular by the pumping lemma for regular sets. To get L 1/2 from a regular set L the machine has to make one move for every two moves of the machine accepting L. 38. Ans: (b) Sol: Practically every question related to regular sets and F.A. is decidable once just has to enumerate all the strings accepted by the DFA in lexicographic order. 39. Ans: (b) Sol: 0/0 1/0 A B 0/0 0/1 1/0 1/0 35. Ans: (d) Sol: L 1 = set of all squares in unary n a 2 / n 1 D 0/0 C 1/0
8 : 7 : CSIT Postal Coaching Solutions Consider input 0 If A is start state output is 0 If B is start state output is 0 If C is start state output is 0 If D is start state output is 1 So I is false Tracing 1100 from A, II is valid So if II is valid by elimination the answer is (b). 40. Sol: The set accepting is = (11 + ) = Ans: (b) Sol: The final state is C. How do we come to C. Clearly from B or D on input 0. How do we come to B or D. We need input 1 from A or B. So (b) is the answer. Condition Condition Ans: (c) Sol: From state q 1, both a & b lead to a final state. From state q 2, both a & b lead to a final state. q 1 and q 2 can be merged into one state q 3 can be deleted. So minimal DFA is q 0 b a,b a q 1 Set accepted = b a(a + b) 44. Ans: (b) Sol: The minimal DFA has two states. 42. Ans: (c) Sol: Condition Condition Ans: (a) Sol: I is a (bb) is regular. IV is (a+b) c (a+b) is regular. II and III are not regular by the pumping lemma for regular sets. 46. Ans: (a) Sol: (d) is ruled out as it containing (b) is ruled out as it containing 0 (c) is ruled out as it containing 0
9 : 8 : Theory of Computation 47. Ans: (a) Sol: s and t can be merged as on a & b they go to a final state. 2. Context Free Languages & Push-down Automata 48. Ans: (d) Sol: is 0 must reject, so it should go to q This reduces the choice to (c) and (d) on 1 give to In (c) we have the edge 10 on 0 remain in the same state. This will accept 0. So it cannot be the answer. By elimination (d) is the answer. 49. Ans: (d) Sol: As 0 is accepted (d) is false. Statement I is true as A is a F.A and its complement is regular and hence a CFL. Also L(A) = 0(0+1) ( 0 +1) = ( ) (0 +1) = (11 0+0) (0+1) Ans: (d) Sol: (a) The intersection of two DCFLs can simulate all the valid computations of a Turing Machine, so DCFLs are not closed under complement. (b) The union of the two DCFLs {a n b n /n1} & {a n b 2n /n1}is not a DCFL. So DCFLs are not closed under union. (c) The homomorphism h(c) =, h(a)= a, h(b)=b applied to the DCFLs {a n b n /n1} {ca n b 2n /n1}converts it to a CFL that is not a DCFL. So CFLs are not closed under homomorphism. (d) The class of DCFLs are closed under the operations of complementation & inverse homomorphism 02. Ans: (a), (c) & (d) Sol: (a) They will be infinite classes of languages when L 1 L 2 = is decidable. So it is not only for regular set. This is FALSE. (b) It is decidable for DCFLs if L = R. TRUE
10 : 9 : CSIT Postal Coaching Solutions (c) The intersection of two DCFLs can simulate all the valid computations of a Turing Machine. This is FALSE. (d) The intersection of two CSLS, is CSLs, can simulate all the valid computations of a Turing Machine. This is FLASE 03. Ans: (a) & (d) Sol: The class of CFLs is closed under intersection with a regular set. (a) A CFL L = L, so it need not be regular. (b) The intersection of a CFL is always a CFL. 04. Ans: (a) Sol: The class of CFLs are closed under min but not max. 07. Ans: (d) Sol: Both L 1 & L 2 are CFL and then union is a CFL their intersection is the language {a n b n c n / n 1} is a CSL that is not a CFL. 08. Ans: (a) Sol: S XY, X Zb, Y Bw Z AB, W Z A aa/ba/ B Ba/Bb/ S XY, X Zb, Y w, Y Bw Z /AB/A/B W Z A a/aa/ba B a/ba/b S XY, X Zb/b, Y b, Y Bw Z AB/A/B, W Z A a/aa/ba B a/ba/b/bb 05. Ans: (a) Sol: The class of all formal languages is not countably infinite. 2 DFAs, CFLs, R.E sets & finite sets are all finite descriptions and are countably 09. Ans: (c) Sol: p a, z/xz q a, x/xx infinite. c, Z/Z c, x/x 06. Ans: (d) Sol: From the state p we can go now here. s b, x/ r, z/ b, x/
11 : 10 : Theory of Computation If the input states with a c then we cannot proceed with any more. So (a) & (b) are false and rejected. After a s which choose the machine to q & increase the stack, only a c must come for pop moves. So input must have a n c. So (c) is the answer and (d) can be rejected. To simplify this problem note that for (a) we must check for the string cabc, for (b) we must check for the string cacbc, for (c) we must check for the string acbc, for (d) we must check for the string abc. 10. Ans: (b) Sol: MC 1 is the complement of a CFL and is in general an R.E. set. 11. Ans: (c) Sol: The rule B rules out the choice(c) from being an operator grammar. 12. Ans: (c) Sol: The production S bdb/b Makes a CSG. 13. Ans: (d) Sol: (i) Consider the homomorphism h(0) = a, h(1) = b, h(0) = c, h(l 3 ) a b c = {a n b n c n /n 1} is a standard CSL that is not a CFL. So L 3 is not a CFL. (ii) As three parts of the string are related to each other L 2 is not a CFL. 14. Ans: (b) Sol: a is accepted by the NFA, is not accepted by the NFA So the complement should accept & reject a. only (b) can be chosen as the answer. 15. Ans: (a) Sol: L 1 is the annihilator. So L 1 L 2 =. L Ans: (d) Sol: Init (L) contains L, so these are strings with an equal number of a s and b s. This rules out (a) is not there in init (L) so (b) is ruled out (c) is ruled out as Init(L) containing L. 17. Ans: (c) Sol: Let l=1, then the height of the parse tree is 1. Let l= 2, then the height of the parse tree is 2. So (c) is the answer. 18. Ans: (c) Sol: L = {ww R w w in (a+b) + } is a CFL. L ba bba ba b = {ba n bba n ba n b n1} is a CSL that is not a CFL. So [a] is false.
12 : 11 : CSIT Postal Coaching Solutions The reason also false as the pumping lemma for CFLs is not satisfied. 19. Ans: (b) Sol: The language L = {ww w in (a+b) } is a standard CSL that is not a CFL. Its complement is a CFL as a CFG can be constructed generating L 1. L 1 satisfies the pumping lemma. If a language satisfies the pumping lemma for CFLs are cannot say anything. So [r] is not the reason for [a]. 20. Ans: (a) n 2 Sol: S : a / n is a finite set. So the answer should have S 4 as a choice. 21. Ans: (a) Sol: B b,c a S b + /a + /Ab + /a + A and A generates an equal number of a s & b s. So the language generates set of strings with an unequal number of a s & b s. Note that it does not generate all such strings as the a s come first & then the b s. 23. Ans: (b) Sol: 2, 1, 1, 3 is a solution to (1) where (2) has no solution. 24. Ans: (a) Sol: The c in the center of (a) tells us where the mirror can be placed in the mirror language. (b) Contains all palindromes & we have to place the mirror non-deterministically. (c) is a standard CSL that is not a CFL or DCFL. (d) is the same as (b) a CFL that is not a DCFL. 25. Ans: (d) Sol: Non-determinism does not add power to the finite automata. So D f = N f. Non-determinism adds power to the pushdown automata, So D p N P. 26. Ans: (d) Sol: 1. S S or S S 22. Ans: (c) Sol: The DCFLs are not closed under reversal. The language {a n b n n 1} {a 2n b n n 1} is a DCFL but its reversal is not. So has more than one derivation tree & hence G is ambiguous.
13 : 12 : Theory of Computation 2. G is a CFG So L(G) can be accepted by a PDA. A DPDA can check for an equal number of a s & b s. 3. L (G) generates an equal number of a s & b s, and permutation of such strings. S a B a B B or S a B a B B 27. Ans: (b) Sol: (b) L 3 is R.E but not recursive. So L 3 regular set is R.E but not recursive. (a) DCFL regular is DCFL. (c) DCFL regular is CFL (d) DCFL regular R.E. set = R.E set R.E set R.E set= R.E set 28. Ans: (c) Sol: The grammar generates an equal number of a s & b s. 29. Ans: (b) Sol: 1. aabbab = (aabb) (ab) 2. aabbab = (aabbab) b b a S B b Yields (aabb) (ab) 30. Ans: (c) Sol: (1) Should allow (00) even number of 0 s. (3) & (4) compulsory require a 1 in their input. So P can be mapped to 1 or 2. Q can also be mapped to 1 or 2. So the answer by elimination is (a) or (c). (d) Accepts 0010 and only (1) matches this. So the answer is P 1, Q 2, and so it is (c). b S a B b b Yields (aabbab) 31. Ans: (d) Sol: The set {0 p 1 q 0 r p, q, r 0} is the set a b c a regular set. So L 1 is a regular set L 2 is a CFL which is not regular. So (a) is true. CFL regular = CFL. So (b) is true.
14 : 13 : CSIT Postal Coaching Solutions L 2 is a CFL and any CFL is a recursive set & the recursive sets are closed under complement. So (c) is true. Complement of L 1 is a regular set so it is a CFL which is regular. So (d) is false. and Turing machine can be finitely described. These finite representations can be effectively enumerated. The set of all formal languages is not countably infinite 01. Ans: (d) Sol: The R.E. sets are not closed under complement but the recursive sets are so, if a R.E set has its complement as a R.E set then it is recursive. 02. Ans: (b) Sol: The membership problem of TMs is partially decidable. Just run the machine and sit infront of it. 03. Ans: (d) 3. Turing Machine, Modifications, CSLs, Recursive & R.E. sets Sol: can not be in any CSL. So, rules out kleene closure, substitution, homomorphism & / The CSLs are closed under -free substitution, - free homomorphism & / Ans: (a) Sol: The primes can be given by an algorithm so they form a recursive set. The DCFLs 05. Ans: (a) Sol: A singleton set is a finite set and is decidable 06. Ans: (d) Sol: Some NP - Hard problem may possibly have polynomial complexity if P = NP. 07. Ans: (d) Sol: L 1 = 0 1 is a regular set and hence a CFL and R.E set. It can be recognized by finite automata, push down automata and Turing machine. L 2 = {0 n 1 n n 1}is a standard CFL that can be recognized by PDA and Turing machine L 3 = {0 n 1 n 0 n n 1} is a standard CSL that is not a CFL. 08. Ans: (d) Sol: Ram shows L 1 is R.E but this does not mean it is recursive. So, choice (b) is ruled out. If a R.E and its complement are both R.E then the set is recursive
15 : 14 : Theory of Computation If an R.E. set can have its elements enumerated in a lexicographic order then it is recursive 09. Ans: (a) Sol: An R.E set and its complement are both R.E so the sets L 1 and L 2 both are recursive 10. Ans: (d) Sol: The set is a finite set so it is regular or Type Ans: (d) Sol: At present it is not known if NP is closed under complement. If P = NP then NP is closed under complementation. Since NP deals with sets accepted by some deterministic Turing Machine of polynomial time complexity, the class NP is closed under union, intersection and concatenation. 12. Ans: (a) Sol: (b) One blank tape the TM halts on input, so (b) cannot be the answer. (c) On input 0: q 0 0 q 1 1 q 0 1 q 1 1 (d) On input 1: q 0 1 q 1 1 q 0 1 q 1 1 loops. So, (d) can not be the answer. By elimination (a) is the answer. 13. Ans: (a), (c) & (d) Sol: 1. abbb is accepted by the F.A so (a) is ruled out. 2. After an a, ab is compulsory. So aa cannot be a substring. 3. After an a atleast two b s must be there. 14. Ans: (d) Sol: Practically everything about regular sets is decidable. So, (4) is decidable. It is decidable if a CFG generates an empty set. Form the reduced grammar if all productions vanish L (G) = The completeness problem L(G) = is un-decidable for CFLs. The invalid computations of a Turing machine can be given by a CFL. If we can decide if a TM accepts a regular set then we can resolve L(G) = for CFLs. So the regularity problem of TMs is un-decidable. q loops. So (c) cannot be the answer.
MA/CSSE 474 Theory of Computation
MA/CSSE 474 Theory of Computation CFL Hierarchy CFL Decision Problems Your Questions? Previous class days' material Reading Assignments HW 12 or 13 problems Anything else I have included some slides online
More informationTHEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET
THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET Regular Languages and FA A language is a set of strings over a finite alphabet Σ. All languages are finite or countably infinite. The set of all languages
More informationTheory of Computation
Fall 2002 (YEN) Theory of Computation Midterm Exam. Name:... I.D.#:... 1. (30 pts) True or false (mark O for true ; X for false ). (Score=Max{0, Right- 1 2 Wrong}.) (1) X... If L 1 is regular and L 2 L
More informationVTU QUESTION BANK. Unit 1. Introduction to Finite Automata. 1. Obtain DFAs to accept strings of a s and b s having exactly one a.
VTU QUESTION BANK Unit 1 Introduction to Finite Automata 1. Obtain DFAs to accept strings of a s and b s having exactly one a.(5m )( Dec-2014) 2. Obtain a DFA to accept strings of a s and b s having even
More informationSCHEME FOR INTERNAL ASSESSMENT TEST 3
SCHEME FOR INTERNAL ASSESSMENT TEST 3 Max Marks: 40 Subject& Code: Automata Theory & Computability (15CS54) Sem: V ISE (A & B) Note: Answer any FIVE full questions, choosing one full question from each
More informationQuestion Bank UNIT I
Siddhivinayak Technical Campus School of Engineering & Research Technology Department of computer science and Engineering Session 2016-2017 Subject Name- Theory of Computation Subject Code-4KS05 Sr No.
More informationNODIA AND COMPANY. GATE SOLVED PAPER Computer Science Engineering Theory of Computation. Copyright By NODIA & COMPANY
No part of this publication may be reproduced or distributed in any form or any means, electronic, mechanical, photocopying, or otherwise without the prior permission of the author. GATE SOLVED PAPER Computer
More informationHarvard CS 121 and CSCI E-207 Lecture 10: CFLs: PDAs, Closure Properties, and Non-CFLs
Harvard CS 121 and CSCI E-207 Lecture 10: CFLs: PDAs, Closure Properties, and Non-CFLs Harry Lewis October 8, 2013 Reading: Sipser, pp. 119-128. Pushdown Automata (review) Pushdown Automata = Finite automaton
More informationSYLLABUS. Introduction to Finite Automata, Central Concepts of Automata Theory. CHAPTER - 3 : REGULAR EXPRESSIONS AND LANGUAGES
Contents i SYLLABUS UNIT - I CHAPTER - 1 : AUT UTOMA OMATA Introduction to Finite Automata, Central Concepts of Automata Theory. CHAPTER - 2 : FINITE AUT UTOMA OMATA An Informal Picture of Finite Automata,
More informationFORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
15-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY REVIEW for MIDTERM 1 THURSDAY Feb 6 Midterm 1 will cover everything we have seen so far The PROBLEMS will be from Sipser, Chapters 1, 2, 3 It will be
More informationPushdown automata. Twan van Laarhoven. Institute for Computing and Information Sciences Intelligent Systems Radboud University Nijmegen
Pushdown automata Twan van Laarhoven Institute for Computing and Information Sciences Intelligent Systems Version: fall 2014 T. van Laarhoven Version: fall 2014 Formal Languages, Grammars and Automata
More informationClosure Properties of Context-Free Languages. Foundations of Computer Science Theory
Closure Properties of Context-Free Languages Foundations of Computer Science Theory Closure Properties of CFLs CFLs are closed under: Union Concatenation Kleene closure Reversal CFLs are not closed under
More informationGEETANJALI INSTITUTE OF TECHNICAL STUDIES, UDAIPUR I
GEETANJALI INSTITUTE OF TECHNICAL STUDIES, UDAIPUR I Internal Examination 2017-18 B.Tech III Year VI Semester Sub: Theory of Computation (6CS3A) Time: 1 Hour 30 min. Max Marks: 40 Note: Attempt all three
More informationProperties of Context-Free Languages. Closure Properties Decision Properties
Properties of Context-Free Languages Closure Properties Decision Properties 1 Closure Properties of CFL s CFL s are closed under union, concatenation, and Kleene closure. Also, under reversal, homomorphisms
More informationAC68 FINITE AUTOMATA & FORMULA LANGUAGES DEC 2013
Q.2 a. Prove by mathematical induction n 4 4n 2 is divisible by 3 for n 0. Basic step: For n = 0, n 3 n = 0 which is divisible by 3. Induction hypothesis: Let p(n) = n 3 n is divisible by 3. Induction
More informationTheory of Computation (IV) Yijia Chen Fudan University
Theory of Computation (IV) Yijia Chen Fudan University Review language regular context-free machine DFA/ NFA PDA syntax regular expression context-free grammar Pushdown automata Definition A pushdown automaton
More informationINSTITUTE OF AERONAUTICAL ENGINEERING
INSTITUTE OF AERONAUTICAL ENGINEERING DUNDIGAL 500 043, HYDERABAD COMPUTER SCIENCE AND ENGINEERING TUTORIAL QUESTION BANK Course Name : FORMAL LANGUAGES AND AUTOMATA THEORY Course Code : A40509 Class :
More informationComputational Models - Lecture 5 1
Computational Models - Lecture 5 1 Handout Mode Iftach Haitner and Yishay Mansour. Tel Aviv University. April 10/22, 2013 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice
More information(b) If G=({S}, {a}, {S SS}, S) find the language generated by G. [8+8] 2. Convert the following grammar to Greibach Normal Form G = ({A1, A2, A3},
Code No: 07A50501 R07 Set No. 2 III B.Tech I Semester Examinations,MAY 2011 FORMAL LANGUAGES AND AUTOMATA THEORY Computer Science And Engineering Time: 3 hours Max Marks: 80 Answer any FIVE Questions All
More informationCSE 105 THEORY OF COMPUTATION. Spring 2018 review class
CSE 105 THEORY OF COMPUTATION Spring 2018 review class Today's learning goals Summarize key concepts, ideas, themes from CSE 105. Approach your final exam studying with confidence. Identify areas to focus
More informationNPDA, CFG equivalence
NPDA, CFG equivalence Theorem A language L is recognized by a NPDA iff L is described by a CFG. Must prove two directions: ( ) L is recognized by a NPDA implies L is described by a CFG. ( ) L is described
More informationOgden s Lemma for CFLs
Ogden s Lemma for CFLs Theorem If L is a context-free language, then there exists an integer l such that for any u L with at least l positions marked, u can be written as u = vwxyz such that 1 x and at
More informationcse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska
cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska LECTURE 14 SMALL REVIEW FOR FINAL SOME Y/N QUESTIONS Q1 Given Σ =, there is L over Σ Yes: = {e} and L = {e} Σ Q2 There are uncountably
More informationFundamentele Informatica II
Fundamentele Informatica II Answer to selected exercises 5 John C Martin: Introduction to Languages and the Theory of Computation M.M. Bonsangue (and J. Kleijn) Fall 2011 5.1.a (q 0, ab, Z 0 ) (q 1, b,
More informationSt.MARTIN S ENGINEERING COLLEGE Dhulapally, Secunderabad
St.MARTIN S ENGINEERING COLLEGE Dhulapally, Secunderabad-500 014 Subject: FORMAL LANGUAGES AND AUTOMATA THEORY Class : CSE II PART A (SHORT ANSWER QUESTIONS) UNIT- I 1 Explain transition diagram, transition
More informationBefore We Start. The Pumping Lemma. Languages. Context Free Languages. Plan for today. Now our picture looks like. Any questions?
Before We Start The Pumping Lemma Any questions? The Lemma & Decision/ Languages Future Exam Question What is a language? What is a class of languages? Context Free Languages Context Free Languages(CFL)
More informationTheory Bridge Exam Example Questions
Theory Bridge Exam Example Questions Annotated version with some (sometimes rather sketchy) answers and notes. This is a collection of sample theory bridge exam questions. This is just to get some idea
More information1. (a) Explain the procedure to convert Context Free Grammar to Push Down Automata.
Code No: R09220504 R09 Set No. 2 II B.Tech II Semester Examinations,December-January, 2011-2012 FORMAL LANGUAGES AND AUTOMATA THEORY Computer Science And Engineering Time: 3 hours Max Marks: 75 Answer
More informationCSE 105 THEORY OF COMPUTATION
CSE 105 THEORY OF COMPUTATION Spring 2016 http://cseweb.ucsd.edu/classes/sp16/cse105-ab/ Today's learning goals Sipser Ch 3.3, 4.1 State and use the Church-Turing thesis. Give examples of decidable problems.
More informationAutomata and Computability. Solutions to Exercises
Automata and Computability Solutions to Exercises Spring 27 Alexis Maciel Department of Computer Science Clarkson University Copyright c 27 Alexis Maciel ii Contents Preface vii Introduction 2 Finite Automata
More informationFinal exam study sheet for CS3719 Turing machines and decidability.
Final exam study sheet for CS3719 Turing machines and decidability. A Turing machine is a finite automaton with an infinite memory (tape). Formally, a Turing machine is a 6-tuple M = (Q, Σ, Γ, δ, q 0,
More informationAutomata and Computability. Solutions to Exercises
Automata and Computability Solutions to Exercises Fall 28 Alexis Maciel Department of Computer Science Clarkson University Copyright c 28 Alexis Maciel ii Contents Preface vii Introduction 2 Finite Automata
More information60-354, Theory of Computation Fall Asish Mukhopadhyay School of Computer Science University of Windsor
60-354, Theory of Computation Fall 2013 Asish Mukhopadhyay School of Computer Science University of Windsor Pushdown Automata (PDA) PDA = ε-nfa + stack Acceptance ε-nfa enters a final state or Stack is
More informationCSE 105 THEORY OF COMPUTATION
CSE 105 THEORY OF COMPUTATION Spring 2017 http://cseweb.ucsd.edu/classes/sp17/cse105-ab/ Today's learning goals Summarize key concepts, ideas, themes from CSE 105. Approach your final exam studying with
More informationECS 120: Theory of Computation UC Davis Phillip Rogaway February 16, Midterm Exam
ECS 120: Theory of Computation Handout MT UC Davis Phillip Rogaway February 16, 2012 Midterm Exam Instructions: The exam has six pages, including this cover page, printed out two-sided (no more wasted
More informationDM17. Beregnelighed. Jacob Aae Mikkelsen
DM17 Beregnelighed Jacob Aae Mikkelsen January 12, 2007 CONTENTS Contents 1 Introduction 2 1.1 Operations with languages...................... 2 2 Finite Automata 3 2.1 Regular expressions/languages....................
More information} Some languages are Turing-decidable A Turing Machine will halt on all inputs (either accepting or rejecting). No infinite loops.
and their languages } Some languages are Turing-decidable A Turing Machine will halt on all inputs (either accepting or rejecting). No infinite loops. } Some languages are Turing-recognizable, but not
More informationNotes for Comp 497 (Comp 454) Week 10 4/5/05
Notes for Comp 497 (Comp 454) Week 10 4/5/05 Today look at the last two chapters in Part II. Cohen presents some results concerning context-free languages (CFL) and regular languages (RL) also some decidability
More informationFormal Languages, Automata and Models of Computation
CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2011 1 Content - More Properties of Regular Languages (RL)
More informationDeterministic PDA s. Deepak D Souza. 21 October Department of Computer Science and Automation Indian Institute of Science, Bangalore.
Deterministic PDA s Deepak D Souza Department of Computer Science and Automation Indian Institute of Science, Bangalore. 21 October 2011 Outline 1 Deterministic PDA s 2 Closure properties of DCFL s 3 Complementing
More information2.1 Solution. E T F a. E E + T T + T F + T a + T a + F a + a
. Solution E T F a E E + T T + T F + T a + T a + F a + a E E + T E + T + T T + T + T F + T + T a + T + T a + F + T a + a + T a + a + F a + a + a E T F ( E) ( T ) ( F) (( E)) (( T )) (( F)) (( a)) . Solution
More informationCS154 Final Examination
CS154 Final Examination June 7, 2010, 7-10PM Directions: CS154 students: answer all 13 questions on this paper. Those taking CS154N should answer only questions 8-13. The total number of points on this
More informationFoundations of Informatics: a Bridging Course
Foundations of Informatics: a Bridging Course Week 3: Formal Languages and Semantics Thomas Noll Lehrstuhl für Informatik 2 RWTH Aachen University noll@cs.rwth-aachen.de http://www.b-it-center.de/wob/en/view/class211_id948.html
More informationAC68 FINITE AUTOMATA & FORMULA LANGUAGES JUNE 2014
Q.2 a. Show by using Mathematical Induction that n i= 1 i 2 n = ( n + 1) ( 2 n + 1) 6 b. Define language. Let = {0; 1} denote an alphabet. Enumerate five elements of the following languages: (i) Even binary
More informationWhat languages are Turing-decidable? What languages are not Turing-decidable? Is there a language that isn t even Turingrecognizable?
} We ll now take a look at Turing Machines at a high level and consider what types of problems can be solved algorithmically and what types can t: What languages are Turing-decidable? What languages are
More informationPumping Lemma for CFLs
Pumping Lemma for CFLs v y s Here we go again! Intuition: If L is CF, then some CFG G produces strings in L If some string in L is very long, it will have a very tall parse tree If a parse tree is taller
More informationNon-context-Free Languages. CS215, Lecture 5 c
Non-context-Free Languages CS215, Lecture 5 c 2007 1 The Pumping Lemma Theorem. (Pumping Lemma) Let be context-free. There exists a positive integer divided into five pieces, Proof for for each, and..
More informationCS481F01 Prelim 2 Solutions
CS481F01 Prelim 2 Solutions A. Demers 7 Nov 2001 1 (30 pts = 4 pts each part + 2 free points). For this question we use the following notation: x y means x is a prefix of y m k n means m n k For each of
More informationPart I: Definitions and Properties
Turing Machines Part I: Definitions and Properties Finite State Automata Deterministic Automata (DFSA) M = {Q, Σ, δ, q 0, F} -- Σ = Symbols -- Q = States -- q 0 = Initial State -- F = Accepting States
More informationSection 1 (closed-book) Total points 30
CS 454 Theory of Computation Fall 2011 Section 1 (closed-book) Total points 30 1. Which of the following are true? (a) a PDA can always be converted to an equivalent PDA that at each step pops or pushes
More informationLanguages, regular languages, finite automata
Notes on Computer Theory Last updated: January, 2018 Languages, regular languages, finite automata Content largely taken from Richards [1] and Sipser [2] 1 Languages An alphabet is a finite set of characters,
More informationTheory of Computation Turing Machine and Pushdown Automata
Theory of Computation Turing Machine and Pushdown Automata 1. What is a Turing Machine? A Turing Machine is an accepting device which accepts the languages (recursively enumerable set) generated by type
More informationFORMAL LANGUAGES, AUTOMATA AND COMPUTATION
FORMAL LANGUAGES, AUTOMATA AND COMPUTATION DECIDABILITY ( LECTURE 15) SLIDES FOR 15-453 SPRING 2011 1 / 34 TURING MACHINES-SYNOPSIS The most general model of computation Computations of a TM are described
More informationFORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
15-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY Chomsky Normal Form and TURING MACHINES TUESDAY Feb 4 CHOMSKY NORMAL FORM A context-free grammar is in Chomsky normal form if every rule is of the form:
More informationTAFL 1 (ECS-403) Unit- II. 2.1 Regular Expression: The Operators of Regular Expressions: Building Regular Expressions
TAFL 1 (ECS-403) Unit- II 2.1 Regular Expression: 2.1.1 The Operators of Regular Expressions: 2.1.2 Building Regular Expressions 2.1.3 Precedence of Regular-Expression Operators 2.1.4 Algebraic laws for
More informationCSE 105 THEORY OF COMPUTATION
CSE 105 THEORY OF COMPUTATION Spring 2016 http://cseweb.ucsd.edu/classes/sp16/cse105-ab/ Today's learning goals Sipser Ch 2 Define push down automata Trace the computation of a push down automaton Design
More informationCPSC 421: Tutorial #1
CPSC 421: Tutorial #1 October 14, 2016 Set Theory. 1. Let A be an arbitrary set, and let B = {x A : x / x}. That is, B contains all sets in A that do not contain themselves: For all y, ( ) y B if and only
More informationAuthor: Vivek Kulkarni ( )
Author: Vivek Kulkarni ( vivek_kulkarni@yahoo.com ) Chapter-3: Regular Expressions Solutions for Review Questions @ Oxford University Press 2013. All rights reserved. 1 Q.1 Define the following and give
More informationFinite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018
Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Lecture 14 Ana Bove May 14th 2018 Recap: Context-free Grammars Simplification of grammars: Elimination of ǫ-productions; Elimination of
More informationProperties of Context-Free Languages
Properties of Context-Free Languages Seungjin Choi Department of Computer Science and Engineering Pohang University of Science and Technology 77 Cheongam-ro, Nam-gu, Pohang 37673, Korea seungjin@postech.ac.kr
More informationHomework 8. a b b a b a b. two-way, read/write
Homework 8 309 Homework 8 1. Describe a TM that accepts the set {a n n is a power of 2}. Your description should be at the level of the descriptions in Lecture 29 of the TM that accepts {ww w Σ } and the
More informationCISC4090: Theory of Computation
CISC4090: Theory of Computation Chapter 2 Context-Free Languages Courtesy of Prof. Arthur G. Werschulz Fordham University Department of Computer and Information Sciences Spring, 2014 Overview In Chapter
More informationNotes for Comp 497 (454) Week 10
Notes for Comp 497 (454) Week 10 Today we look at the last two chapters in Part II. Cohen presents some results concerning the two categories of language we have seen so far: Regular languages (RL). Context-free
More informationUndecidable Problems and Reducibility
University of Georgia Fall 2014 Reducibility We show a problem decidable/undecidable by reducing it to another problem. One type of reduction: mapping reduction. Definition Let A, B be languages over Σ.
More informationCSE 105 THEORY OF COMPUTATION
CSE 105 THEORY OF COMPUTATION Spring 2016 http://cseweb.ucsd.edu/classes/sp16/cse105-ab/ Today's learning goals Sipser Ch 2 Design a PDA and a CFG for a given language Give informal description for a PDA,
More informationCS500 Homework #2 Solutions
CS500 Homework #2 Solutions 1. Consider the two languages Show that L 1 is context-free but L 2 is not. L 1 = {a i b j c k d l i = j k = l} L 2 = {a i b j c k d l i = k j = l} Answer. L 1 is the concatenation
More informationFABER Formal Languages, Automata. Lecture 2. Mälardalen University
CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 2 Mälardalen University 2010 1 Content Languages, g Alphabets and Strings Strings & String Operations Languages & Language Operations
More informationV Honors Theory of Computation
V22.0453-001 Honors Theory of Computation Problem Set 3 Solutions Problem 1 Solution: The class of languages recognized by these machines is the exactly the class of regular languages, thus this TM variant
More informationAutomata Theory - Quiz II (Solutions)
Automata Theory - Quiz II (Solutions) K. Subramani LCSEE, West Virginia University, Morgantown, WV {ksmani@csee.wvu.edu} 1 Problems 1. Induction: Let L denote the language of balanced strings over Σ =
More informationGrade 6 Math Circles October 20/21, Formalism and Languages: Beyond Regular Languages
Faculty of Mathematics Waterloo, Ontario N2L 3G1 Centre for Education in Mathematics and Computing Grade 6 Math Circles October 20/21, 2015 Formalism and Languages: Beyond Regular Languages Dr. Troy Vasiga
More informationRumination on the Formal Definition of DPDA
Rumination on the Formal Definition of DPDA In the definition of DPDA, there are some parts that do not agree with our intuition. Let M = (Q, Σ, Γ, δ, q 0, Z 0, F ) be a DPDA. According to the definition,
More informationAn automaton with a finite number of states is called a Finite Automaton (FA) or Finite State Machine (FSM).
Automata The term "Automata" is derived from the Greek word "αὐτόματα" which means "self-acting". An automaton (Automata in plural) is an abstract self-propelled computing device which follows a predetermined
More informationTheory & Practice Book. Computer Science & IT. for. Public Sector Exams
Theory & Practice Book Computer Science & IT for Public Sector Exams ISRO, DRDO, BARC, BEL, HAL, NTPC, ONGC, BHEL, SAIL, GAIL, MTNL, FCI, ECL, ATC, DMRC, HLL, UPRVNL, CSPEB, OPTCL... Corporate Office:
More informationTheory of Computation
Theory of Computation Lecture #10 Sarmad Abbasi Virtual University Sarmad Abbasi (Virtual University) Theory of Computation 1 / 43 Lecture 10: Overview Linear Bounded Automata Acceptance Problem for LBAs
More informationCS 341 Homework 16 Languages that Are and Are Not Context-Free
CS 341 Homework 16 Languages that Are and Are Not Context-Free 1. Show that the following languages are context-free. You can do this by writing a context free grammar or a PDA, or you can use the closure
More informationLecture 17: Language Recognition
Lecture 17: Language Recognition Finite State Automata Deterministic and Non-Deterministic Finite Automata Regular Expressions Push-Down Automata Turing Machines Modeling Computation When attempting to
More informationCSE 355 Test 2, Fall 2016
CSE 355 Test 2, Fall 2016 28 October 2016, 8:35-9:25 a.m., LSA 191 Last Name SAMPLE ASU ID 1357924680 First Name(s) Ima Regrading of Midterms If you believe that your grade has not been added up correctly,
More informationDeterministic PDA s. Deepak D Souza. 08 Nov Department of Computer Science and Automation Indian Institute of Science, Bangalore.
Deterministic PDA s Deepak D Souza Department of Computer Science and Automation Indian Institute of Science, Bangalore. 08 Nov 2016 Outline 1 Deterministic PDA s 2 Closure properties of DCFL s 3 Complementing
More informationPushdown Automata (2015/11/23)
Chapter 6 Pushdown Automata (2015/11/23) Sagrada Familia, Barcelona, Spain Outline 6.0 Introduction 6.1 Definition of PDA 6.2 The Language of a PDA 6.3 Euivalence of PDA s and CFG s 6.4 Deterministic PDA
More informationSri vidya college of engineering and technology
Unit I FINITE AUTOMATA 1. Define hypothesis. The formal proof can be using deductive proof and inductive proof. The deductive proof consists of sequence of statements given with logical reasoning in order
More informationUNIT-VIII COMPUTABILITY THEORY
CONTEXT SENSITIVE LANGUAGE UNIT-VIII COMPUTABILITY THEORY A Context Sensitive Grammar is a 4-tuple, G = (N, Σ P, S) where: N Set of non terminal symbols Σ Set of terminal symbols S Start symbol of the
More informationPlease give details of your answer. A direct answer without explanation is not counted.
Please give details of your answer. A direct answer without explanation is not counted. Your answers must be in English. Please carefully read problem statements. During the exam you are not allowed to
More informationPushdown Automata. Notes on Automata and Theory of Computation. Chia-Ping Chen
Pushdown Automata Notes on Automata and Theory of Computation Chia-Ping Chen Department of Computer Science and Engineering National Sun Yat-Sen University Kaohsiung, Taiwan ROC Pushdown Automata p. 1
More information6.8 The Post Correspondence Problem
6.8. THE POST CORRESPONDENCE PROBLEM 423 6.8 The Post Correspondence Problem The Post correspondence problem (due to Emil Post) is another undecidable problem that turns out to be a very helpful tool for
More informationFundamentele Informatica 3 Antwoorden op geselecteerde opgaven uit Hoofdstuk 7 en Hoofdstuk 8
Fundamentele Informatica 3 Antwoorden op geselecteerde opgaven uit Hoofdstuk 7 en Hoofdstuk 8 John Martin: Introduction to Languages and the Theory of Computation Jetty Kleijn Najaar 2008 7.1 (q 0,bbcbb,Z
More informationThe View Over The Horizon
The View Over The Horizon enumerable decidable context free regular Context-Free Grammars An example of a context free grammar, G 1 : A 0A1 A B B # Terminology: Each line is a substitution rule or production.
More informationEquivalent Variations of Turing Machines
Equivalent Variations of Turing Machines Nondeterministic TM = deterministic TM npda = pushdown automata with n stacks 2PDA = npda = TM for all n 2 Turing machines with n tapes (n 2) and n tape heads has
More informationComputational Theory
Computational Theory Finite Automata and Regular Languages Curtis Larsen Dixie State University Computing and Design Fall 2018 Adapted from notes by Russ Ross Adapted from notes by Harry Lewis Curtis Larsen
More informationContext-free Languages and Pushdown Automata
Context-free Languages and Pushdown Automata Finite Automata vs CFLs E.g., {a n b n } CFLs Regular From earlier results: Languages every regular language is a CFL but there are CFLs that are not regular
More informationdownload instant at Assume that (w R ) R = w for all strings w Σ of length n or less.
Chapter 2 Languages 3. We prove, by induction on the length of the string, that w = (w R ) R for every string w Σ. Basis: The basis consists of the null string. In this case, (λ R ) R = (λ) R = λ as desired.
More informationAutomata: a short introduction
ILIAS, University of Luxembourg Discrete Mathematics II May 2012 What is a computer? Real computers are complicated; We abstract up to an essential model of computation; We begin with the simplest possible
More informationComputational Models - Lecture 4
Computational Models - Lecture 4 Regular languages: The Myhill-Nerode Theorem Context-free Grammars Chomsky Normal Form Pumping Lemma for context free languages Non context-free languages: Examples Push
More informationAutomata Theory CS F-08 Context-Free Grammars
Automata Theory CS411-2015F-08 Context-Free Grammars David Galles Department of Computer Science University of San Francisco 08-0: Context-Free Grammars Set of Terminals (Σ) Set of Non-Terminals Set of
More informationCS481F01 Solutions 6 PDAS
CS481F01 Solutions 6 PDAS A. Demers 2 November 2001 1. Give a NPDAs that recognize the following languages: (a) The set of all strings in {0, 1} that contain twice as many 1s as 0s. (answer a) We build
More informationChomsky Normal Form and TURING MACHINES. TUESDAY Feb 4
Chomsky Normal Form and TURING MACHINES TUESDAY Feb 4 CHOMSKY NORMAL FORM A context-free grammar is in Chomsky normal form if every rule is of the form: A BC A a S ε B and C aren t start variables a is
More informationTAFL 1 (ECS-403) Unit- III. 3.1 Definition of CFG (Context Free Grammar) and problems. 3.2 Derivation. 3.3 Ambiguity in Grammar
TAFL 1 (ECS-403) Unit- III 3.1 Definition of CFG (Context Free Grammar) and problems 3.2 Derivation 3.3 Ambiguity in Grammar 3.3.1 Inherent Ambiguity 3.3.2 Ambiguous to Unambiguous CFG 3.4 Simplification
More informationSolution Scoring: SD Reg exp.: a(a
MA/CSSE 474 Exam 3 Winter 2013-14 Name Solution_with explanations Section: 02(3 rd ) 03(4 th ) 1. (28 points) For each of the following statements, circle T or F to indicate whether it is True or False.
More informationFinite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018
Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Lecture 15 Ana Bove May 17th 2018 Recap: Context-free Languages Chomsky hierarchy: Regular languages are also context-free; Pumping lemma
More informationComputability Theory
CS:4330 Theory of Computation Spring 2018 Computability Theory Decidable Problems of CFLs and beyond Haniel Barbosa Readings for this lecture Chapter 4 of [Sipser 1996], 3rd edition. Section 4.1. Decidable
More informationContext-Free Languages (Pre Lecture)
Context-Free Languages (Pre Lecture) Dr. Neil T. Dantam CSCI-561, Colorado School of Mines Fall 2017 Dantam (Mines CSCI-561) Context-Free Languages (Pre Lecture) Fall 2017 1 / 34 Outline Pumping Lemma
More information