CSE 355 Homework One Sample Solutions
|
|
- Marcus Harmon
- 5 years ago
- Views:
Transcription
1 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: q e,e q o,e q e,o q o,o q e,e (start) q o,e q e,o q e,o (final) q o,o q e,e q o,e q e,e q o,o q o,o q e,o q o,e.2 Part (b) {w {, } : w contains an odd number of s and an even number of s} Solution: This is exactly the same DFA as in part (a) except that F = {q o,e } here instead of {q e,o } as in part (a)..3 Part (c) {w {, } : w either contains an even number of s and an odd number of s or contains an odd number of s and an even number of s} using the product construction on the solutions for (a) and (b). Solution: We form the DFA for the product construction. For compactness, the state names are of the form abcd where the first machine was in state q a,b and the second was in q c,d.
2 eeee eeeo eeoe eeoo eoee eoeo eooe eooo oeee oeeo oeoe oeoo ooee ooeo oooe oooo The table is given below. eeee (start) oeoe eoeo eeeo oeoo eoee eeoe (final) oeee eooo eeoo oeeo eooe eoee (final) oooe eeeo eoeo (final) oooo eeee eooe (final) ooee eeoo eooo (final) ooeo eeoe oeee eeoe ooeo oeeo eeoo ooee oeoe (final) eeee oooo oeoo oeeo eooe ooee eooe oeeo ooeo eooo oeee oooe (final) eoee oeoo oooo eoeo oeoe.4 Part (d) The same language as (c), with as few states as you can. Solution: Note that when the product construction was performed in part (c), it was on the same DFA (apart from the final states). This means that for all states in part (c) of the form abcd where (a, b) (c, d), 2
3 it is not possible to reach that state from the start state. Therefore, all of those states can be removed to obtain the following DFA: eeee eoeo oeoe oooo However, this DFA can still be simplified. Note that if an odd number of characters has been processed, the DFA is in one of its two final states; if an even number has been processed, then the DFA is in one of the other two states. Therefore, we can just make the DFA on two states for checking if the input length is odd or not: even,, odd even (start) odd odd odd (final) even even 2 Question 2 Give a transition diagram for an NFA with as few states as you can to recognize 2. Part (a) {w {, } : w has as a substring} Solution:,, q q q 2 q Part (b) {w {, } : w does not have as a substring} Solution: This was not necessary, but I converted the above NFA to a DFA, complemented the final states, and removed all unneeded states (of which there was ). Note that this is the smallest possible NFA for this language, since we need to accept strings that have but not as a substring. 3
4 q q q Part (c) {w {, } : w has as a substring or w does not have as a substring} Solution: This is just {, }., q 3 Question 3 Which languages are accepted by Note that for Questions 3 and 4, we can use the GNFA method (initially) on 5 states even if the original DFA/NFA had or 2 states, we can add a dummy state(s). When the GNFA is built, it corresponds to exactly 6 transitions (some of which are ). We then rip out the intermediate states to obtain a (large) regular expression on variables that correspond to all of the possible transitions of the original DFA/NFA. We get all of the languages in each part by filling in all possible choices of subsets of Σ to all transitions in all possible ways. 3. Part (a) a DFA with state with alphabet Σ = {,, 2}? Solution: For all 3 parts, note that since we are dealing with DFAs, if a language L is listed, then L is also possible because of closure under complement. The only languages can be, and as a result, {,, 2}. Since the machine is a DFA, every state must have a transition on,, and 2. But there is only one state, so all three transitions have to be self-loops. The only choices of final states are having this state be final or not, which give us those two languages. 3.2 Part (b) a DFA with 2 states with alphabet Σ = {, }? Solution: Per the discussion of Question 5 below, there are 64 possible DFAs with 2 states and 2 input symbols. However, this can be reduced as follows: we do not list the DFAs with both states final, since it has language the complement of the DFA with neither state final. There are 32 DFAs that fit into these two categories. Also, we do not list the DFAs with the start state non-final and the second state final, since we will list the DFAs with the start state final and the second state non-final (and hence has the complemented language). This cuts our list down to 6 DFAs to consider. For both states neither final, the language must be. Because of this, the language {, } is also possible (for when both states are final). For the first state final and the second state non-final, we create a table of languages as follows, where Q = {q, q }, q is the start state, and F = {q }. The fifth column lists the language as given by the DFA given in the previous four columns. 4
5 For simplicity, let # a (w) be the number of occurrences of the character a in w. Define the following languages: L = {w {, } : # (w) =, # (w) is even}, L 2 = {w {, } : w ends in followed by even number of s} L 3 = {w {, } : w ends in }, L 4 = {w {, } : # (w) is even} L 5 = {w {, } : # (w) =, # (w) is even}, L 6 = {w {, } : w ends in followed by even number of s} L 7 = {w {, } : # (w) is even} L 8 = {w {, } : w ends in } L 9 = {w {, } : w is even} L = {w {, } : w ends in followed by odd number of s} L = {w {, } : w ends in followed by odd number of s} δ(q, ) δ(q, ) δ(q, ) δ(q, ) Language q q q q {, } q q q q {, } q q q q {, } q q q q {, } q q q q L L 2 q q q q L 3 {ε} q q q q L 4 q q q q {} q q q q L 5 L 6 q q q q L 7 q q q q L 8 {ε} q q q q {} q q q q L 9 q q q q L 5 L q q q q L 5 L q q q q {ε} Therefore, the languages presented in this table, their complements, as well as and {, } are the languages accepted by 2-state DFAs on 2 symbols. 3.3 Part (c) a DFA with 3 states with alphabet Σ = {}? Solution: There are 8 ways to choose the set of final states. For each, there are three ways to choose the transition labeled leaving a state, so there are 3 3 = 27 ways to choose the three transitions. Hence there are 26 DFAs to consider. However, as in part (b), we can make simplifications. If no state is final, then the language is, and if all are final, then the language is {}. If two states are final, then that language is the complement of if the other state was the only final state. Define the following languages: 5
6 L = {w {} : w is even}, L 2 = {w {} : w, when divided by 3, has a remainder of }, L 3 = {w {} : w, when divided by 3, has a remainder of }, L 4 = {w {} : w, when divided by 3, has a remainder of 2}, L 5 = {ε}, L 6 = {ε, }, L 7 = {}, L 8 =, Brute forcing all the DFAs, as in part (b), reveals that the languages are the ones listed above as well as their complements. 4 Question 4 Which languages are accepted by 4. Part (a) an NFA with state with alphabet Σ = {,, 2}? Solution: Note that we cannot apply the closure under complement idea from Question 3 here because swapping final and non-final states does not necessarily work for NFAs. There are 2 3 = 8 possible sets of transitions from the (only) state to itself. If the state is non-final, the language is. If the state is final, the possible languages are S where S P({,, 2}) (i.e., S is any subset of {,, 2}). 4.2 Part (b) an NFA with 2 states with alphabet Σ = {, }? Solution: Because there are so many possible NFAs, a Python program was written to compute all possible languages (written as regular expressions for convenience). There are 8 subsets of {,, ε} as to transitions that can be made between both states. If both states are non-final, the language is. Let q be the start state, and q the other state. Let the transitions from q to q be A; from q to q be B; from q to q be C; and from q to q be D. Now suppose q is final, and q is not. Then the language of the NFA is (A BD C). If q is final and q is not, the language is A B(D CA B). If both states are final, the language is (A BD C) (ε BD ). So for all possible choices of 8 transitions for A, B, C, D and for all 4 combinations of the states being final, we generate all possible NFAs. We can make simplifications. If A or D include ε, then we can ignore that case because there is no reason to include ε for a self-loop. Suppose we have a candidate language L (written as a regex). In the generation of the expressions, a number of substitutions can be made. One example is replacing X with where X is anything. We perform substitutions or simplifications until no more can be performed. Note that some languages are equivalent to others on the list. Also, the languages are listed in sorted order of the produced string. The operator + represents union, and * is star, as usual. 6
7 ((+)(+))* ((+)(+))*(+) ((+)(+)*(+))* ((+)(+)*(+))*((+)(+)*) ((+)(+)*) ((+)(+)*)* ((+)(+)*)*((+)(+)*) ((+)(+)*)* ((+)(+)*)*((+)(+)*) ((+)(+)*)* ((+)(+)*)*((+)(+)*) ((+)*(+))* ((+)*(+))*(+)* ((+)*)* ((+)*)*(+)* ((+)*)* ((+)*)*(+)* ((+)+(+)(+))* ((+)+(+)(+))*(+) ((+)+(+)(+)*(+))* ((+)+(+)(+)*(+))*((+)(+)*) ((+)+(+)(+)*)* ((+)+(+)(+)*)*((+)(+)*) ((+)+(+)(+)*)* ((+)+(+)(+)*)*((+)(+)*) ((+)+(+)(+)*)* ((+)+(+)(+)*)*((+)(+)*) ((+)+(+))* ((+)+(+))*(+) ((+)+(+)*(+))* ((+)+(+)*(+))*(+)* ((+)+(+)*)* ((+)+(+)*)*(+)* ((+)+(+)*)* ((+)+(+)*)*(+)* ((+)+(+)*)* ((+)+(+)*)*(+)* ((+)+(+))* ((+)+(+))*(+) ((+)+(+)*(+))* ((+)+(+)*(+))*((+)*) ((+)+(+)*)* ((+)+(+)*)*((+)*) ((+)+(+)*)* ((+)+(+)*)*((+)*) ((+)+(+)*)* ((+)+(+)*)*((+)*) ((+)+(+))* ((+)+(+))*(+) ((+)+(+)*(+))* ((+)+(+)*(+))*((+)*) ((+)+(+)*)* ((+)+(+)*)*((+)*) ((+)+(+)*)* ((+)+(+)*)*((+)*) ((+)+(+)*)* ((+)+(+)*)*((+)*) ((+)+(+))* ((+)+(+))* ((+)+(+)*(+))* ((+)+(+)*(+))*((+)*) ((+)+(+)*)* ((+)+(+)*)*((+)*) ((+)+(+)*)* ((+)+(+)*)*((+)*) ((+)+(+)*)* ((+)+(+)*)*((+)*) ((+)+)* ((+)+)* ((+)+*(+))* ((+)+*(+))** ((+)+*)* ((+)+*)** ((+)+*)* ((+)+*)** ((+)+*)* ((+)+*)** ((+)+)* ((+)+)* ((+)+*(+))* ((+)+*(+))*(*) ((+)+*)* ((+)+*)*(*) ((+)+*)* ((+)+*)*(*) ((+)+*)* ((+)+*)*(*) ((+)+)* ((+)+)* ((+)+*(+))* ((+)+*(+))*(*) ((+)+*)* ((+)+*)*(*) ((+)+*)* ((+)+*)*(*) ((+)+*)* ((+)+*)*(*) ((+)+(+))* ((+)+(+))* ((+)+(+)*(+))* 7
8 ((+)+(+)*(+))*((+)*) ((+)+(+)*)* ((+)+(+)*)*((+)*) ((+)+(+)*)* ((+)+(+)*)*((+)*) ((+)+(+)*)* ((+)+(+)*)*((+)*) ((+)+)* ((+)+)* ((+)+*(+))* ((+)+*(+))** ((+)+*)* ((+)+*)** ((+)+*)* ((+)+*)** ((+)+*)* ((+)+*)** ((+)+)* ((+)+)* ((+)+*(+))* ((+)+*(+))*(*) ((+)+*)* ((+)+*)*(*) ((+)+*)* ((+)+*)*(*) ((+)+*)* ((+)+*)*(*) ((+)+)* ((+)+)* ((+)+*(+))* ((+)+*(+))*(*) ((+)+*)* ((+)+*)*(*) ((+)+*)* ((+)+*)*(*) ((+)+*)* ((+)+*)*(*) ((+))* ((+))*(+) ((+)*(+))* ((+)*(+))*((+)*) ((+)*) ((+)*)* ((+)*)*((+)*) ((+)*)* ((+)*)*((+)*) ((+)*)* ((+)*)*((+)*) ((+))* ((+))*(+) ((+)*(+))* ((+)*(+))*((+)*) ((+)*) ((+)*)* ((+)*)*((+)*) ((+)*)* ((+)*)*((+)*) ((+)*)* ((+)*)*((+)*) ((+))* ((+))* ((+)*(+))* ((+)*(+))*((+)*) ((+)*) ((+)*)* ((+)*)*((+)*) ((+)*)* ((+)*)*((+)*) ((+)*)* ((+)*)*((+)*) (*(+))* (*(+))** (*)* (*)** (*)* (*)** (+(+)(+))* (+(+)(+))*(+) (+(+)(+)*(+))* (+(+)(+)*(+))*((+)(+)*) (+(+)(+)*)* (+(+)(+)*)*((+)(+)*) (+(+)(+)*)* (+(+)(+)*)*((+)(+)*) (+(+)(+)*)* (+(+)(+)*)*((+)(+)*) (+(+)*(+))* (+(+)*(+))*(+)* (+(+)*)* (+(+)*)*(+)* (+(+)*)* (+(+)*)*(+)* (+(+)*)* (+(+)*)*(+)* (+(+))* (+(+))*(+) (+(+)*(+))* (+(+)*(+))*((+)*) (+(+)*)* (+(+)*)*((+)*) 8
9 (+(+)*)* (+(+)*)*((+)*) (+(+)*)* (+(+)*)*((+)*) (+(+))* (+(+))*(+) (+(+)*(+))* (+(+)*(+))*((+)*) (+(+)*)* (+(+)*)*((+)*) (+(+)*)* (+(+)*)*((+)*) (+(+)*)* (+(+)*)*((+)*) (+(+))* (+(+))* (+(+)*(+))* (+(+)*(+))*((+)*) (+(+)*)* (+(+)*)*((+)*) (+(+)*)* (+(+)*)*((+)*) (+(+)*)* (+(+)*)*((+)*) (+*(+))* (+*(+))** (+*)* (+*)** (+*)* (+*)** (+*)* (+*)** (+)* (+)* (+*(+))* (+*(+))*(*) (+*)* (+*)*(*) (+*)* (+*)*(*) (+*)* (+*)*(*) (+)* (+)* (+*(+))* (+*(+))*(*) (+*)* (+*)*(*) (+*)* (+*)*(*) (+*)* (+*)*(*) (+(+))* (+(+))* (+(+)*(+))* (+(+)*(+))*((+)*) (+(+)*)* (+(+)*)*((+)*) (+(+)*)* (+(+)*)*((+)*) (+(+)*)* (+(+)*)*((+)*) (+) (+)((+)(+))* (+)((+)+(+)(+))* (+)((+)+(+))* (+)((+)+(+))* (+)((+)+(+))* (+)((+))* (+)(+(+)(+))* (+)(+(+))* (+)(+(+))* (+)(+)* (+)((+))* (+)(+(+)(+))* (+)(+(+))* (+)(+(+))* (+)* (+)*((+)(+)*) (+)*((+)(+)*)* (+)*((+)+(+)(+)*)* (+)*((+)+(+)*)* (+)*((+)+(+)*)* (+)*((+)+(+)*)* (+)*((+)*) (+)*((+)*) (+)*((+)*) (+)*((+)*)* (+)*(+(+)(+)*)* (+)*(+(+)*)* (+)*(+(+)*)* (+)*(+(+)*)* (+)*(+) (+)*(+)((+)(+)*(+))* (+)*(+)((+)*(+))* (+)*(+)((+)+(+)(+)*(+))* (+)*(+)((+)+(+)*(+))* (+)*(+)((+)+(+)*(+))* (+)*(+)((+)+(+)*(+))* (+)*(+)((+)*(+))* 9
10 (+)*(+)(+(+)(+)*(+))* (+)*(+)(+(+)*(+))* (+)*(+)(+(+)*(+))* (+)*(+)(+(+)*(+))* (+)*(+)(+)* (+)*(+)((+)*(+))* (+)*(+)(+(+)(+)*(+))* (+)*(+)(+(+)*(+))* (+)*(+)(+(+)*(+))* (+)*(+)(+(+)*(+))* (+)*(+)* (+)*(+)* (+)*(+)* (+)*(*) (+)*(*) (+)*((+)*) (+)*((+)*)* (+)*(+(+)(+)*)* (+)*(+(+)*)* (+)*(+(+)*)* (+)*(+(+)*)* (+)*(*) (+)*(*) (+)* (+)*((+)(+)*)* (+)*((+)*)* (+)*((+)+(+)(+)*)* (+)*((+)+(+)*)* (+)*((+)+(+)*)* (+)*((+)+(+)*)* (+)*((+)*)* (+)*(+(+)(+)*)* (+)*(+(+)*)* (+)*(+(+)*)* (+)*(+(+)*)* (+)*(+)* (+)*((+)*)* (+)*(+(+)(+)*)* (+)*(+(+)*)* (+)*(+(+)*)* (+)*(+(+)*)* (+)** (+)** (+)** (+)* (+)*((+)(+)*)* (+)*((+)*)* (+)*((+)+(+)(+)*)* (+)*((+)+(+)*)* (+)*((+)+(+)*)* (+)*((+)+(+)*)* (+)*((+)*)* (+)*(+(+)(+)*)* (+)*(+(+)*)* (+)*(+(+)*)* (+)*(+(+)*)* (+)*(+)* (+)*((+)*)* (+)*(+(+)(+)*)* (+)*(+(+)*)* (+)*(+(+)*)* (+)*(+(+)*)* (+)** (+)** (+)** (+)* (+)* (+*(+))* (+*(+))** (+*)* (+*)** (+*)* (+*)** (+*)* (+*)** (+)* (+)* (+*(+))* (+*(+))*(*) (+*)* (+*)*(*) (+*)* (+*)*(*) (+*)* (+*)*(*) (+)* (+)* (+*(+))* (+*(+))*(*) (+*)* (+*)*(*) (+*)* (+*)*(*) (+*)* (+*)*(*) ()* ()* (*(+))* (*(+))*(*) (*)
11 (*)* (*)*(*) (*)* (*)*(*) (*)* (*)*(*) ()* ()* (*(+))* (*(+))*(*) (*) (*)* (*)*(*) (*)* (*)*(*) (*)* (*)*(*) ((+))* ((+))* ((+)*(+))* ((+)*(+))*((+)*) ((+)*) ((+)*)* ((+)*)*((+)*) ((+)*)* ((+)*)*((+)*) ((+)*)* ((+)*)*((+)*) (*(+))* (*(+))** (*)* (*)** (*)* (*)** (+(+)(+))* (+(+)(+))*(+) (+(+)(+)*(+))* (+(+)(+)*(+))*((+)(+)*) (+(+)(+)*)* (+(+)(+)*)*((+)(+)*) (+(+)(+)*)* (+(+)(+)*)*((+)(+)*) (+(+)(+)*)* (+(+)(+)*)*((+)(+)*) (+(+)*(+))* (+(+)*(+))*(+)* (+(+)*)* (+(+)*)*(+)* (+(+)*)* (+(+)*)*(+)* (+(+)*)* (+(+)*)*(+)* (+(+))* (+(+))*(+) (+(+)*(+))* (+(+)*(+))*((+)*) (+(+)*)* (+(+)*)*((+)*) (+(+)*)* (+(+)*)*((+)*) (+(+)*)* (+(+)*)*((+)*) (+(+))* (+(+))*(+) (+(+)*(+))* (+(+)*(+))*((+)*) (+(+)*)* (+(+)*)*((+)*) (+(+)*)* (+(+)*)*((+)*) (+(+)*)* (+(+)*)*((+)*) (+(+))* (+(+))* (+(+)*(+))* (+(+)*(+))*((+)*) (+(+)*)* (+(+)*)*((+)*) (+(+)*)* (+(+)*)*((+)*) (+(+)*)* (+(+)*)*((+)*) (+*(+))* (+*(+))** (+*)* (+*)** (+*)* (+*)** (+*)* (+*)** (+)* (+)* (+*(+))* (+*(+))*(*) (+*)* (+*)*(*) (+*)* (+*)*(*) (+*)* (+*)*(*)
12 (+)* (+)* (+*(+))* (+*(+))*(*) (+*)* (+*)*(*) (+*)* (+*)*(*) (+*)* (+*)*(*) (+(+))* (+(+))* (+(+)*(+))* (+(+)*(+))*((+)*) (+(+)*)* (+(+)*)*((+)*) (+(+)*)* (+(+)*)*((+)*) (+(+)*)* (+(+)*)*((+)*) (+*(+))* (+*(+))** (+*)* (+*)** (+*)* (+*)** (+*)* (+*)** (+)* (+)* (+*(+))* (+*(+))*(*) (+*)* (+*)*(*) (+*)* (+*)*(*) (+*)* (+*)*(*) (+)* (+)* (+*(+))* (+*(+))*(*) (+*)* (+*)*(*) (+*)* (+*)*(*) (+*)* (+*)*(*) ()* ()* (*(+))* (*(+))*(*) (*) (*)* (*)*(*) (*)* (*)*(*) (*)* (*)*(*) ()* ()* (*(+))* (*(+))*(*) (*) (*)* (*)*(*) (*)* (*)*(*) (*)* (*)*(*) ((+)+(+))* ((+)+)* ((+)+)* ((+)+)* ((+))* (+(+))* (+)* (+)* (+)* ()* (+(+))* (+)* (+)* ()* * *((+)(+)*) *((+)+(+)*)* *((+)+*)* *((+)+*)* *((+)+*)* *((+)*) *((+)*)* *((+)*) *((+)*) *(+(+)*)* *(+*)* *(+*)* *(+) *(+)((+)+(+)*(+))* 2
13 *(+)((+)+*(+))* *(+)((+)+*(+))* *(+)((+)+*(+))* *(+)((+)*(+))* *(+)(*(+))* *(+)(+(+)*(+))* *(+)(+*(+))* *(+)(+*(+))* *(+)(+)* *(+)(+*(+))* *(+)(*(+))* *(+)(+(+)*(+))* *(+)(+*(+))* *(+)(+*(+))* *(+)(+*(+))* *(+)(*(+))* *(+)* *(+)* *(+)* *(+*)* *(*) *(*)* *(*) *((+)*) *(+(+)*)* *(+*)* *(+*)* *(+*)* *(*) *(*)* *(*) * *((+)+(+)*)* *((+)+*)* *((+)+*)* *((+)+*)* *((+)*)* *(*)* *(+(+)*)* *(+*)* *(+*)* *(+)* *(+*)* *(*)* *(+(+)*)* *(+*)* *(+*)* *(+*)* *(*)* ** ** * *((+)+(+)*)* *((+)+*)* *((+)+*)* *((+)+*)* *((+)*)* *(*)* *(+(+)*)* *(+*)* *(+*)* *(+)* *(+*)* *(*)* *(+(+)*)* *(+*)* *(+*)* *(+*)* *(*)* ** ** ** * * ((+)+(+))* ((+)+)* ((+)+)* ((+)+)* ((+))* (+(+))* (+)* (+)* (+)* ()* (+(+))* (+)* (+)* ()* * *((+)(+)*) *((+)+(+)*)* *((+)+*)* *((+)+*)* *((+)+*)* *((+)*) *((+)*) *((+)*)* *((+)*) *(+(+)*)* 3
14 *(+*)* *(+) *(+)((+)+(+)*(+))* *(+)((+)+*(+))* *(+)((+)+*(+))* *(+)((+)+*(+))* *(+)((+)*(+))* *(+)(+(+)*(+))* *(+)(+*(+))* *(+)(+)* *(+)(+*(+))* *(+)(+*(+))* *(+)(*(+))* *(+)(*(+))* *(+)(+(+)*(+))* *(+)(+*(+))* *(+)(+*(+))* *(+)(+*(+))* *(+)(*(+))* *(+)* *(+)* *(+)* *(+*)* *(+*)* *(*) *(*) *(*)* *((+)*) *(+(+)*)* *(+*)* *(+*)* *(+*)* *(*) *(*) *(*)* * *((+)+(+)*)* *((+)+*)* *((+)+*)* *((+)+*)* *((+)*)* *(+(+)*)* *(+*)* *(+)* *(+*)* *(+*)* *(*)* *(*)* *(+(+)*)* *(+*)* *(+*)* *(+*)* *(*)* ** ** ** * *((+)+(+)*)* *((+)+*)* *((+)+*)* *((+)+*)* *((+)*)* *(+(+)*)* *(+*)* *(+)* *(+*)* *(+*)* *(*)* *(*)* *(+(+)*)* *(+*)* *(+*)* *(+*)* *(*)* ** ** * * ε 4.3 Part (c) an NFA with 3 states with alphabet Σ = {}? Solution: We proceed in the same way as in part (b). Suppose the states are q, q, q 2. Let the transitions from q to q be A; from q to q be B; from q to q 2 be C; from q to q be D; from q to q be E; from q to q 2 be F ; from q 2 to q 2 be G; from q 2 to q be H; and from q 2 to q be I. Although this is not strictly necessary, one can find a regular expression for the language of this NFA by using the GNFA process described in the text. If that process was followed (as was in generating the 4
15 output below), one such regex is: (R R 3 R 2R 4 ) (R 5 R 3 R 2R 6 ) where R = A CG H, R 2 = D F G H, R 3 = B CG I, R 4 = E F G H, R 5 = J HG L, R 6 = K F G L, where J, K, L are ε if q, q, q 2 are final respectively, and are if they are not final, respectively. Again many simplifications are possible here, as was in part (b). Note that there are many simplifications that can still be done and that there are many languages repeated. ((+)()*) ((+)()*) ((+)()*)*((+)()*) ((+)()*)*((+)()*) ((+)+(+)()*(+))*((+)()*) ((+)+(+)()*(+))*(+(+)()*) ((+)+(+)()*())*((+)()*) ((+)+(+)()*())*(+(+)()*) ((+)+(+))*(+(+)) ((+)+(+))*(+) ((+)+(+))* ((+)+(+)*(+))*((+)*) ((+)+(+)*(+))*(+(+)*) ((+)+(+)*())*((+)*) ((+)+(+)*())*(+(+)*) ((+)+(+)*)*((+)*) ((+)+(+)*)*(+(+)*) ((+)+(+)*)* ((+)+()()*(+))*(()()*) ((+)+()()*(+))*(+()()*) ((+)+()()*())*(()()*) ((+)+()()*())*(+()()*) ((+)+())*(+()) ((+)+())*() ((+)+())* ((+)+()*(+))*(()*) ((+)+()*(+))*(+()*) ((+)+()*())*(()*) ((+)+()*())*(+()*) ((+)+()*)*(()*) ((+)+()*)*(+()*) ((+)+()*)* ((+)+(+))*(+) ((+)+(+))* ((+)+())*(+) ((+)+())* ((+)+)* ((+)+*(+))*(*) ((+)+*(+))*(*) ((+)+*())*(*) ((+)+*())*(*) ((+)+*)*(*) ((+)+*)* ((+))*(+) ((+)*) ((+)*)*((+)*) ((+)*) ((+)*)*((+)*) ((+)*)*((+)*) (()()*) (()()*) (()()*)*(()()*) (()()*)*(()()*) (()+(+)()*(+))*((+)()*) (()+(+)()*(+))*(+(+)()*) (()+(+)()*())*((+)()*) (()+(+)()*())*(+(+)()*) (()+(+))*(+(+)) (()+(+))*(+) (()+(+))* (()+(+)*(+))*((+)*) (()+(+)*(+))*(+(+)*) (()+(+)*())*((+)*) (()+(+)*())*(+(+)*) (()+(+)*)*((+)*) (()+(+)*)*(+(+)*) (()+(+)*)* (()+()()*(+))*(()()*) (()+()()*(+))*(+()()*) (()+()()*())*(()()*) (()+()()*())*(+()()*) (()+())*(+()) (()+())*() (()+())* (()+()*(+))*(()*) (()+()*(+))*(+()*) (()+()*())*(()*) (()+()*())*(+()*) (()+()*)*(()*) (()+()*)*(+()*) (()+()*)* (()+(+))*(+) (()+(+))* (()+())*(+) 5
16 (()+())* (()+)* (()+*(+))*(*) (()+*(+))*(*) (()+*())*(*) (()+*())*(*) (()+*)*(*) (()+*)* (())*() (()*) (()*)*(()*) (()*) (()*)*(()*) (()*)*(()*) ((*)(*)(*)) ((*)(*)) ((*)(*))*((*)(*)(*)) ((*)(*))*((*)(*)) ((*)) ((*))* ((*))*((*)) ((*))*((*)+*) ((*))*((*)*) ((*))*((*)) ((*))*((*)*) ((*))*(*+(*)) ((*))*(*) ((*))* ((*))** ((*)+(*)(*)(*))*((*)(*)) ((*)+(*)(*)(*))*((*)+(*)(*)(*)) ((*)+(*))* ((*)+(*))*(*+(*)) ((*)+(*))*((*)) ((*)+(*))** ((*)+(*)*(*))*((*)+(*)*) ((*)+(*)*(*))*((*)*) ((*)+(*)*(*))*(*+(*)*(*)) ((*)+(*)*)*((*)) ((*)+(*)*)*((*)*) ((*)+(*)*)*(*+(*)*) ((*)+(*)*)** ((*)+(*)(*)(*))*((*)(*)) ((*)+(*)(*)(*))*(*+(*)(*)(*)) ((*)+(*))*((*)) ((*)+(*))** ((*)+(*)*)*((*)*) ((*)+(*)*)*(*+(*)*) ((*)+(*)*)** ((*)+(*))*((*)+*) ((*)+(*))*(*+(*)) ((*)+(*))* ((*)+(*))*((*)+(*)) ((*)+(*))* ((*)+)*((*)) ((*)+)* ((*)+)** ((*)+*(*))*((*)+*) ((*)+*(*))*(*+*(*)) ((*)+*(*))*(*) ((*)+*(*))*((*)+*(*)) ((*)+*(*))*(*) ((*)+*)*((*)) ((*)+*)*(*+*) ((*)+*)* ((*)+*)** ((*)+*)*((*)) ((*)+*)*(*+*) ((*)+*)*(*) ((*)+*)** ((*))*((*)) ((*)*(*)) ((*)*) ((*)*) ((*)*)*((*)*(*)) ((*)*)*((*)*) ((*)*)*((*)*) ((*)(*)(*)) ((*)(*)) ((*)(*))*((*)(*)(*)) ((*)(*))*((*)(*)) ((*)) ((*))* ((*))*((*)) ((*))*((*)+(*)) ((*))*((*)*) ((*))*((*)) ((*))*((*)*) ((*))*(*) ((*))* ((*)+(*))*((*)) ((*)+(*)*(*))*((*)+(*)*) ((*)+(*)*(*))*((*)*) ((*)+(*)*(*))*((*)+(*)*(*)) ((*)+(*)*(*))*((*)*) ((*)+(*)*)*((*)) ((*)+(*)*)*((*)*) ((*)+(*)(*)(*))*((*)+(*)(*)(*)) ((*)+(*)(*)(*))*((*)(*)) ((*)+(*))* 6
17 ((*)+(*))*((*)+(*)) ((*)+(*))*((*)) ((*)+(*))*((*)) ((*)+(*)*(*))*((*)+(*)*) ((*)+(*)*(*))*((*)*) ((*)+(*)*)*((*)) ((*)+(*)*)*((*)*) ((*)+(*))*((*)+*) ((*)+(*))* ((*)+(*))*((*)+(*)) ((*)+(*))* ((*)+)*((*)) ((*)+)* ((*)+*(*))*((*)+*) ((*)+*(*))*(*) ((*)+*(*))*((*)+*(*)) ((*)+*(*))*(*) ((*)+*)*((*)) ((*)+*)*(*) ((*))*((*)) ((*)*) ((*)*) ((*)*)*((*)*) ((*)*)*((*)*) ((+))*(+) ((+))* (())*(+) (())* (()*(+))*(()*) (()*(+))*(+()*) (()*())*(()*) (()*())*(+()*) (()*) (()*) (()*)*(()*) (()*)*(()*) ((*)) ((*))*((*)+*) ((*))*(*+(*)) ((*))* ((*)(*)) ((*)(*))*((*)) ((*)(*))*(*+(*)(*)) ((*)(*))*((*)+(*)(*)) ((*)(*))*((*)) ((*)) ((*))*((*)+(*)) ((*))* ((*))*((*)(*)) ((*))*((*)) (*(+))*(*) (*(+))** (*())*(*) (*())** (*+(*)(*)(*))*((*)(*)) (*+(*)(*)(*))*(*+(*)(*)(*)) (*+(*))*((*)) (*+(*))** (*+(*)*)*((*)*) (*+(*)*)*(*+(*)*) (*+(*)*)** (*+(*))*(*+(*)) (*+(*))* (*+)* (*+)** (*+*(*))*(*+*(*)) (*+*(*))*(*) (*+*)*(*+*) (*+*)* (*+*)** (*+*)*(*+*) (*+*)*(*) (*+*)** (+(+)()*)*((+)()*) (+(+)()*)*((+)()*) (+(+))* (+(+))*(+) (+(+))* (+(+))*(+) (+(+)*)*((+)*) (+(+)*)*((+)*) (+(+)*)*((+)*) (+()()*)*(()()*) (+()()*)*(()()*) (+())* (+())*() (+())* (+())*() (+()*)*(()*) (+()*)*(()*) (+()*)*(()*) (+(*)(*))*((*)(*)(*)) (+(*)(*))*((*)(*)) (+(*))* (+(*))*((*)+*) (+(*))*(*+(*)) (+(*))*((*)) (+(*)*)*((*)*(*)) (+(*)*)*((*)*) (+(*)*)*((*)*) 7
18 (+(*)(*))*((*)(*)(*)) (+(*)(*))*((*)(*)) (+(*))* (+(*))*((*)+(*)) (+(*))*((*)) (+(*)*)*((*)*) (+(*)*)*((*)*) (+(+))*(+) (+(+))* (+())*(+) (+())* (+()*(+))*(()*) (+()*(+))*(+()*) (+()*())*(()*) (+()*())*(+()*) (+()*)*(()*) (+()*)*(()*) (+(*))*((*)+*) (+(*))*(*+(*)) (+(*))* (+(*)(*))*((*)) (+(*)(*))*(*+(*)(*)) (+(*)(*))*((*)+(*)(*)) (+(*)(*))*((*)) (+(*))*((*)+(*)) (+(*))* (+(*))*((*)(*)) (+(*))*((*)) (+*(+))*(*) (+*(+))** (+*())*(*) (+*())** (+) (+*(+))*(*) (+*(+))*(*) (+*())*(*) (+*())*(*) (+*(*))*((*)+*) (+*(*))*(*+*(*)) (+*(*))*(*) (+*(*))*((*)+*(*)) (+*(*))*(*) () ()* ()*((+)*) ()*(()*) ()*((*)) ()*((*)) ()*(+(+)) ()*(+(+)*) ()*(+()) ()*(+()*) ()*(+) ()*() ()*(*) ()* ()** (*(+))*(*) (*(+))*(*) (*())*(*) (*())*(*) (*(*)) (*(*))*((*)+*) (*(*))*(*+*(*)) (*(*))*(*) (*(*))*((*)+*(*)) (*(*))*(*) (*) (*) (*)((*)) (*)(*+*) (*)(*(*)) (*)(*) (*)(*) (*) (*)* (empty set) * *((+)()*) *((+)()*) *((+)*) *((+)*) *(()()*) *(()()*) *(()*) *(()*) *((*)(*)(*)) *((*)(*)) *((*)) *((*)*(*)) *((*)*) *((*)*) *((*)(*)(*)) *((*)(*)) *((*)) *((*)*) *((*)*) *(()*) *(()*) 8
19 *((*)) *((*)(*)) *((*)) *(*+*) *(*+*) *(+(+)) *(+(+)*) *(+()) *(+()*) *(+) *() *(*(*)) *(*) *(*) * ε 5 Question 5 My friend the entrepreneur knows that everyone gets tired of building DFAs for every new problem they encounter. He is about to launch a marketing campaign for the Universal DFA, claiming it can recognize every regular language in {, } by rewiring itself to implement any transition function. The amazing udfa uses a binary input alphabet and, to keep costs low, only uses states. I am skeptical that such a udfa can exist. Please help me justify my skepticism (explain carefully why such a universal DFA cannot exist). Solution: Let s = be the number of states in the udfa. There are 2 s possible configurations of which of the states is accepting. For transitions, each state has s 2 different choices of states for which of the two symbols it transitions on. Overall, there are (s 2 ) s different transition tables. Here we do not need to track where the start state is because the transition tables keep track of that; so let any of the states be the start state. Finally, there are (at most) 2 s (s 2 ) s different possible languages that a udfa can have. Since s = is fixed, this quantity is a finite, albeit massive, number. However, there are infinitely many regular languages that are subsets of {, }. Therefore, there must be some language that a hypothesized udfa cannot recognize, which finishes the proof. However, we can improve listing an infinite number of languages to an explicit finite set of small languages for which we guarantee at least one of them cannot be recognized by this udfa. Consider the languages L i = { i } for i. For the languages L, L, L 2,, L 2 s (s 2 ) s, there are 2 s (s 2 ) s + different languages listed. But a udfa can only recognize 2 s (s 2 ) s of them, so there must be some L i that it cannot recognize (in fact, the example below shows that many of these cannot be recognized). For an explicit example of a language that cannot be recognized, consider the language P, where P k = {w {, } : w k} (to fully prove this, one needs to show that for any DFA with language P k, it must have at least k + states). 9
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 informationCS 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 information10. The GNFA method is used to show that
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
More informationHomework 1 Due September 20 M1 M2
Homework 1 Due September 20 1. Consider the state diagrams for two DFAs, M1 and M2 M1 M2 a. Give the formal descriptions of the two machines above specifically, specify the elements of the 5-tuple (Q,
More informationFooling Sets and. Lecture 5
Fooling Sets and Introduction to Nondeterministic Finite Automata Lecture 5 Proving that a language is not regular Given a language, we saw how to prove it is regular (union, intersection, concatenation,
More informationCSE 105 THEORY OF COMPUTATION
CSE 105 THEORY OF COMPUTATION "Winter" 2018 http://cseweb.ucsd.edu/classes/wi18/cse105-ab/ Today's learning goals Sipser Ch 4.1 Explain what it means for a problem to be decidable. Justify the use of encoding.
More informationfront pad rear pad door
front pad rear pad door REAR BOTH NEITHER closed FRONT open FRONT REAR BOTH NEITHER Think of this as a simple program that outputs one of two values (states) when provided with the current state and an
More informationSeptember 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 informationCSE 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 informationCSE 105 THEORY OF COMPUTATION
CSE 105 THEORY OF COMPUTATION Spring 2018 http://cseweb.ucsd.edu/classes/sp18/cse105-ab/ Today's learning goals Sipser Ch 4.1 Explain what it means for a problem to be decidable. Justify the use of encoding.
More informationClosure under the Regular Operations
Closure under the Regular Operations 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
More informationConstructions on Finite Automata
Constructions on Finite Automata Informatics 2A: Lecture 4 Alex Simpson School of Informatics University of Edinburgh als@inf.ed.ac.uk 23rd September, 2014 1 / 29 1 Closure properties of regular languages
More informationCMSC 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 informationCSE 311: Foundations of Computing. Lecture 23: Finite State Machine Minimization & NFAs
CSE : Foundations of Computing Lecture : Finite State Machine Minimization & NFAs State Minimization Many different FSMs (DFAs) for the same problem Take a given FSM and try to reduce its state set by
More informationFORMAL 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 informationName: 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 informationCPS 220 Theory of Computation REGULAR LANGUAGES
CPS 22 Theory of Computation REGULAR LANGUAGES Introduction Model (def) a miniature representation of a thing; sometimes a facsimile Iraq village mockup for the Marines Scientific modelling - the process
More informationFalse. 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 informationText Search and Closure Properties
Text Search and Closure Properties CSCI 330 Formal Languages and Automata Theory Siu On CHAN Fall 208 Chinese University of Hong Kong /28 Text Search grep program grep -E regex file.txt Searches for an
More informationNondeterministic Finite Automata
Nondeterministic Finite Automata Not A DFA Does not have exactly one transition from every state on every symbol: Two transitions from q 0 on a No transition from q 1 (on either a or b) Though not a DFA,
More informationConstructions on Finite Automata
Constructions on Finite Automata Informatics 2A: Lecture 4 Mary Cryan School of Informatics University of Edinburgh mcryan@inf.ed.ac.uk 24 September 2018 1 / 33 Determinization The subset construction
More informationFORMAL 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 informationNFA and regex. the Boolean algebra of languages. regular expressions. Informatics 1 School of Informatics, University of Edinburgh
NFA and regex cl the Boolean algebra of languages regular expressions Informatics The intersection of two regular languages is regular L = even numbers L = odd numbers L = mod L = mod Informatics The intersection
More informationClarifications from last time. This Lecture. Last Lecture. CMSC 330: Organization of Programming Languages. Finite Automata.
CMSC 330: Organization of Programming Languages Last Lecture Languages Sets of strings Operations on languages Finite Automata Regular expressions Constants Operators Precedence CMSC 330 2 Clarifications
More informationCISC 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 informationText Search and Closure Properties
Text Search and Closure Properties CSCI 3130 Formal Languages and Automata Theory Siu On CHAN Chinese University of Hong Kong Fall 2017 1/30 Text Search 2/30 grep program grep -E regexp file.txt Searches
More informationcse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska
cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska LECTURE 6 CHAPTER 2 FINITE AUTOMATA 2. Nondeterministic Finite Automata NFA 3. Finite Automata and Regular Expressions 4. Languages
More informationCS 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 informationIntroduction to Turing Machines. Reading: Chapters 8 & 9
Introduction to Turing Machines Reading: Chapters 8 & 9 1 Turing Machines (TM) Generalize the class of CFLs: Recursively Enumerable Languages Recursive Languages Context-Free Languages Regular Languages
More informationCMSC 330: Organization of Programming Languages
CMSC 330: Organization of Programming Languages Theory of Regular Expressions DFAs and NFAs Reminders Project 1 due Sep. 24 Homework 1 posted Exam 1 on Sep. 25 Exam topics list posted Practice homework
More informationCS 154 Formal Languages and Computability Assignment #2 Solutions
CS 154 Formal Languages and Computability Assignment #2 Solutions Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak www.cs.sjsu.edu/~mak Assignment #2: Question 1
More informationClosure 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 informationNondeterminism. September 7, Nondeterminism
September 7, 204 Introduction is a useful concept that has a great impact on the theory of computation Introduction is a useful concept that has a great impact on the theory of computation So far in our
More informationCS 121, Section 2. Week of September 16, 2013
CS 121, Section 2 Week of September 16, 2013 1 Concept Review 1.1 Overview In the past weeks, we have examined the finite automaton, a simple computational model with limited memory. We proved that DFAs,
More informationLecture 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 informationFoundations of
91.304 Foundations of (Theoretical) Computer Science Chapter 1 Lecture Notes (Section 1.3: Regular Expressions) David Martin dm@cs.uml.edu d with some modifications by Prof. Karen Daniels, Spring 2012
More informationComputer 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 informationComputational 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 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 informationExamples of Regular Expressions. Finite Automata vs. Regular Expressions. Example of Using flex. Application
Examples of Regular Expressions 1. 0 10, L(0 10 ) = {w w contains exactly a single 1} 2. Σ 1Σ, L(Σ 1Σ ) = {w w contains at least one 1} 3. Σ 001Σ, L(Σ 001Σ ) = {w w contains the string 001 as a substring}
More informationDeterministic Finite Automata (DFAs)
Algorithms & Models of Computation CS/ECE 374, Fall 27 Deterministic Finite Automata (DFAs) Lecture 3 Tuesday, September 5, 27 Sariel Har-Peled (UIUC) CS374 Fall 27 / 36 Part I DFA Introduction Sariel
More informationCSE 105 Theory of Computation Professor Jeanne Ferrante
CSE 105 Theory of Computation http://www.jflap.org/jflaptmp/ Professor Jeanne Ferrante 1 Today s agenda NFA Review and Design NFA s Equivalence to DFA s Another Closure Property proof for Regular Languages
More informationCSE Theory of Computing: Homework 3 Regexes and DFA/NFAs
CSE 34151 Theory of Computing: Homework 3 Regexes and DFA/NFAs Version 1: Fe. 6, 2018 Instructions Unless otherwise specified, all prolems from the ook are from Version 3. When a prolem in the International
More informationDeterministic Finite Automata (DFAs)
CS/ECE 374: Algorithms & Models of Computation, Fall 28 Deterministic Finite Automata (DFAs) Lecture 3 September 4, 28 Chandra Chekuri (UIUC) CS/ECE 374 Fall 28 / 33 Part I DFA Introduction Chandra Chekuri
More informationCSCI 2200 Foundations of Computer Science Spring 2018 Quiz 3 (May 2, 2018) SOLUTIONS
CSCI 2200 Foundations of Computer Science Spring 2018 Quiz 3 (May 2, 2018) SOLUTIONS 1. [6 POINTS] For language L 1 = {0 n 1 m n, m 1, m n}, which string is in L 1? ANSWER: 0001111 is in L 1 (with n =
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 informationTheory 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 informationCS 530: Theory of Computation Based on Sipser (second edition): Notes on regular languages(version 1.1)
CS 530: Theory of Computation Based on Sipser (second edition): Notes on regular languages(version 1.1) Definition 1 (Alphabet) A alphabet is a finite set of objects called symbols. Definition 2 (String)
More informationComputational 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 informationRegular languages, regular expressions, & finite automata (intro) CS 350 Fall 2018 gilray.org/classes/fall2018/cs350/
Regular languages, regular expressions, & finite automata (intro) CS 350 Fall 2018 gilray.org/classes/fall2018/cs350/ 1 L = {hello, bonjour, konnichiwa, } Σ = {a, b, c,, y, z}!2 Σ = {a, b, c,, y, z} Σ*
More information1 Alphabets and Languages
1 Alphabets and Languages Look at handout 1 (inference rules for sets) and use the rules on some examples like {a} {{a}} {a} {a, b}, {a} {{a}}, {a} {{a}}, {a} {a, b}, a {{a}}, a {a, b}, a {{a}}, a {a,
More informationUses of finite automata
Chapter 2 :Finite Automata 2.1 Finite Automata Automata are computational devices to solve language recognition problems. Language recognition problem is to determine whether a word belongs to a language.
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 Sipser Ch 1.4 Explain the limits of the class of regular languages Justify why the Pumping
More informationNondeterminism and Epsilon Transitions
Nondeterminism and Epsilon Transitions Mridul Aanjaneya Stanford University June 28, 22 Mridul Aanjaneya Automata Theory / 3 Challenge Problem Question Prove that any square with side length a power of
More information1 Showing Recognizability
CSCC63 Worksheet Recognizability and Decidability 1 1 Showing Recognizability 1.1 An Example - take 1 Let Σ be an alphabet. L = { M M is a T M and L(M) }, i.e., that M accepts some string from Σ. Prove
More informationCS 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 informationTuring Machines (TM) Deterministic Turing Machine (DTM) Nondeterministic Turing Machine (NDTM)
Turing Machines (TM) Deterministic Turing Machine (DTM) Nondeterministic Turing Machine (NDTM) 1 Deterministic Turing Machine (DTM).. B B 0 1 1 0 0 B B.. Finite Control Two-way, infinite tape, broken into
More informationCS 154, Lecture 2: Finite Automata, Closure Properties Nondeterminism,
CS 54, Lecture 2: Finite Automata, Closure Properties Nondeterminism, Why so Many Models? Streaming Algorithms 0 42 Deterministic Finite Automata Anatomy of Deterministic Finite Automata transition: for
More informationRecap DFA,NFA, DTM. Slides by Prof. Debasis Mitra, FIT.
Recap DFA,NFA, DTM Slides by Prof. Debasis Mitra, FIT. 1 Formal Language Finite set of alphabets Σ: e.g., {0, 1}, {a, b, c}, { {, } } Language L is a subset of strings on Σ, e.g., {00, 110, 01} a finite
More informationChapter 6: NFA Applications
Chapter 6: NFA Applications Implementing NFAs The problem with implementing NFAs is that, being nondeterministic, they define a more complex computational procedure for testing language membership. To
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 informationCOM364 Automata Theory Lecture Note 2 - Nondeterminism
COM364 Automata Theory Lecture Note 2 - Nondeterminism Kurtuluş Küllü March 2018 The FA we saw until now were deterministic FA (DFA) in the sense that for each state and input symbol there was exactly
More informationNondeterministic Finite Automata. Nondeterminism Subset Construction
Nondeterministic Finite Automata Nondeterminism Subset Construction 1 Nondeterminism A nondeterministic finite automaton has the ability to be in several states at once. Transitions from a state on an
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 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 informationCS21 Decidability and Tractability
CS21 Decidability and Tractability Lecture 3 January 9, 2017 January 9, 2017 CS21 Lecture 3 1 Outline NFA, FA equivalence Regular Expressions FA and Regular Expressions January 9, 2017 CS21 Lecture 3 2
More informationDeterministic Finite Automata (DFAs)
Algorithms & Models of Computation CS/ECE 374, Spring 29 Deterministic Finite Automata (DFAs) Lecture 3 Tuesday, January 22, 29 L A TEXed: December 27, 28 8:25 Chan, Har-Peled, Hassanieh (UIUC) CS374 Spring
More informationCSE 311: Foundations of Computing. Lecture 25: Pattern Matching, DFA NFA Regex Languages vs Representations
CSE 311: Foundations of Computing Lecture 25: Pattern Matching, DFA NFA Rege Languages vs Representations Last time: NFA to DFA 0 a,b 0,1 a 1 0 1 0 c 1 0 0,1 NFA b ɛ 0 c b,c 1 1 1 0 b 0 a,b,c DFA Eponential
More informationAutomata & languages. A primer on the Theory of Computation. Laurent Vanbever. ETH Zürich (D-ITET) September,
Automata & languages A primer on the Theory of Computation Laurent Vanbever www.vanbever.eu ETH Zürich (D-ITET) September, 24 2015 Last week was all about Deterministic Finite Automaton We saw three main
More informationAuthor: Vivek Kulkarni ( )
Author: Vivek Kulkarni ( vivek_kulkarni@yahoo.com ) Chapter-2: Finite State Machines Solutions for Review Questions @ Oxford University Press 2013. All rights reserved. 1 Q.1 Construct Mealy and Moore
More informationIncorrect reasoning about RL. Equivalence of NFA, DFA. Epsilon Closure. Proving equivalence. One direction is easy:
Incorrect reasoning about RL Since L 1 = {w w=a n, n N}, L 2 = {w w = b n, n N} are regular, therefore L 1 L 2 = {w w=a n b n, n N} is regular If L 1 is a regular language, then L 2 = {w R w L 1 } is regular,
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 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 informationCSE 135: Introduction to Theory of Computation Nondeterministic Finite Automata (cont )
CSE 135: Introduction to Theory of Computation Nondeterministic Finite Automata (cont ) Sungjin Im University of California, Merced 2-3-214 Example II A ɛ B ɛ D F C E Example II A ɛ B ɛ D F C E NFA accepting
More informationCSE 105 Homework 1 Due: Monday October 9, Instructions. should be on each page of the submission.
CSE 5 Homework Due: Monday October 9, 7 Instructions Upload a single file to Gradescope for each group. should be on each page of the submission. All group members names and PIDs Your assignments in this
More informationExam 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 informationCSE 311: Foundations of Computing. Lecture 25: Languages vs Representations: Limitations of Finite Automata and Regular Expressions
CSE 311: Foundations of Computing Lecture 25: Languages vs Representations: Limitations of Finite Automata and Regular Expressions Last time: NFA to DFA 0 a,b 0,1 a 1 0 1 0 c 1 0 0,1 NFA b ɛ 0 c b,c 1
More informationUNIT-II. NONDETERMINISTIC FINITE AUTOMATA WITH ε TRANSITIONS: SIGNIFICANCE. Use of ε-transitions. s t a r t. ε r. e g u l a r
Syllabus R9 Regulation UNIT-II NONDETERMINISTIC FINITE AUTOMATA WITH ε TRANSITIONS: In the automata theory, a nondeterministic finite automaton (NFA) or nondeterministic finite state machine is a finite
More informationCHAPTER Let "a" denote an acceptable power supply Let "f","m","c" denote a supply with a functional, minor, or cosmetic error, respectively.
CHPTR Section - -. Let "a", "b" denote a part above, below the specification S aaa, aab, aba, abb, baa, bab, bba, bbb { } -. Let "e" denote a bit in error Let "o" denote a bit not in error ("o" denotes
More informationFigure 1: NFA N. Figure 2: Equivalent DFA N obtained through function nfa2dfa
CS 3100 Models of Computation Fall 2011 FIRST MIDTERM CLOSED BOOK 100 points I ve standardized on @ for representing Epsilons in all my figures as well as my code (liked equally by dot and our Python programs).
More informationFormal Language and Automata Theory (CS21004)
Theory (CS21004) Announcements The slide is just a short summary Follow the discussion and the boardwork Solve problems (apart from those we dish out in class) Table of Contents 1 2 3 Patterns A Pattern
More informationFinite State Transducers
Finite State Transducers Eric Gribkoff May 29, 2013 Original Slides by Thomas Hanneforth (Universitat Potsdam) Outline 1 Definition of Finite State Transducer 2 Examples of FSTs 3 Definition of Regular
More informationUNIT-III REGULAR LANGUAGES
Syllabus R9 Regulation REGULAR EXPRESSIONS UNIT-III REGULAR LANGUAGES Regular expressions are useful for representing certain sets of strings in an algebraic fashion. In arithmetic we can use the operations
More informationTheory of Languages and Automata
Theory of Languages and Automata Chapter 1- Regular Languages & Finite State Automaton Sharif University of Technology Finite State Automaton We begin with the simplest model of Computation, called finite
More informationCSE 105 THEORY OF COMPUTATION
CSE 105 THEORY OF COMPUTATION Spring 2018 http://cseweb.ucsd.edu/classes/sp18/cse105-ab/ Today's learning goals Sipser Section 1.1 Prove closure properties of the class of regular languages Apply closure
More informationTheory of Computation Lecture 1. Dr. Nahla Belal
Theory of Computation Lecture 1 Dr. Nahla Belal Book The primary textbook is: Introduction to the Theory of Computation by Michael Sipser. Grading 10%: Weekly Homework. 30%: Two quizzes and one exam. 20%:
More informationTDDD65 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 informationFinite Automata Part Two
Finite Automata Part Two DFAs A DFA is a Deterministic Finite Automaton A DFA is defined relative to some alphabet Σ. For each state in the DFA, there must be exactly one transition defined for each symbol
More informationCISC 4090 Theory of Computation
9/2/28 Stereotypical computer CISC 49 Theory of Computation Finite state machines & Regular languages Professor Daniel Leeds dleeds@fordham.edu JMH 332 Central processing unit (CPU) performs all the instructions
More informationChap. 1.2 NonDeterministic Finite Automata (NFA)
Chap. 1.2 NonDeterministic Finite Automata (NFA) DFAs: exactly 1 new state for any state & next char NFA: machine may not work same each time More than 1 transition rule for same state & input Any one
More informationFinite Automata and Languages
CS62, IIT BOMBAY Finite Automata and Languages Ashutosh Trivedi Department of Computer Science and Engineering, IIT Bombay CS62: New Trends in IT: Modeling and Verification of Cyber-Physical Systems (2
More informationCpSc 421 Homework 1 Solutions
CpSc 421 Homework 1 Solutions 1. (15 points) Let Σ = {a, b, c}. Figure 7 depicts two finite state machines that read Let L a and L b denote the languages recognized by DFA (a) and DFA (b) respectively.
More informationCompiler Design. Spring Lexical Analysis. Sample Exercises and Solutions. Prof. Pedro C. Diniz
Compiler Design Spring 2011 Lexical Analysis Sample Exercises and Solutions Prof. Pedro C. Diniz USC / Information Sciences Institute 4676 Admiralty Way, Suite 1001 Marina del Rey, California 90292 pedro@isi.edu
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 informationCS243, Logic and Computation Nondeterministic finite automata
CS243, Prof. Alvarez NONDETERMINISTIC FINITE AUTOMATA (NFA) Prof. Sergio A. Alvarez http://www.cs.bc.edu/ alvarez/ Maloney Hall, room 569 alvarez@cs.bc.edu Computer Science Department voice: (67) 552-4333
More informationCS 455/555: Finite automata
CS 455/555: Finite automata Stefan D. Bruda Winter 2019 AUTOMATA (FINITE OR NOT) Generally any automaton Has a finite-state control Scans the input one symbol at a time Takes an action based on the currently
More informationAssignment #2 COMP 3200 Spring 2012 Prof. Stucki
Assignment #2 COMP 3200 Spring 2012 Prof. Stucki 1) Construct deterministic finite automata accepting each of the following languages. In (a)-(c) the alphabet is = {0,1}. In (d)-(e) the alphabet is ASCII
More information1. 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 informationCSE 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.1 Design an automaton that recognizes a given language. Specify each of
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 1.4 Give an example of a non-regular language Outline two strategies for proving
More information