10. The GNFA method is used to show that

Size: px
Start display at page:

Download "10. The GNFA method is used to show that"

Transcription

1 CSE 355 Midterm Examination 27 February 27 Last Name Sample ASU ID First Name(s) Ima Exam # Sample Regrading of Midterms If you believe that your grade has not been recorded correctly, return the entire paper to the instructor with a short note indicating what you believe to be the error. Other than for that reason, test grades are almost never changed. If you believe that you did not receive the proper credit, first read these sample solutions carefully to see if you can understand the answer to your concern. If that does not resolve it, write a clear explanation of why you believe the grade is in error and submit that, along with the entire test paper, to the instructor. Please do not discuss in your explanation how your solution is like that of another student, as FERPA legislation makes it impossible for me to discuss one student s work with another. Please take into account that more than 35 papers were graded, and it is quite unfair to change the grade on one paper without giving every other student the same opportunity. If you nevertheless want the paper regraded, be advised that the entire paper will be regraded and the grade may go up, stay the same, or go down. The new grade will be final. It is a violation of the Academic Integrity Policy to request a grade change simply because you need or want a higher grade. If you require a clarification of the sample solutions (not a grade change or review as discussed above), ask in recitations, or in office hours of the TA or instructor. You will be asked whether you have read the sample solution and to indicate what precisely is unclear to you about it, so read these sample solutions carefully first. Note that under no circumstances can anyone change a grade other than the instructor, so do not ask the TAs to do so they are not able to. Grade review requests, whether submitted as described above or not, will not be considered if received after 28 March 27. Instructions. You must write the exam paper that has your name and student number preprinted on it. You must not move to a different seat. 2. Do not open the exam until you are instructed to do so. 3. The exam consists of (a) this cover sheet giving instructions and space for rough work not to be graded; (b) three pieces of paper, printed two-sided, containing five long answer questions (and space to write answers) and space for rough work; (c) three sheets of paper, printed two-sided, containing 4 multiple choice questions; and (d) a Scantron sheet to be completed using the pencil provided giving your answers to the multiple choice questions. You must turn in all sheets including the multiple choice questions. 4. You have minutes to complete the exam. 5. No books, notes, electronic devices, or other aids are permitted. Turn off all wireless devices and place them away from your work space. 6. Write all answers on the examination paper itself. Work on pages indicated rough work only is not graded. 7. BUDGET YOUR TIME WELL! 8. SHOW ALL WORK! Multiple Choice [4 marks in total] Select the most appropriate answer for each, and enter each response (one of a, b, c, d, e) on the Scantron sheet provided using the pencil provided.. If DFA M = (Q, Σ, δ, q, F ) accepts input string w Σ with w = n, a computation of M on w (a) is a sequence of exactly n states (b) is a sequence of exactly n + states (c) may be a sequence of any positive integer number of states

2 Page 2 Sample, Ima () (d) may be a sequence of any integer number of states that is at least n + (e) may be a sequence of any integer number of states that is at least Q 2. If NFA M = (Q, Σ, δ, q, F ) accepts input string w Σ with w = n, a computation of M on w (a) is a sequence of exactly n states (b) is a sequence of exactly n + states (c) may be a sequence of any positive integer number of states (d) may be a sequence of any integer number of states that is at least n + (e) may be a sequence of any integer number of states that is at least Q 3. The powerset method (a) constructs a regular expression from an NFA (b) is not used in polite company. (c) constructs a DFA from a regular expression (d) constructs a DFA for the intersection of two regular languages (e) constructs a DFA from an NFA 4. On input string w Σ, the number of computations of an NFA (Q, Σ, δ, q, F ) is always (a) at least if the NFA accepts w (b) a (finite) nonnegative integer (c) a (finite) positive integer (d) equal to if the NFA accepts w (e) an integer between and Q 5. The pumping lemma for regular languages can be proved by (a) showing that an NFA can be converted to an equivalent DFA. (b) showing that the regular languages are closed under the regular operations. (c) showing that regular languages are context-free and using the pumping lemma for context-free languages. (d) showing that an NFA computation must repeat a state. (e) showing that a DFA computation must repeat a state. 6. To show that a language is not regular, one could (a) show that it has no regular expression. (b) use the pumping lemma for regular languages. (c) use closure properties. (d) find it using Google. (e) (b) or (c) 7. The pumping lemma for regular languages implies that (a) every regular language contains a string that can be pumped (b) all strings in a regular language can be written as uvw so that uv i w is also in the language when i (c) a regular language is infinite if and only if it contains a string that can be pumped (d) regular languages are closed under the regular operations (e) every string can be pumped in at most one way 8. A generalized NFA, or GNFA, (a) can have transitions labelled with or (b) can have more than one start state (c) is a generalized new fangled apparatus (d) can have more than one final state (e) (b) or (d) 9. To rip a state q rip in the GNFA method, when there is a transition from q to q rip labeled A, a transition from q rip to q rip labeled B, a transition from q rip to q labeled C, and a transition from q to q labeled D, we make a transition from q to q labeled (a) (ABC) D (b) ABC D (c) (A(B) C) D (d) D (AC) (e) A B C D. The GNFA method is used to show that

3 Page 3 Sample, Ima () (a) A language is regular if and only if it is described by a regular expression (b) Regular languages are closed under star. (c) Every regular language is described by a regular expression. (d) Every regular expression describes a regular language. (e) NFAs are no more powerful than DFAs.. Which of these does not imply that L is regular? (a) L is closed under the regular operations: i.e, L = LL = L L = L. (b) L is the language of a regular grammar (c) L is finite (d) L is recognized by a DFA (e) the reversal of L is recognized by an NFA 2. The majority A of three languages L, L 2, and L 3 is a language consisting of all strings that are in at least two of the three. Suppose that L, L 2, and L 3 are regular. (a) A is regular because we can run DFAs for L, L 2, and L 3 to recognize A (b) A is regular because we could construct a DFA using the product construction (c) A may not be regular because we need to read the input three times (d) A is regular because A = (L L 2 ) L 3, by closure under union and intersection (e) A may not be regular because it cannot be expressed using unions and intersections. 3. For an NFA M = (Q, Σ, δ, q, F ) and a subset S Q, which of the following is not always true about the ε closure E(S)? (a) E(S) = q S E({q}) (b) there is no ε transition from a state in E(S) to a state not in E(S) (c) there is no ε transition from a state not in E(S) to a state in E(S) (d) S E(S) (e) Given M and S one can calculate E(S) in finite time. 4. {a n b m : n > m } is (a) not regular because a p+ b p cannot be pumped (b) regular because it is a subset of a b (c) not regular because a p b p cannot be pumped (d) regular because it is described by a regular expression (e) not regular because you cannot remember n 5. {(ab) n : n } is (a) not regular because you cannot remember n (b) regular because each string can be pumped (c) regular because it is a b (d) regular because it is (ab) (e) not regular because a p b p cannot be pumped 6. Let L be the regular language () and L = {() n m m : n, m }. Then L L is (a) regular by closure under union (b) not regular because it contains m m (c) regular because you can always pump by setting v to be the leading or (d) not regular because L is not regular, because p p cannot be pumped in L (e) regular because it is described by a regular expression 7. A regular expression describes a language that always (a) is finite when the regular expression contains no (b) is infinite when the regular expression does contain a (c) contains no string with fewer characters than appear in the regular expression (d) may not satisfy the conditions of the pumping lemma (e) is the closure of a regular language under 8. For a DFA (Q, Σ, δ, q, F ), what is the meaning of the statement c = δ(b, a)? (a) It has no meaning, it is just some symbols. (b) When reading an a in state b, the next state is c. (c) b and a are states of the machine. (d) c is a final state when reading an a. (e) When reading a b, and the next character is a, the next state is c.

4 Page 4 Sample, Ima () 9. Which of the following statements is always false about a DFA (Q, Σ, δ, q, F )? (a) q F. (b) Q is a proper subset of F. (c) q loops on some symbol in Σ. (d) Q contains fewer than 355 states. (e) The size of the alphabet is strictly more than the number of states. 2. Given a DFA D = (Q, Σ, δ, q, F ) that accepts every string, what can we infer about D? (a) Every state in D is a final state. (b) There is at least one state in D that is not final. (c) Every reachable state from q in D is a final state. (d) There is only one character in the alphabet. (e) There is at least one final state in D that is not q. 2. Let L be a regular language. How many DFAs have language L? (a) Exactly. (b) Exactly. (c) At most 2. (d) Finitely many. (e) Infinitely many. 22. Which of the following is always true about a given DFA D = (Q, Σ, δ, q, F )? (a) If q / F, D s language contains the empty string. (b) If D does not accept some string w, and the resulting state after the computation is q s q, then if we modify the machine so that q s is the start state and feed w as input, this modified machine accepts w. (c) If there is a transition from a final state to a non-final state, D s language is infinite. (d) If δ(q, ) = q, δ(q, ) = q, and q F, D accepts every string consisting of s with even length. (e) If D has only one final state, D only accepts a finite number of strings. 23. If languages L, L 2 are non-regular languages with alphabet Σ, which of the following is not always true? (a) L, L 2 contain infinitely many strings. (b) L, L 2 Σ. (c) L is not regular. (d) L L is regular. (e) All of the above are always true. 24. Suppose that I have two DFAs and have 5 and 4 states respectively, and 2 and 3 final states respectively. The number of final states in the product DFA for the union of their languages is (a) 2. (b) 7. (c) 6. (d) 5. (e) fewer than Suppose that I have two DFAs and have 5 and 4 states respectively, and 2 and 3 final states respectively. The number of states in the product DFA for the intersection of their languages is (a) at least 2, but can be more. (b) 2. (c) 6. (d) 3. (e) Suppose I have two DFAs D, D 2 and I perform the product construction on them to get a DFA for the union of their languages. What is always true about the resulting DFA D? (a) The number of states in D is equal to the maximum of the number of states in both of D, D 2. (b) If L(D ) = L(D 2 ), then D has every state being final. (c) If L(D ) = L(D 2 ), then D has every state being final. (d) If L(D ) =, then L(D) = L(D 2 ). (e) If L(D ) = Σ, then L(D) = L(D 2 ).

5 27. Given an NFA with Page 5 Sample, Ima () δ(q, ) = {q } δ(q, a) = {q 2 } δ(q, ) = {q } δ(q 2, ) = {q 3 } δ(q 3, a) = {q } δ(q 3, ) = {q 4 } what is E({q, q 2 })? (a) (b) {q, q, q 2 } (c) {q, q 2 } (d) {q 3 } (e) None of the above. 28. A multi-start NFA (MSNFA) is defined like a standard NFA, except that more than one start state is allowed, and we can choose any of them when starting a computation. What can we conclude about the languages that MSNFAs recognize? (a) The languages recognized by MSNFAs are exactly the regular languages. (b) The teaching assistants have active imaginations. (c) Some language that an NFA recognizes is not recognized by an MSNFA because MSNFAs may start at the wrong state. (d) Some language that an MSNFA recognizes is not recognized by an NFA because MSNFAs can choose to start at the right state. (e) (c) and (d) 29. Given two NFAs N = (Q, Σ, δ, q,, F ) and N 2 = (Q 2, Σ, δ 2, q,2, F 2 ), my friend wants to produce an NFA for L(N ) L(N 2 ). He uses a variant of the product construction to produce an NFA N = (Q, Σ, δ, q, F ): Q = Q Q 2, q = (q,, q,2 ), F = F F 2, δ((q, q 2 ), a) = {(q, q 2) q δ (q, a), q 2 δ 2 (q 2, a)} for all q Q, q 2 Q 2, a Σ. δ((q, q 2 ), ) = {(q, q 2) q δ (q, ) {q }, q 2 δ (q 2, ) {q 2 })} for all q Q, q 2 Q 2. Is my friend correct in saying that L(N) = L(N ) L(N 2 )? (a) He is not correct because the transition function is for union, not intersection. (b) He is not correct because the transition function only needs to be defined for at least one character a instead of all of them, and we cannot know that in advance because the machine is inherently nondeterministic. (c) He may be correct for some NFAs, and not for others. (d) He is correct because N satisfies the formal definition of an NFA, and therefore its language is regular. (e) He is correct because one can observe computations in the original two machines and see that if one existed for them, then one exists for the new machine (and vice versa). 3. The set of non-regular languages is closed under which of the following operations? (a) Star (b) Complement (c) Union (d) Intersection (e) Concatenation 3. My friend doesn t like the pumping lemma, but still wants to show that L = {w {, } : w is not of the form n n } is non-regular. To do this, he observes that it is the complement of the non-regular language L = { n n : n }, and uses closure under complementation. Is my friend correct? (a) He is correct because anyone who does not like the pumping lemma must be right. (b) He is not correct because L is not the complement of L. (c) He is not correct because non-regular languages are not closed under complement. (d) He is correct because regular languages are closed under complement.

6 Page 6 Sample, Ima () (e) He is correct because any DFA to recognize L would have to count and check that the number of s and s are different. 32. What is the meaning of a grammar being ambiguous? (a) Some string in the grammar s language has at least two different derivations. (b) All strings in the grammar s language have at least two different parse trees. (c) All strings in the grammar s language have at least two different derivations. (d) Some string in the grammar s language has at least two different parse trees. (e) The grammar is not in CNF. 33. Suppose I have a CFG (not necessarily in CNF) and a string of length 5 in its language. What can I tell about a derivation of this string in the grammar? (a) The derivation involves exactly applications of rules to derive this string. (b) The derivation involves exactly 9 applications of rules to derive this string. (c) The derivation involves at least 5 applications of rules to derive this string, but can be arbitrarily large. (d) The derivation involves some number of applications of rules to derive this string, but is at most 32. (e) None of the above is true. 34. Suppose I have a CFG in CNF and a string of length 5 in its language. What can I tell about a derivation of this string in the grammar? (a) The derivation involves exactly applications of rules to derive this string. (b) The derivation involves exactly 9 applications of rules to derive this string. (c) The derivation involves at least 5 applications of rules to derive this string, but can be arbitrarily large. (d) The derivation involves some number of applications of rules to derive this string, but is at most 32. (e) None of the above is true. 35. DeMorgan s Laws ensure that (a) Closure under intersection and complementation imply closure under union. (b) Union members who meet at an intersection are sent to jail. (c) Closure under intersection and union imply closure under complementation. (d) Closure under union and complementation imply closure under reversal. (e) Closure under any two of union, intersection, and complementation implies closure under all three. 36. The regular operations are (a) star, union, and complementation. (b) star, union, and concatenation. (c) star, union, concatenation, and complementation. (d) union, intersection, and complementation. (e) union, concatenation, and complementation. 37. To show that a language is regular, one could give a DFA for it. One could also (a) give a regular expression. (b) use the pumping lemma for regular languages. (c) use closure properties. (d) (a) or (c) (e) (a), (b), or (c) 38. Which of the following is false? (a) Languages are defined to have a finite number of strings. (b) Regular grammars generate regular languages. (c) Languages are defined over finite alphabets (d) Strings are defined to have finite length (e) NFAs can have any positive integer number of states. 39. My friend thinks that the conversion of CFGs into CNF is done as follows (in order): () Make the start variable not appear on the RHS of any rule, (2) Delete nullable variables, (3) Remove unit rules, (4) Make RHSs consist of either only one terminal or more than one variable, and (5) Break up long RHSs. Which step is not correct?

7 Page 7 Sample, Ima () (a) Step is not correct. (b) Step 2 is not correct. (c) Step 3 is not correct. (d) Step 4 is not correct. (e) Step 5 is not correct. 4. Which of the following statements is correct about the language { i i+j 2 j : i, j }? (a) It is regular, but not context-free. (b) It is regular, and context-free. (c) It is not regular, but is context-free. (d) It is not regular, and not context-free. (e) None of the above. Question. [ marks] In the space provided, give an example of a language L for each of the following if one exists, otherwise check the No column: Requirement Example No L is finite but not empty {a} L = L L is regular and infinite a L is finite but not regular L is infinite but not regular palindromes LL = L and L is regular a LL = L and L is not regular balanced parentheses L is regular but not context-free L is context-free but not regular palindromes L is regular, and is the union of two CFLs {a} {b} Question 2. [ marks] In the space provided, give a BRIEF justification for each statement given. The Statement The Space Provided Regular languages are closed DFA: Swap final and non-final states. under complement. Regular languages are closed Regular grammar: New start S and new rules S S S 2 under union. where S, S 2 old start variables of two regular grammars. DFA: Use product construction. NFA: New start state, ε-transitions to old start stes of two DFA/NFAs. Regex: (R R 2 ) is a regex for union of two regexes. Context-free languages are closed CFG: New start S and new rules S S S 2 under union. where S, S 2 old start variables of two CFGs. Regular languages are closed NFA: ε-transitions from final states of one DFA/NFA to another. under concatenation. Regex: (R R 2 ) is a regex for concatenation of two regexes. Regular grammar: New start S and new rule S S S 2. Regular languages are closed Regular grammar: reverse RHS of each rule (see Question 4.) under reversal. DFA/NFA: reverse all transitions, make old start final, add new start with ε-transitions to all old final states (no longer final) Question 3. [ marks] Let L {a, b} be the language of all strings that contain more substrings equal to abb than to aba. State whether or not L is regular, and show that your answer is correct. All points are for the explanation. This language is NOT {(abb) m (aba) n : m > n}. It is much larger than that. And it definitely is not {abb m aba n : m > n}! We prove that L is not regular. Assume to the contrary that L is regular and let p be its pumping length. Now we choose a string w L with w p and try to pump it. If w starts with a b, it can always be pumped by choosing x = ε and y = b. Otherwise if w starts with aa, it can always be pumped by choosing

8 Page 8 Sample, Ima () x = ε and y = a. Otherwise if w starts with aba, it can always be pumped by choosing x = ε and y = a. So it had better start with abb if this is going to work. Indeed if it has an aba in the first p characters, just pump one of the as and you never leave L. Choose w = (abb) p (aba) p. Writing w = xyz with xy p and y, we find that y must be a nonempty string in the language (ε b bb)(abb) (ε a ab). Almost everyone just did the case when y is a nonempty string in (abb). If y is in the language (ε b bb)(abb) + (ε a ab), then xy z loses at least one abb substrings but cannot lose any aba substrings, so it is not in L, a contradiction in this case. It remains to treat cases when y is not empty and is in (ε b bb)(ε a ab). Now if y starts with a b then again xy z loses at least one abb substrings but cannot lose any aba substrings, so it is not in L, a contradiction. So all that remains is y {a, ab} because it is not empty. Once again, xy z loses at least one abb substrings but cannot lose any aba substrings, so it is not in L, a contradiction. This is all of the cases and every one leads to a contradiction, so w cannot be pumped, and L is not regular. An alternate approach. Suppose to the contrary that L is regular. Then by closure under intersection so is L = L (abb) (aba). Now do pumping for L, and when y (abb) you leave the language L right away, making the cases easier. Question 4. [5 marks] In this question DO NOT USE the equivalences among NFAs, DFAs, regular expressions, and regular grammars, or closure properties, without proving them. My friend has gotten all mixed up about regular grammars. He thinks that their definition says that they can have rules of the form A ε, A a, A B, and A Ba where A and B are variables and a is a terminal. But he has made a mistake! In a regular grammar, the fourth should be A ab instead. So let s call our friend s grammar raluger to keep them straight. So we have Rule Types Allowed Regular Raluger A ε A ε A a A a A B A B A ab A Ba We want to help our friend by showing that a language has a regular grammar if and only if it has a raluger grammar. We are going to do this in four steps. (a) [4 marks] Suppose that L has a regular grammar. Show that L has an NFA. NOTE 4.: The rule types given are not the rules of a specific grammar to be converted! Students who used the set of the four types of regular grammar rules (in the above left column) as a particular four-rule grammar G with L(G) = L were awarded only mark. You were asked to build an NFA for a general regular grammar! Suppose that L has a regular grammar G = (V, Σ, R, S). Then we build an equivalent NFA N as follows. N = (Q, Σ, δ, q, F ), where:. Q = V {D} (where D V ) 2. The alphabet of N is the set of terminals of G. 3. q = S. 4. F = {D} 5. The four regular grammar rule types, depending on how they appear in G, determine the behavior of δ. For all a Σ and A V, δ(a, a) = {B V : A ab R}. For all A V, δ(a, ε) = {B V : A B R}. For all A V and all a Σ such that A a R, δ(a, a) = {D}. Finally, for all A V satisfying A ε R, we have that δ(a, ε) = {D}. (b) [4 marks] Suppose that L has a raluger grammar. Show that L has an NFA. NOTE 4.2: The rule types given are not the rules of a specific grammar to be converted! Students who used the set of the four types of raluger grammar rules (in the above right column) as a particular four-rule

9 Page 9 Sample, Ima () grammar G with L(G) = L were awarded only mark. You were asked to build an NFA for a general raluger grammar! Suppose that L has a raluger grammar G = (V, Σ, R, S). Then we build an equivalent NFA N as follows. N = (Q, Σ, δ, q, F ), where:. Q = V {q } (where q V ) 2. The alphabet of N is the set of terminals of G. 3. The start state q is not in V. 4. F = {S}. 5. The four raluger grammar rule types, depending on how they appear in G, determine the behavior of δ. First, we have that δ(q, ε) = {A V : A ε R}. Next, we have that for all a Σ, δ(q, a) = {A V : A a R}. For all B V, δ(b, ε) = {A V : A B R}. Finally, for all a Σ and B V, we have δ(b, a) = {A V : A Ba R}. (c) [4 marks] Suppose that L has an NFA. Show that L has a regular grammar. Note 4.3: Students who mistook the set of the four types of regular grammar rules (in the above left column) for a particular grammar G with L = L(G) and then defined an NFA for this grammar and then just repeated the rules of G (or some variation thereof) as their solution were awarded only one point. L is just any language that is recognized by some NFA! Proof idea: The grammar we propose is such that its derivation of any terminal string just encodes the computation of the equivalent NFA on that terminal string, from the start state to the final state. Let s suppose the NFA for L is N = (Q, Σ, δ, q, F ). Make a variable V i for each state q i of the NFA. Add the rule V i av j to the grammar if q j δ(q i, a), where a Σ. Add the rule V i V j to the grammar if q j δ(q i, ε). Add the rule V i ε if q i is an accept state of N. Make V the start variable of the grammar, where q is the start state of N. (d) [3 marks] Suppose that L has an NFA. Show that L has a raluger grammar. Note 4.4: Students who mistook the set of the four types of raluger grammar rules (in the above right column) for a particular grammar G with L = L(G) and then defined an NFA for this grammar and then just repeated the rules of G (or some variation thereof) as their solution were awarded only one point. L is just any language that is recognized by some NFA! Proof idea: The grammar we propose in this solution is such that any string generated by it has a derivation that essentially backtracks the NFA computation on that string, from the final state all the way back to the start state. Remember that an NFA computation of a string is just the sequence of states (start-to-final) through which the machine is driven to accept its input. Denote the NFA for L by N = (Q, Σ, δ, Q, F ). For simplicity, let s suppose that the states of Q are capital subscripted letters; i.e., Q = {Q, Q, Q 2,..., Q n } (these states will be variables in our grammar, and by convention we capitalize the variables of a grammar). For N we create an equivalent grammar G = (V, Σ, R, S), where V = Q {S}, the terminals of G are the alphabet characters for N, and R is constructed out of δ as follows. For any Q i, Q j Q, add the rule Q i Q j a to the grammar if Q i δ(q j, a), where a Σ. Add the rule Q i Q j provided Q i δ(q j, ε). For each final state Q f F, add the rule S Q f. Finally, for the start state Q, add the rule Q ε.

10 Page Sample, Ima () Question 5. [5 marks] (a) [7 marks] Using the method from class, produce an NFA for the regular expression (( )). Do not simplify. (Give a transition diagram, and a brief explanation of your method.) q 4 q 6 q q q 2 q 3 q 5 q 7 Explanation: for union, we create a new state that has an -transition to the old start states; for concatenation, we add an -transition from the originally final states of the first NFA to the start state of the second NFA, and for star we add a new final start state, and all final states (other than the new start one) have an -transition to this new start state. Common mistakes include: () not giving an explanation of the method, (2) not following the method, and (3) missing some transitions or states. (b) [8 marks] Using the powerset method from class, produce a DFA for the NFA from the (a) part. Do not simplify the NFA first. (Give a transition diagram, and a brief explanation of your method.), q, q 2,3,4,5 q,,6 q,,7 Explanation: we use the build states as needed construction as described in class, by using -closure not only to find the start state of the converted DFA, but where each transition will go for each of the computed states in this DFA. Common mistakes include: () not giving an explanation of the method, (2) not following the method, and (3) missing some transitions or states. Do not pass Go. Do not collect $2

CSE 355 Test 2, Fall 2016

CSE 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 information

Name: Student ID: Instructions:

Name: Student ID: Instructions: Instructions: Name: CSE 322 Autumn 2001: Midterm Exam (closed book, closed notes except for 1-page summary) Total: 100 points, 5 questions, 20 points each. Time: 50 minutes 1. Write your name and student

More information

ECS 120: Theory of Computation UC Davis Phillip Rogaway February 16, Midterm Exam

ECS 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 information

Theory of Computation

Theory 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 information

Theory of Computation (II) Yijia Chen Fudan University

Theory of Computation (II) Yijia Chen Fudan University Theory of Computation (II) Yijia Chen Fudan University Review A language L is a subset of strings over an alphabet Σ. Our goal is to identify those languages that can be recognized by one of the simplest

More information

CSE 105 THEORY OF COMPUTATION

CSE 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 information

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

FORMAL 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 information

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

THEORY 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 information

CPSC 421: Tutorial #1

CPSC 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 information

Closure under the Regular Operations

Closure under the Regular Operations September 7, 2013 Application of NFA Now we use the NFA to show that collection of regular languages is closed under regular operations union, concatenation, and star Earlier we have shown this closure

More information

V Honors Theory of Computation

V 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 information

Harvard 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 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 information

CISC 4090: Theory of Computation Chapter 1 Regular Languages. Section 1.1: Finite Automata. What is a computer? Finite automata

CISC 4090: Theory of Computation Chapter 1 Regular Languages. Section 1.1: Finite Automata. What is a computer? Finite automata CISC 4090: Theory of Computation Chapter Regular Languages Xiaolan Zhang, adapted from slides by Prof. Werschulz Section.: Finite Automata Fordham University Department of Computer and Information Sciences

More information

Automata and Computability. Solutions to Exercises

Automata 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 information

Computational Models - Lecture 3

Computational Models - Lecture 3 Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 1 Computational Models - Lecture 3 Equivalence of regular expressions and regular languages (lukewarm leftover

More information

PS2 - Comments. University of Virginia - cs3102: Theory of Computation Spring 2010

PS2 - Comments. University of Virginia - cs3102: Theory of Computation Spring 2010 University of Virginia - cs3102: Theory of Computation Spring 2010 PS2 - Comments Average: 77.4 (full credit for each question is 100 points) Distribution (of 54 submissions): 90, 12; 80 89, 11; 70-79,

More information

Theory Bridge Exam Example Questions

Theory 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 information

Automata and Computability. Solutions to Exercises

Automata 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 information

CS 301. Lecture 18 Decidable languages. Stephen Checkoway. April 2, 2018

CS 301. Lecture 18 Decidable languages. Stephen Checkoway. April 2, 2018 CS 301 Lecture 18 Decidable languages Stephen Checkoway April 2, 2018 1 / 26 Decidable language Recall, a language A is decidable if there is some TM M that 1 recognizes A (i.e., L(M) = A), and 2 halts

More information

2.1 Solution. E T F a. E E + T T + T F + T a + T a + F a + a

2.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 information

What we have done so far

What we have done so far What we have done so far DFAs and regular languages NFAs and their equivalence to DFAs Regular expressions. Regular expressions capture exactly regular languages: Construct a NFA from a regular expression.

More information

Lecture 17: Language Recognition

Lecture 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 information

Automata: a short introduction

Automata: 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 information

Computational Models: Class 3

Computational Models: Class 3 Computational Models: Class 3 Benny Chor School of Computer Science Tel Aviv University November 2, 2015 Based on slides by Maurice Herlihy, Brown University, and modifications by Iftach Haitner and Yishay

More information

CMPSCI 250: Introduction to Computation. Lecture #22: From λ-nfa s to NFA s to DFA s David Mix Barrington 22 April 2013

CMPSCI 250: Introduction to Computation. Lecture #22: From λ-nfa s to NFA s to DFA s David Mix Barrington 22 April 2013 CMPSCI 250: Introduction to Computation Lecture #22: From λ-nfa s to NFA s to DFA s David Mix Barrington 22 April 2013 λ-nfa s to NFA s to DFA s Reviewing the Three Models and Kleene s Theorem The Subset

More information

CS 154, Lecture 3: DFA NFA, Regular Expressions

CS 154, Lecture 3: DFA NFA, Regular Expressions CS 154, Lecture 3: DFA NFA, Regular Expressions Homework 1 is coming out Deterministic Finite Automata Computation with finite memory Non-Deterministic Finite Automata Computation with finite memory and

More information

I have read and understand all of the instructions below, and I will obey the University Code on Academic Integrity.

I have read and understand all of the instructions below, and I will obey the University Code on Academic Integrity. Midterm Exam CS 341-451: Foundations of Computer Science II Fall 2016, elearning section Prof. Marvin K. Nakayama Print family (or last) name: Print given (or first) name: I have read and understand all

More information

Notes for Comp 497 (Comp 454) Week 10 4/5/05

Notes 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 information

CPS 220 Theory of Computation

CPS 220 Theory of Computation CPS 22 Theory of Computation Review - Regular Languages RL - a simple class of languages that can be represented in two ways: 1 Machine description: Finite Automata are machines with a finite number of

More information

Computational Theory

Computational 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 information

Non-context-Free Languages. CS215, Lecture 5 c

Non-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 information

Computer Sciences Department

Computer Sciences Department 1 Reference Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER 3 objectives Finite automaton Infinite automaton Formal definition State diagram Regular and Non-regular

More information

The Pumping Lemma for Context Free Grammars

The Pumping Lemma for Context Free Grammars The Pumping Lemma for Context Free Grammars Chomsky Normal Form Chomsky Normal Form (CNF) is a simple and useful form of a CFG Every rule of a CNF grammar is in the form A BC A a Where a is any terminal

More information

CISC4090: Theory of Computation

CISC4090: 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 information

TDDD65 Introduction to the Theory of Computation

TDDD65 Introduction to the Theory of Computation TDDD65 Introduction to the Theory of Computation Lecture 2 Gustav Nordh, IDA gustav.nordh@liu.se 2012-08-31 Outline - Lecture 2 Closure properties of regular languages Regular expressions Equivalence of

More information

Exam 1 CSU 390 Theory of Computation Fall 2007

Exam 1 CSU 390 Theory of Computation Fall 2007 Exam 1 CSU 390 Theory of Computation Fall 2007 Solutions Problem 1 [10 points] Construct a state transition diagram for a DFA that recognizes the following language over the alphabet Σ = {a, b}: L 1 =

More information

Lecture 3: Nondeterministic Finite Automata

Lecture 3: Nondeterministic Finite Automata Lecture 3: Nondeterministic Finite Automata September 5, 206 CS 00 Theory of Computation As a recap of last lecture, recall that a deterministic finite automaton (DFA) consists of (Q, Σ, δ, q 0, F ) where

More information

Notes for Comp 497 (454) Week 10

Notes 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 information

Please give details of your calculation. A direct answer without explanation is not counted.

Please give details of your calculation. A direct answer without explanation is not counted. Please give details of your calculation. 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

More information

Before we show how languages can be proven not regular, first, how would we show a language is regular?

Before we show how languages can be proven not regular, first, how would we show a language is regular? CS35 Proving Languages not to be Regular Before we show how languages can be proven not regular, first, how would we show a language is regular? Although regular languages and automata are quite powerful

More information

Computational Models - Lecture 4

Computational 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 information

CSE 105 Theory of Computation Professor Jeanne Ferrante

CSE 105 Theory of Computation   Professor Jeanne Ferrante CSE 105 Theory of Computation http://www.jflap.org/jflaptmp/ Professor Jeanne Ferrante 1 Announcement & Reminders HW 2: Grades not available yet, will be soon Solutions posted, read even if you did well

More information

CSE 355 Homework One Sample Solutions

CSE 355 Homework One Sample Solutions CSE 355 Homework One Sample Solutions Question Give a transition diagram and the transition table, for a DFA to recognize. Part (a) {w {, } : w contains an even number of s and an odd number of s} Solution:

More information

Context-Free Languages (Pre Lecture)

Context-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

Properties of Context-Free Languages

Properties 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 information

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Finite 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 information

Lecture Notes On THEORY OF COMPUTATION MODULE -1 UNIT - 2

Lecture Notes On THEORY OF COMPUTATION MODULE -1 UNIT - 2 BIJU PATNAIK UNIVERSITY OF TECHNOLOGY, ODISHA Lecture Notes On THEORY OF COMPUTATION MODULE -1 UNIT - 2 Prepared by, Dr. Subhendu Kumar Rath, BPUT, Odisha. UNIT 2 Structure NON-DETERMINISTIC FINITE AUTOMATA

More information

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION "Winter" 2018 http://cseweb.ucsd.edu/classes/wi18/cse105-ab/ Today's learning goals Sipser Section 1.4 Explain the limits of the class of regular languages Justify why the

More information

Pushdown 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 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 information

CSci 311, Models of Computation Chapter 4 Properties of Regular Languages

CSci 311, Models of Computation Chapter 4 Properties of Regular Languages CSci 311, Models of Computation Chapter 4 Properties of Regular Languages H. Conrad Cunningham 29 December 2015 Contents Introduction................................. 1 4.1 Closure Properties of Regular

More information

1. Induction on Strings

1. Induction on Strings CS/ECE 374: Algorithms & Models of Computation Version: 1.0 Fall 2017 This is a core dump of potential questions for Midterm 1. This should give you a good idea of the types of questions that we will ask

More information

Please 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. 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 information

Midterm Exam 2 CS 341: Foundations of Computer Science II Fall 2018, face-to-face day section Prof. Marvin K. Nakayama

Midterm Exam 2 CS 341: Foundations of Computer Science II Fall 2018, face-to-face day section Prof. Marvin K. Nakayama Midterm Exam 2 CS 341: Foundations of Computer Science II Fall 2018, face-to-face day section Prof. Marvin K. Nakayama Print family (or last) name: Print given (or first) name: I have read and understand

More information

Decidability (What, stuff is unsolvable?)

Decidability (What, stuff is unsolvable?) University of Georgia Fall 2014 Outline Decidability Decidable Problems for Regular Languages Decidable Problems for Context Free Languages The Halting Problem Countable and Uncountable Sets Diagonalization

More information

Formal Languages, Automata and Models of Computation

Formal 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 information

September 11, Second Part of Regular Expressions Equivalence with Finite Aut

September 11, Second Part of Regular Expressions Equivalence with Finite Aut Second Part of Regular Expressions Equivalence with Finite Automata September 11, 2013 Lemma 1.60 If a language is regular then it is specified by a regular expression Proof idea: For a given regular language

More information

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY 5-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY NON-DETERMINISM and REGULAR OPERATIONS THURSDAY JAN 6 UNION THEOREM The union of two regular languages is also a regular language Regular Languages Are

More information

Before 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. 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 information

False. They are the same language.

False. They are the same language. CS 3100 Models of Computation Fall 2010 Notes 8, Posted online: September 16, 2010 These problems will be helpful for Midterm-1. More solutions will be worked out. The midterm exam itself won t be this

More information

Part 4 out of 5 DFA NFA REX. Automata & languages. A primer on the Theory of Computation. Last week, we showed the equivalence of DFA, NFA and REX

Part 4 out of 5 DFA NFA REX. Automata & languages. A primer on the Theory of Computation. Last week, we showed the equivalence of DFA, NFA and REX Automata & languages A primer on the Theory of Computation Laurent Vanbever www.vanbever.eu Part 4 out of 5 ETH Zürich (D-ITET) October, 12 2017 Last week, we showed the equivalence of DFA, NFA and REX

More information

Computational Models Lecture 2 1

Computational Models Lecture 2 1 Computational Models Lecture 2 1 Handout Mode Ronitt Rubinfeld and Iftach Haitner. Tel Aviv University. March 16/18, 2015 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice

More information

Comment: The induction is always on some parameter, and the basis case is always an integer or set of integers.

Comment: The induction is always on some parameter, and the basis case is always an integer or set of integers. 1. For each of the following statements indicate whether it is true or false. For the false ones (if any), provide a counter example. For the true ones (if any) give a proof outline. (a) Union of two non-regular

More information

CS 154. Finite Automata vs Regular Expressions, Non-Regular Languages

CS 154. Finite Automata vs Regular Expressions, Non-Regular Languages CS 154 Finite Automata vs Regular Expressions, Non-Regular Languages Deterministic Finite Automata Computation with finite memory Non-Deterministic Finite Automata Computation with finite memory and guessing

More information

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY 15-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY THE PUMPING LEMMA FOR REGULAR LANGUAGES and REGULAR EXPRESSIONS TUESDAY Jan 21 WHICH OF THESE ARE REGULAR? B = {0 n 1 n n 0} C = { w w has equal number

More information

Closure Properties of Context-Free Languages. Foundations of Computer Science Theory

Closure 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 information

AC68 FINITE AUTOMATA & FORMULA LANGUAGES DEC 2013

AC68 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 information

Solution Scoring: SD Reg exp.: a(a

Solution 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 information

Finite Automata and Regular languages

Finite Automata and Regular languages Finite Automata and Regular languages Huan Long Shanghai Jiao Tong University Acknowledgements Part of the slides comes from a similar course in Fudan University given by Prof. Yijia Chen. http://basics.sjtu.edu.cn/

More information

Closure Properties of Regular Languages. Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism, Inverse Homomorphism

Closure Properties of Regular Languages. Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism, Inverse Homomorphism Closure Properties of Regular Languages Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism, Inverse Homomorphism Closure Properties Recall a closure property is a statement

More information

Computability Theory

Computability 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 information

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION Spring 2017 http://cseweb.ucsd.edu/classes/sp17/cse105-ab/ Today's learning goals Sipser Ch 1.4 Explain the limits of the class of regular languages Justify why the Pumping

More information

Properties of Context-Free Languages. Closure Properties Decision Properties

Properties 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 information

Lecture 4: More on Regexps, Non-Regular Languages

Lecture 4: More on Regexps, Non-Regular Languages 6.045 Lecture 4: More on Regexps, Non-Regular Languages 6.045 Announcements: - Pset 1 is on piazza (as of last night) - If you don t have piazza access but are registered for 6.045, send email to TAs with

More information

CS 154. Finite Automata, Nondeterminism, Regular Expressions

CS 154. Finite Automata, Nondeterminism, Regular Expressions CS 54 Finite Automata, Nondeterminism, Regular Expressions Read string left to right The DFA accepts a string if the process ends in a double circle A DFA is a 5-tuple M = (Q, Σ, δ, q, F) Q is the set

More information

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class

CSE 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 information

Final exam study sheet for CS3719 Turing machines and decidability.

Final 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 information

Note: In any grammar here, the meaning and usage of P (productions) is equivalent to R (rules).

Note: In any grammar here, the meaning and usage of P (productions) is equivalent to R (rules). Note: In any grammar here, the meaning and usage of P (productions) is equivalent to R (rules). 1a) G = ({R, S, T}, {0,1}, P, S) where P is: S R0R R R0R1R R1R0R T T 0T ε (S generates the first 0. R generates

More information

3130CIT Theory of Computation

3130CIT Theory of Computation GRIFFITH UNIVERSITY School of Computing and Information Technology 3130CIT Theory of Computation Final Examination, Semester 2, 2006 Details Total marks: 120 (40% of the total marks for this subject) Perusal:

More information

Unit 6. Non Regular Languages The Pumping Lemma. Reading: Sipser, chapter 1

Unit 6. Non Regular Languages The Pumping Lemma. Reading: Sipser, chapter 1 Unit 6 Non Regular Languages The Pumping Lemma Reading: Sipser, chapter 1 1 Are all languages regular? No! Most of the languages are not regular! Why? A finite automaton has limited memory. How can we

More information

CpSc 421 Final Exam December 15, 2006

CpSc 421 Final Exam December 15, 2006 CpSc 421 Final Exam December 15, 2006 Do problem zero and six of problems 1 through 9. If you write down solutions for more that six problems, clearly indicate those that you want graded. Note that problems

More information

CS154 Final Examination

CS154 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 information

CMSC 330: Organization of Programming Languages. Theory of Regular Expressions Finite Automata

CMSC 330: Organization of Programming Languages. Theory of Regular Expressions Finite Automata : Organization of Programming Languages Theory of Regular Expressions Finite Automata Previous Course Review {s s defined} means the set of string s such that s is chosen or defined as given s A means

More information

More Properties of Regular Languages

More Properties of Regular Languages More Properties of Regular anguages 1 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse 2 Namely, for regular languages 1 and 2 : Union 1 2 Concatenation Star

More information

Nondeterministic finite automata

Nondeterministic finite automata Lecture 3 Nondeterministic finite automata This lecture is focused on the nondeterministic finite automata (NFA) model and its relationship to the DFA model. Nondeterminism is an important concept in the

More information

Computational Models Lecture 2 1

Computational Models Lecture 2 1 Computational Models Lecture 2 1 Handout Mode Iftach Haitner. Tel Aviv University. October 30, 2017 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice Herlihy, Brown University.

More information

The View Over The Horizon

The 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 information

CS5371 Theory of Computation. Lecture 7: Automata Theory V (CFG, CFL, CNF)

CS5371 Theory of Computation. Lecture 7: Automata Theory V (CFG, CFL, CNF) CS5371 Theory of Computation Lecture 7: Automata Theory V (CFG, CFL, CNF) Announcement Homework 2 will be given soon (before Tue) Due date: Oct 31 (Tue), before class Midterm: Nov 3, (Fri), first hour

More information

6.1 The Pumping Lemma for CFLs 6.2 Intersections and Complements of CFLs

6.1 The Pumping Lemma for CFLs 6.2 Intersections and Complements of CFLs CSC4510/6510 AUTOMATA 6.1 The Pumping Lemma for CFLs 6.2 Intersections and Complements of CFLs The Pumping Lemma for Context Free Languages One way to prove AnBn is not regular is to use the pumping lemma

More information

Computational Models - Lecture 3 1

Computational Models - Lecture 3 1 Computational Models - Lecture 3 1 Handout Mode Iftach Haitner and Yishay Mansour. Tel Aviv University. March 13/18, 2013 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice

More information

Theory of Computation p.1/?? Theory of Computation p.2/?? Unknown: Implicitly a Boolean variable: true if a word is

Theory of Computation p.1/?? Theory of Computation p.2/?? Unknown: Implicitly a Boolean variable: true if a word is Abstraction of Problems Data: abstracted as a word in a given alphabet. Σ: alphabet, a finite, non-empty set of symbols. Σ : all the words of finite length built up using Σ: Conditions: abstracted as a

More information

Chapter 6. Properties of Regular Languages

Chapter 6. Properties of Regular Languages Chapter 6 Properties of Regular Languages Regular Sets and Languages Claim(1). The family of languages accepted by FSAs consists of precisely the regular sets over a given alphabet. Every regular set is

More information

UNIT II REGULAR LANGUAGES

UNIT II REGULAR LANGUAGES 1 UNIT II REGULAR LANGUAGES Introduction: A regular expression is a way of describing a regular language. The various operations are closure, union and concatenation. We can also find the equivalent regular

More information

CS481F01 Prelim 2 Solutions

CS481F01 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 information

CSE 105 THEORY OF COMPUTATION

CSE 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 1.4 Give an example of a non-regular language Outline two strategies for proving

More information

Context Free Languages. Automata Theory and Formal Grammars: Lecture 6. Languages That Are Not Regular. Non-Regular Languages

Context Free Languages. Automata Theory and Formal Grammars: Lecture 6. Languages That Are Not Regular. Non-Regular Languages Context Free Languages Automata Theory and Formal Grammars: Lecture 6 Context Free Languages Last Time Decision procedures for FAs Minimum-state DFAs Today The Myhill-Nerode Theorem The Pumping Lemma Context-free

More information

CSE 105 THEORY OF COMPUTATION

CSE 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 information

CS 341 Homework 16 Languages that Are and Are Not Context-Free

CS 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 information

Ogden s Lemma for CFLs

Ogden 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 information

Johns Hopkins Math Tournament Proof Round: Automata

Johns Hopkins Math Tournament Proof Round: Automata Johns Hopkins Math Tournament 2018 Proof Round: Automata February 9, 2019 Problem Points Score 1 10 2 5 3 10 4 20 5 20 6 15 7 20 Total 100 Instructions The exam is worth 100 points; each part s point value

More information

NPDA, CFG equivalence

NPDA, 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 information