The assignment is not difficult, but quite labour consuming. Do not wait until the very last day.
|
|
- Bertram Barker
- 5 years ago
- Views:
Transcription
1 CAS 705 CAS 705. Sample solutions to the assignment 1 (many questions have more than one solutions). Total of this assignment is 129 pts. Each assignment is worth 25%. The assignment is not difficult, but quite labour consuming. Do not wait until the very last day. 1.[5] Let M be the following non-deterministic automaton with -moves: Q = {q 0, q 1, q 2 }, = {a,b,c}, q 0 is the initial state, F = {q 1,q 2 }, ä a b c q 0 {q 0 } Ø {q 1 } {q 2 } q 1 Ø Ø {q 1 } Ø q 2 Ø {q 2 } Ø Ø a.[1] Compute CL({q i }) for i=0,1,2. ( CL(X) is -closure of X). b.[1] Give the state diagram (graphical representation) of M. c.[1] Give a state diagram (graphical representation) of a deterministic automaton that is equivalent to M. d.[2] Give a regular expression for L(M). a. CL({q 0 }) = {q 0,q 1 }, CL({q 1 }) = {q 1 }, CL({q 2 }) = {q 2 }. b. 1
2 c. d. a*cc* a*b* 2.[6] Let M be the following non-deterministic automaton with -moves: Q = {q 0, q 1, q 2, q 3 }, = {a,b}, q 0 is the initial state, F = {q 1 }, ä a b q 0 {q 1 } {q 2 } {q 3 } q 1 Ø {q 1,q 2 } Ø q 2 Ø Ø {q 3 } q 3 {q 1,q 3 } {q 2 } Ø a.[1] Compute CL({q i }) for i=0,1,2,3. ( CL(X) is -closure of X). b.[1] Give the state diagram (graphical representation) of M. c.[2] Give a state diagram (graphical representation) of a deterministic automaton that is equivalent to M. d.[2] Give a regular expression for L(M). 2
3 a. CL({q 0 }) = {q 0,q 3 }, CL({q 1 }) = {q 1 }, CL({q 2 }) = {q 2,q 3 }, CL({q 3 }) = {q 3 }. b. c. Note that after standard removal of -moves, the automaton has ä (q 2,a) = ä (q 2,a) = Ø, so we can remove the state q 2 and the language accepted remains the same. Then the standard procedure (restricted to the states that can be reached from the initial state lead to the following solution: d.[4] a(a b)* bb*a(a b)* = (a bb*a)(a b)* 3
4 3.[4] For every string x = a 1 a 2...a n, let x R = a n...a 2 a 1, and R =. a.[1] Provide the formal definition of x R by structural induction. Prove the following: b.[2] For all u,v Ó +, (uv) R =v R u R, c.[1] For all w Ó *, (w R ) R = w. a. R =, for each x Ó *, and a Ó, (xa) R = a x R. b. By induction on the length of v. Clearly (u ) R = u R = ( u) R. From the definition of R operator we also have that for each a Ó, (ua) R = au R = a R u R. Suppose that (uv) R = v R u R. Consider uva. We have (uva) R = a(uv) R = av R u R = (va) R u R, which proves the case. c. By induction on the length of w. Clearly ( R ) R =. Suppose that (w R ) R = w. Consider wa. We have ((wa) R ) R = (aw R ) R = (w R ) R a = wa, which ends the proof. 4.[3] Prove that (L 1 L 2 ) R = L 2R L 1 R for all languages L 1 and L 2. iff means if and only if, we need the results of question 3. x (L 1 L 2 ) R iff x R L 1 L 2 iff ( x R = uv and u L 1, v L 2 ) iff ( x R = uv and u R L 1R,v R L 2R ) iff ( x R = uv and v R u R L 2R L 1R ) iff (by 6b) ( x = (x R ) R = (uv) R and v R u R L 2R L 1R ) iff (by 6a) ( x = v R u R and v R u R L 2R L 1R ) iff x L 2R L 1 R, which ends the proof. 5.[5] Construct a deterministic finite automaton that accept the following language: L = the set of all strings over {1,2,3} the sum of whose elements is divided by 6. You may start with a non-deterministic solution first and then just translate it into the deterministic one. Provide some justification to your solution, could be informal. The states should be numbers {0,1,...,5}, each represent a number modulo 6. In other words, 0 represents {0,6,12,18,...}, 1 represents {1,7,13,19,...}, 2 represents {2,8,14,20,...,}, 3 represents {3,9,15,21,...}, 4 represents {4,10,16,22,...}, 5 represents {5,11,17,23,...}. The transition function represents addition modulo 6, i.e. 4
5 ä(k,l)= (k+l) mod 6, where k=0,...,5, l=1,2,3. All together: M = ({0,1,2,3,4,5}, {1,2,3}, ä, 0, {0}), i.e. initial state is zero, and F={0}, ä [10] Construct a deterministic finite automaton that accept the following language: L = the set of strings over {a,b,c} in which every substring of length four has exactly one b. You may start with a non-deterministic solution first and then just translate it into the deterministic one. Provide some justification to your solution, could be informal. An automaton analyses the string and once a substring of four without b or with more than one b is found, automaton moves to the garbage/sink state. The problem is underspecified since it does not say what to do with the strings of length smaller than 4, so both solutions (they are accepted or not) are o.k. So Ó = {a,b,c}, Q = {s 0,[b],[x],[bx],[xb],[xx],[xxx],[bxx],[xbx],[xxb],[xxxx],[bxxx],[xbxx],[xxbx],[xxxb]}, and s 0 is an initial state, F = { [bxxx], [xbxx], [xxbx], [xxxb]} - if we assume that all strings of length smaller than 4 are rejected, or F = {s 0,[b],[x],[bx],[xb],[xx],[bxx],[xbx],[xxb],[xxx],[bxxx], [xbxx], [xxbx], [xxxb]} - if we assume that all strings of length smaller than 4 are accepted. In the second case only the state [xxxx] is non-final, in both cases it is a sink state. The states are interpreted as follows, for {[b],[x],[bx],[xb],[xx],[xxx],[bxx],[xbx],[xxb]} it means that the all paths from s 0 to s are described by s, for instance ä(s 0,w)=[xxb] means that w=xxb, where x is either a or c, i.e. w {aab,acb,cab,ccb}. For the states from {[bxxx],[xbxx],[xxbx],[xxxb]}, for instance xxbx means that the last four symbols satisfy the pattern xxbx, where x is either a or c. The state [xxxx] means either that the last 4 symbols do not contain b, or that they contain more than one b. 5
6 The function ä is now quite obvious, for instance ä([xxbx], a) = ä([xxbx],c) = [xbxx], ä([xxbx,b) = [xxxx] (as we assume that [xxxx] also represent [xbbx], see above). Formally: ä a b c s 0 [x] [b] [x] [b] [bx] [xxxx] [xb] [x] [xx] [xb] [xx] [bx] [bxx] [xxxx] [bxx] [xx] [xxx] [xxb] [xxx] [xb] [xbx] [xxxx] [xbx] [bxx] [bxxx] [xxxx] [bxxx] [xbx] [xbxx] [xxxx] [xbxx] [xxb] [xxbx] [xxxx] [xxbx] [xxx] [xxxx] [xxxb] [xxxx] [bxxx] [xxxx] [xxxb] [xxxx] [xbxx] [bxxx] [xxxx] [bxxx] [xxbx] [xbxx] [xxxx] [xbxx] [xxxb] [xxbx] [xxxx] [xxbx] [xxxx] [xxxx] [xxxx] [xxxx] 7.[4] Let L be a regular language that does not contain. Show that there exists an nondeterministic finite state automaton without -moves and with a single final state that accept L. Is the assumption that in not in L essential? Is this also true if we replace non-deterministic by deterministic? [3] Let M be any non-deterministic automaton such that L=L(M). Note that any deterministic automaton can be treated as a special case of a non-deterministic automaton. Intuition is given by the figure below: 6
7 Formal proof. Let M=(Q,,ä,q 0,F). Define M =(Q {q F },,ä,q 0, {q F }), where q F Q. Let S be the following set of states: q S iff a. ä(q,a) F Ø. In other words, from S, one may reach a final state in one step. The mapping ä is defined as follows: for all q Q, all a : ä (q,a) = if q S then ä(q,a) else ä(q,a) {q F }, and ä (q F,a)=Ø. Let x, i.e. x=ya. Hence: x=ya L(M) ä(q 0,ya) F Ø ä(q 0,y) S Ø ä (q 0,y) S Ø q F ä (q 0,ya) x=ya L(M ). [1] Yes, the assumption that the language does not contain the empty string is essential. The results is false if L(M). Consider the automaton below: It accepts/generates the language {,a}. The initial state must be a final state since is accepted. If this is the only final state, and a is accepted than there must be an arrow from this state to itself labelled by a. But then every a k is also accepted, a contradiction. 7
8 8.[6] a.[2] How many different deterministic automata with four states s 0,s 1,s 2,s 3 over the alphabet {a,b}, where s 0 is always the start state, do exist? Prove your answer. b.[2] c.[2] How many different non-deterministic automata (without -moves) with four states s 0,s 1,s 2,s 3 over the alphabet {a,b}, where s 0 is always the start state, do exist? Prove your answer. Note that according to the definition, every deterministic automaton is a special case of a non-deterministic automaton. How many different non-deterministic automata with -moves with four states s 0,s 1,s 2,s 3 over the alphabet {a,b}, where s 0 is always the start state, do exist? Prove your answer. Note that according to the definition, every deterministic automaton is a special case of a non-deterministic automaton, and every nodeterministic automaton without -moves is a special case of a non-deterministic automaton with -moves. a Let [Q Ó Q] be the set of all functions from Q Ó to Q, i.e. [Q Ó Q] = { f f:q Ó Q}. If Q =4, Ó =2, then Q Ó = 8 and [Q Ó Q] = Q Q Ó = 4 8 = Hence we have different ä functions. The number of possible sets of final states is the same as the set all subsets of Q, i.e. 2 Q = 2 4 = 16. Finally: = 1,048,456. b. [Q Ó 2 Q ] = 2 Q Q Ó = 16 8, so the number of automata is =16 9. c. [Q (Ó { } 2 Q ] = 2 Q Q (Ó { } = 16 12, so the number of automata is = [7] For integers n,d 1, consider a deterministic finite automaton M n,d = (Q, Ó, ä, s 0, F), where Q = {s 0, s 1, s 2,..., s n-1 }, Ó = {a 0, a 1, a 2,..., a d-1 }, ä(s i, a k ) = s (di+k) mod n, and F = {s 1 }. a.[1] Draw the transition diagram of M n,d with n=7 and d=2. b.[1] Suppose n=7, d=2, a 0 =0, a 1 =1. Find ä(s 3,0101) and ä(s 1,11010). c.[1] Suppose n=7, d=2, a 0 =0, a 1 =1. Find binary string x and y such that ä(s 0, x) = s 5 and ä(s 0, y) = s 6. d.[4] Show that for any state s j Q, there exists a string x Ó * such that ä(s 0, x) = s j. 8
9 a. One just have to transform the below table into a graph: ä b. From either a table or a graph we conclude: ä(3,0101)=4, ä(1,11010)=2. c. The solution is not unique but either form a table or a graph, one may find that the shortest x and y are: x = 101, and y =110. d. Note that in c above we have ä(0,101) = 5, and 101 is 5 in binary notation, while ä(0,110) = 6, and 110 is 6 in binary notation. The simplest proof is merely based on this observation. Each number can be represented using different representations. In general we may say the number m is represented by a sequence a k...a 1 a 0 where a i = 0,1,...,d-1, if m = a k d k a 1 d + a 0, so some k. We shall denote by (m) d its d-representation. For instance (5) 10 = 5, (5) 2 = 101, (5) 3 = 12. We prove that for each i Q, ä(0, (i) d ) = i, so it suffices to take x = (i) d. Let m be a number and let the string w be its d-representation, i.e. (m) d = w and w {0,1,...,d-1}*. Let a {0,1,...,d-1}. What is the value of xa treated as a number in d- representation? Let t be a number such that (t) d = xa. Note that exactly from the definition of d-representation we have: t = dm+a. Now, let i Q, and (i) d = a k...a 1 a 0. Note that k<i, and (remember Horner scheme?) i = a k d k a 1 d + a 0 = (... ((a k d+a k-1 )d+a k-2 )d a 1 )d+a 0 d) = ä(0,a k...a 1 a 0 ), which ends the proof. 9
10 10.[6] Prove that for every language L: a.[2] L * = (L * ) * b.[2] L + = (L + ) + c.[2] Is (L * ) + = (L + ) * for all sets? Prove your answer. a. There are many proofs. Probably the most simple one looks as follows: Let x be a sequence over the alphabet Ó. Suppose that x is a concatenation of x 1,...,x k, some k, i.e. x = x 1 x 2,...,x k. The strings x i, i=1,...,k, are called factors of x. The notion of a factor simplifies the proof a lot. Every string in (L * ) * is made up of factors from L *. Every factor from L * is made up of factors from L. Therefore, every string in (L * ) * is made up of factors from L. Therefore, every string in (L * ) * is also a string in L *. We can write this as (L * ) * L *. On the other hand we have L L *, since in L * we can choose as a string any factor from L. Hence L * (L * ) *, i.e. L * = (L * ) *. b. Almost identically, the only difference is that the length of a factor is in this case at least one, while for the star factor of length zero were allowed. c. Yes, (L + ) * = (L * ) +. (L + ) * (L * ) * = L *. L L +, so L * (L + ) *, i.e. (L + ) * = L *. On the other hand (L * ) + (L * ) * = L *, L * (L * ) +, so (L * ) + = L *, hence (L + ) * = (L * ) + = L *. There are many other proofs as well. 11.[10]Let L be any language. Define even(w) as the string obtained by extracting from w the letters in even-numbered positions; that is if w = a 1 a 2 a 3 a 4..., then even(w) = a 2 a Corresponding to this, we can define a language even(l) = { even(x) x L }. Prove that if L is regular, so is even(l). Hint. Let M be a deterministic automaton such that L(M) = L. Transform M into an automaton (not necessarily deterministic) that accepts even(l). The trick is to use a Deterministic Finite Automaton for L and modify it so that it remembers if it had read an even or an odd number of symbols. This can be done by doubling the number of states and adding O or E to the labels. For example, if part of the DFA is 10
11 its equivalent becomes Now replace all transitions from an E-state to an O-state by -transitions. The new automaton (non-deterministic with -moves) accepts even(l). Let us now do it formally. Let M=(Q,,ä,s 0,F) be a DFA such that L=L(M). Define M 1 =(Q 1,,ä 1,s 01,F 1 ), where Q 1 = { s E s Q } { s O s Q }, s 01 = s 0E, F 1 = { s E s F } { s O s F }, and ä 1 (s E,a) = q O if and only if ä(s,a)=q, and ä 1 (s O,a) = q E if and only if ä(s,a)=q, for each s Q, a Ó. Clearly L(M 1 )=L(M), however to prove it formally one may use induction. Let M 2 =(Q 1,,ä 2,s 01,F 1 ) be the following non-deterministic automaton with -moves: ä 2 (s O,a) = {ä 1 (s O,a)}, for each s Q, a Ó, and ä 2 (s E, ) = {ä 1 (s E,a)}, for each s Q, a Ó. Again L(M 2 )=L(M 1 ), however a formal proof requires using induction. 12.[3] Let M = (Q, Ó, ä, s 0, F) be a deterministic finite automaton. Give a deterministic finite state automaton M such that L(M ) = L(M) - { }. Let M=(Q,,ä,s 0,F) be a DFA such that L=L(M). If L(M), then M =M. If L(M) then s 0 F. Define M = (Q {q 0 },,ä 1,q 0,F), where q 0 Q, and ä 1 is defined as follows: ä 1 (q 0,a) = ä(s 0,a) for each a Ó, ä 1 (s,a) = ä(s,a) for each s Q. Clearly L(M )=L(M)-{ }. 11
12 13.[3] Let L = {a,b} and L 1 * = L *. Prove that L L 1. First we prove that a L 1. Suppose that a L 1. This means that a L 1*, a contradiction since a L L * = L 1*. Identically we prove b L 1. Thus L L 1. An immediate extension of this result (identical proof!) is: for every alphabet Ó and any language L, if L * = Ó *, then Ó L. 14.[10] Give deterministic and non-deterministic finite automata accepting the following languages over the alphabet {a,b}. Give non-deterministic only if it either has less states or is intuitively simpler. a.[5] The set of all strings of length five or more in which the fourth symbol from the right end is different from the leftmost symbol. b.[5] The set of all strings in which the leftmost two symbols and the rightmost two symbols are identical. a. NFA 12
13 DFA: q ini is initial state. F={ q aaaaa, q aaaba, q aabaa, q aabba, q aaaab, q aaabb, q aabab, q aabbb, q bbaaa, q bbaba, q bbbaa, q bbbba, q bbaab, q bbabb, q bbbab, q bbbbb } a b a b a b a b q ini q a q b q aaaa q aaaaa q aaaab q aaaaa q aaaaa q aaaabb q aaaab q aaaba q aaabb q a q aa q ab q aaab q aaaba q aaabb q aaaba q aabaa q aababb q aaabb q aabba q aabbb q b q ba q bb q aaba q aabaa q aabab q aabaa q abaaa q abaab q aabab q ababa q ababb q aa q aaa q aab q aabb q aabba q aabbb q aabba q abbaa q abbab q aabbb q abbba q abbbb q ab q aba q abb q abaa q abaaa q abaab q abaaa q aaaaa q aaaab q abaab q aaaba q aaabb q ba q baa q bab q abab q ababa q ababb q ababa q aabaa q aabab q ababb q aabba q aabbb q bb q bba q bbb q abba q abbaa q abbab q abbaa q abaaa q abaab q abbab q ababa q ababb q aaa q aaaa q aaab q abbb q abbba q abbbb q abbba q abbaa q abbab q abbbb q abbba q abbbb q aab q aaba q aabb q baaa q baaaa q baaab q baaaa q baaaa q baaab q baaab q baaba q baabb q aba q abaa q abab q baab q baaba q baabb q baaba q babaa q babab q baabb q babba q babbb q abb q abba q abbb q baba q babaa q babab q babaa q bbaaa q bbaab q babab q bbaba q bbabb q baa q baaa q baab q babb q babba q babbb q babba q bbbaa q bbbab q babbb q bbbba q bbbbb q bab q baba q babb q bbaa q bbaaa q bbaab q bbaaa q baaaa q baaab q bbaab q baaba q baabb q bba q bbaa q bbab q bbab q bbaba q bbabb q bbaba q babaa q babab q bbabb q babba q babbb q bbb q bbba q bbbb q bbba q bbbaa q bbbab q bbbaa q bbaaa q bbaab q bbbab q bbaba q bbabb q bbbb q bbbba q bbbbb q bbbba q bbbaa q bbbab q bbbbb q bbbba q bbbbb b. DFA q ini is initial state. F={ q aa, q ab, q ba, q bb, q aaa, q bbb, q aaaa, q abab, q baba, q bbbb } a b a b q ini q a q b q aaaa q aaaa q aaab q a q aa q ab q aaab q aaba q aabb q b q ba q bb q aaba q aaaa q aaab q aa q aaa q aab q aabb q aaba q aabb q ab q aba q abb q abaa q abaa q abab q ba q baa q bab q abab q abba q abbb q bb q bba q bbb q abba q abaa q abab q aaa q aaaa q aaab q abbb q abba q abbb q aab q aaba q aabb q baaa q baaa q baab q aba q abaa q abab q baab q baba q babb q abb q abba q abbb q baba q baaa q baab q baa q baaa q baab q babb q baba q babb q bab q baba q babb q bbaa q bbaa q bbab q bba q bbaa q bbab q bbab q bbba q bbbb q bbb q bbba q bbbb q bbba q bbaa q bbab q bbbb q bbba q bbbb 13
14 Note, DFAs for part (a) and (b) above may not be the minimal ones. However, they give clearer intuitive meaning. 15.[10] Consider the automaton below. Construct an equivalent regular expression using the algorithm discussed in class. 14
15 16.[6] Consider the following regular expression: a*b* (a*bb ab*)a*b. a.[2] Using a standard construction construct an equivalent non-deterministic finite state automaton with -moves. b.[2] Transform the automaton from 3a into an equivalent non-deterministic finite state automaton without -moves. c. [2] Transform the automaton from 3b into an equivalent deterministic finite state automaton. Solutions: 15
16 a. Q={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22}, initial_state=1, F={22}, ={a,b}, and is defined below a b 1 {2,8} 2 {3} {4} 3 {2} 4 {5} {22} 5 {4} 6 {7} {9} 7 {6} 8 {6,11} 9 {10} 10 {13} 11 {12} 12 {14} 13 {15} 14 {16} {17} 15 {17} 16 {14} 17 {18} 18 {19} {20} 19 {18} 20 {21} 21 {22} 22 b. Q={1,2,3,4,5,6,7,8,9}, initial_state=1, F={1,2,4,6,9}, and is defined below a b 1 {2,7} {3} 2 {2} {3,4} 3 {5} 4 {4} 5 {5} {6} 6 7 {8} {7,9} 8 {8} {9} 9 16
17 c. Q={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19}, initial_state=1, F={1,2,4,5,6,9,10,12,13,14,15,17,18}, ={a,b}, garbage=19 and is defined below a b [5] Consider the automaton below. Construct an equivalent regular expression without using any formal technique, by just analysing the structure of automaton. Provide some arguments why your reasoning is correct. 17
18 There are many solutions. Here is a possible one. Let s denote the initial state, p denote the second final state, and q denote the only non-final state, Q be a regular expression that corresponds to the automaton derived by erasing the state s and making q initial. Clearly Q = (a ba)*b. Let S be a regular expression describing strings starting from s and ending at s, while P be a the language built from all regular expression describing the language built from all strings starting from s and ending at p. Then the language L = S P, S = (a bqb)*. Let T be a regular expression describing the language built from all the strings that start with s and ending at p but not going thorough s. Clearly T= a*b(a ba)*b and P = S*P. Hence L = (a b(a ba)*bb)* (a b(a ba)*bb)*a*b(a ba)*b. Again, this is not the only solution. 18.[8] Consider the following regular expression: (a b*)(((ba)* bb*b)* a)*b. a.[2] Using a standard construction construct an equivalent non-deterministic finite state automaton with -moves. b.[3] Transform the automaton from 18a into an equivalent non-deterministic finite state automaton without -moves. c.[3] Transform the automaton from 18b into an equivalent deterministic finite state automaton. First note that (a b*)(((ba)* bb*b)* a)*b = (a b*)(ba bb*b a)*b since (r* s)*=(r s)* This simplifies automata a little. 18
19 a. Q={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22}, initial_state=1, F={15}, ={a,b}, and is defined below a b 1 {2,3} 2 {5} 3 {4} {6} 4 {3} 5 {6} 6 {7} 7 {8,9,10,11} 8 {12} 9 {13} 10 {14} 11 {15} 12 {16} 13 {17} 14 {22} {19} 17 {18} {20} 18 {17} 19 {22} 20 {21} 21 {22} 22 b. Q={1,2,3,4,5,6}, initial_state=1, F={3}, and is defined below a b 1 {2,5} {2,3,4,6} 2 {5} {2,3,4,6} 3 4 {5} 5 {5} {3,4,6} 6 {5,6} 19
20 c. Q={1,2,3,4,5,6,7,8}, initial_state=1, F={3,5,6,8}, and is defined below a b [5] Consider the following regular expression (abab)* (aaa* b)*. Find an equivalent deterministic finite state automaton using whatever reasoning you wish. Provide some justification or proof. A possible solution is the following. By observing that aaa* = aa*a, it is rather easy to built deterministic automata defining (abab)* and (aa*a b)*. Then we can construct a non-deterministic automaton with -moves accepting the union of two languages. In principle we only need to add a new initial state and connect it with old two initial states by labelled arrows. Erasing these two labelled arrows is also easy, it does not increase the number of states. Then we have to get rid of non-determinism. A possible DFA looks as follows. Q={1,2,3,4,5,6,7,8,9,10,11}, initial_state=1, F={1,5,7,8,9}, garbage-state=11 and is defined below a b
21 20.[6] Let r and s be regular expressions. a.[3] Prove that : (r* s)* = ((r*s*)* r)* where the equality = above is understood as L((r* s)*) = L(((r*s*)* r)*). b.[3] Show that there are such s and r that : r*(r s)* (r s)*. a. There are many solutions. Below there is a possible one. We will use the following rules: (r s)*=(r*s*)*, (r*)*=r* for every regular expressions r and s. (r* s)* = ((r*)*s*)* = (r*s*)* = (r s)* ((r*s*)* r)*=(r*s* r)*=((r*s*)*s*)*=((r s)*r*)*=(r s r)*=(r s)* b. It cannot be shown since r*(r s)*=(r s)*. Clearly r*(r s)* (r s)*. But (r s)* = (r s)* r*(r s)*, as r*. 21.[5] Give a deterministic finite state automaton that accepts the language: L(ab*a*) L(a*b*a) Method 1. L 1 L 2 = S* - (( * - L 1 ) ( * - L 2 )). So we can construct automata accepting ab*a* and a*b*a, and then those accepting * - L 1 and * - L 2 (this is easy, just replace final with non-final states), then an automaton accepting ( * - L 1 ) ( * - L 2 ), and finally, by reversing final and non-final states again * - (( * - L 1 ) ( * - L 2 )). The solution can then be simplified. Method 2. First we construct DFA accepting ab*a* and a*b*a, and then we construct directly a product automata that accept the intersection. Method 3. Let x L 1 L 2. We have to consider two cases. Case 1. x contains more than one b. Then, since x L 1, there is one a before all b s, and, since x L 2, there is one a after all b s. Hence: x abb*a. Case 2. X contains no b at all. Then x aa*. In short: L 1 L 2 = abb*a aa*. A possible automaton is the following. Q={1,2,3,4,5,6}, initial_state=1, F={2,3,6}, garbage_state=4 and is defined below 21
22 a b [12] Consider the program: z:=0; t:=0; while x>0 do begin x:=x-1; z:=z*y; t:=t+1 end where x and y are integers. Using the same technique we used in class for factorial, prove that the above program is equivalent to begin z:=y x ; t:=x; x:=0; end Note that we must assume that x is non-negative, otherwise the two programs are not equivalent. Let N denote the set of integers, N + ={0,1,2,3,...} and let P, P=, F, G, H be the following functions (interpreted as relations) from N + N N N to N + N N N: P(x,y,z,t) = if x>0 then (x,y,z,t) else undefined P=(x,y,z,t) = if x 0 then (x,y,z,t) else undefined Q(x,y,z,) F 1 (x,y,z,t) = (x,y,1,t) F 2 (x,y,z,t) = (x,y,z,0) G 1 (x,y,z,t) = (x,y,z,t+1) G 2 (x,y,z,t) = (x-1,y,z,t) H(x,y,z,t) = (x,y,z*y,t) Our program may now be modelled by the following regular expression over the domain of relations. F 1 F 2 (P G 1 G 2 H)* P=. Let us calculate the relation (P G 1 G 2 H)* P=. First notice that P G 1 G 2 H (composition as for the relations) can be described as follows: P G 1 G 2 H(x,y,z,t) = if x>0 then (x-1,y,z*y,t+1) else undefined. This means that for every k 0, we have: (P G 1 G 2 H) k (x,y,z,t) = if x>k-1 then (x-k,y,z*y^k, k) else undefined. Every (P G 1 G 2 H) k is a function, but (P G 1 G 2 H) * is not! The relation (P G 1 G 2 H) * is defined as follows: 22
23 (x,y,z,t) (P G 1 G 2 H) * (x=,y=,z=,t=) ( k. x>k-1 x==x-k y==y z==z*y^k t==k) (x=x= y=y= z=z= t==t) Hence we may write: (x,y,z,t) (P G 1 G 2 H) * (x=,y=,z=,t=) P= (x@,y@,z@,t@) ( k. x>k-1 x==x-k y==y z==z*y^k t==k x@=x= x@ 0 y@=y= z@=z= t@=t=) (x=x==x@ y=y==y@ z=z==z@ t=t==t@ x@ 0) {note that x>k-1 x==x-k x@=x= x@ 0 implies x>k=1 x-k 0, so x=k} (x 0 x=x@ y=y@ z=z@ t=t@) (x>0 x@=0 y@=y z@=z*y^x t@=x) This means that (P G 1 G 2 H)* P= is a function and (P G 1 G 2 H)* P=(x,y,z,t) = if x>0 then (0,y,z*y^x,x) else (x,y,z,t) i.e. F 1 F 2 (P G 1 G 2 H)* P=(x,y,z,t) = (0,y,y^x, x) for all integers x,y,z,t such that x 0. 23
Chapter 4. Regular Expressions. 4.1 Some Definitions
Chapter 4 Regular Expressions 4.1 Some Definitions Definition: If S and T are sets of strings of letters (whether they are finite or infinite sets), we define the product set of strings of letters to be
More informationAuthor: Vivek Kulkarni ( )
Author: Vivek Kulkarni ( vivek_kulkarni@yahoo.com ) Chapter-3: Regular Expressions Solutions for Review Questions @ Oxford University Press 2013. All rights reserved. 1 Q.1 Define the following and give
More informationUsing bases to simplify asymptotic expansions
1 Using bases to simplify asymptotic expansions Matthias Kawski 1 Amit Sanyal 2 1 Department of Mathematics and Statistics Arizona State University 2 Department of Mechanical and Aerospace Engineering
More informationRecap from Last Time
Regular Expressions Recap from Last Time Regular Languages A language L is a regular language if there is a DFA D such that L( D) = L. Theorem: The following are equivalent: L is a regular language. There
More informationIn English, there are at least three different types of entities: letters, words, sentences.
Chapter 2 Languages 2.1 Introduction In English, there are at least three different types of entities: letters, words, sentences. letters are from a finite alphabet { a, b, c,..., z } words are made up
More informationDeciding Representability of Sets of Words of Equal Length
Deciding Representability of Sets of Words of Equal Length F. Blanchet-Sadri 1 Sean Simmons 2 November 24, 2012 Abstract Partial words are sequences over a finite alphabet that may have holes that match,
More informationThe Binomial Theorem.
The Binomial Theorem RajeshRathod42@gmail.com The Problem Evaluate (A+B) N as a polynomial in powers of A and B Where N is a positive integer A and B are numbers Example: (A+B) 5 = A 5 +5A 4 B+10A 3 B
More informationCSCI 340: Computational Models. Regular Expressions. Department of Computer Science
CSCI 340: Computational Models Regular Expressions Chapter 4 Department of Computer Science Yet Another New Method for Defining Languages Given the Language: L 1 = {x n for n = 1 2 3...} We could easily
More informationFABER Formal Languages, Automata. Lecture 2. Mälardalen University
CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 2 Mälardalen University 2010 1 Content Languages, g Alphabets and Strings Strings & String Operations Languages & Language Operations
More informationAutomata Theory CS F-04 Non-Determinisitic Finite Automata
Automata Theory CS411-2015F-04 Non-Determinisitic Finite Automata David Galles Department of Computer Science University of San Francisco 04-0: Non-Determinism A Deterministic Finite Automata s transition
More informationcse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska
cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska LECTURE 5 CHAPTER 2 FINITE AUTOMATA 1. Deterministic Finite Automata DFA 2. Nondeterministic Finite Automata NDFA 3. Finite Automata
More informationA canonical semi-deterministic transducer
A canonical semi-deterministic transducer Achilles A. Beros Joint work with Colin de la Higuera Laboratoire d Informatique de Nantes Atlantique, Université de Nantes September 18, 2014 The Results There
More informationCS Automata, Computability and Formal Languages
Automata, Computability and Formal Languages Luc Longpré faculty.utep.edu/longpre 1 - Pg 1 Slides : version 3.1 version 1 A. Tapp version 2 P. McKenzie, L. Longpré version 2.1 D. Gehl version 2.2 M. Csűrös,
More informationdownload instant at Assume that (w R ) R = w for all strings w Σ of length n or less.
Chapter 2 Languages 3. We prove, by induction on the length of the string, that w = (w R ) R for every string w Σ. Basis: The basis consists of the null string. In this case, (λ R ) R = (λ) R = λ as desired.
More informationAutomata: a short introduction
ILIAS, University of Luxembourg Discrete Mathematics II May 2012 What is a computer? Real computers are complicated; We abstract up to an essential model of computation; We begin with the simplest possible
More informationO C C W S M N N Z C Z Y D D C T N P C G O M P C O S B V Y B C S E E K O U T T H E H I D D E N T R E A S U R E S O F L I F E
Timed question: I VISUALIZE A TIME WHEN WE WILL BE TO ROBOTS WHAT DOGS ARE TO HUMANS. AND I AM ROOTING FOR THE MACHINES. 1) S E E K O U T T H E H I D D E N T R E A S U R E S O F L I F E Here s how we get
More informationAutomata Theory CS F-08 Context-Free Grammars
Automata Theory CS411-2015F-08 Context-Free Grammars David Galles Department of Computer Science University of San Francisco 08-0: Context-Free Grammars Set of Terminals (Σ) Set of Non-Terminals Set of
More 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 informationRegular Expressions [1] Regular Expressions. Regular expressions can be seen as a system of notations for denoting ɛ-nfa
Regular Expressions [1] Regular Expressions Regular expressions can be seen as a system of notations for denoting ɛ-nfa They form an algebraic representation of ɛ-nfa algebraic : expressions with equations
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 informationCS6902 Theory of Computation and Algorithms
CS6902 Theory of Computation and Algorithms Any mechanically (automatically) discretely computation of problem solving contains at least three components: - problem description - computational tool - procedure/analysis
More informationTheory of Computation
Fall 2002 (YEN) Theory of Computation Midterm Exam. Name:... I.D.#:... 1. (30 pts) True or false (mark O for true ; X for false ). (Score=Max{0, Right- 1 2 Wrong}.) (1) X... If L 1 is regular and L 2 L
More informationThe Pumping Lemma (cont.) 2IT70 Finite Automata and Process Theory
The Pumping Lemma (cont.) 2IT70 Finite Automata and Process Theory Technische Universiteit Eindhoven May 4, 2016 The Pumping Lemma theorem if L Σ is a regular language then m > 0 : w L, w m : x,y,z : w
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 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 informationTheory of Computation (Classroom Practice Booklet Solutions)
Theory of Computation (Classroom Practice Booklet Solutions) 1. Finite Automata & Regular Sets 01. Ans: (a) & (c) Sol: (a) The reversal of a regular set is regular as the reversal of a regular expression
More informationFinite Automata and Regular Languages
Finite Automata and Regular Languages Topics to be covered in Chapters 1-4 include: deterministic vs. nondeterministic FA, regular expressions, one-way vs. two-way FA, minimization, pumping lemma for regular
More informationGEETANJALI INSTITUTE OF TECHNICAL STUDIES, UDAIPUR I
GEETANJALI INSTITUTE OF TECHNICAL STUDIES, UDAIPUR I Internal Examination 2017-18 B.Tech III Year VI Semester Sub: Theory of Computation (6CS3A) Time: 1 Hour 30 min. Max Marks: 40 Note: Attempt all three
More informationTAFL 1 (ECS-403) Unit- IV. 4.1 Push Down Automata. 4.2 The Formal Definition of Pushdown Automata. EXAMPLES for PDA. 4.3 The languages of PDA
TAFL 1 (ECS-403) Unit- IV 4.1 Push Down Automata 4.2 The Formal Definition of Pushdown Automata EXAMPLES for PDA 4.3 The languages of PDA 4.3.1 Acceptance by final state 4.3.2 Acceptance by empty stack
More informationcse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska
cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska LECTURE 6a REVIEW for Q2 Q2 covers Lecture 5 and Lecture 6 Chapter 2 - Deterministic Finite Automata DFA Chapter 2 - Nondeterministic
More informationComputational Learning Theory Learning Patterns (Monomials)
Computational Learning Theory Learning Patterns (Monomials) Akihiro Yamamoto 山本章博 http://www.iip.ist.i.kyoto-u.ac.jp/member/akihiro/ akihiro@i.kyoto-u.ac.jp 1 Formal Languages : a finite set of symbols
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 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 informationLecture 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 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 informationcse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska
cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska LECTURE 14 SMALL REVIEW FOR FINAL SOME Y/N QUESTIONS Q1 Given Σ =, there is L over Σ Yes: = {e} and L = {e} Σ Q2 There are uncountably
More 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 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 informationThe following tables might be useful during the event.
The following tables might be useful during the event. A B C D E F G H I J K L M N O P Q R S T U V W X Y Z A A B C D E F G H I J K L M N O P Q R S T U V W X Y Z B B C D E F G H I J K L M N O P Q R S T
More informationCSE 468, Fall 2006 Homework solutions 1
CSE 468, Fall 2006 Homework solutions 1 Homework 1 Problem 1. (a) To accept digit strings that contain 481: Q ={λ,4,48, 481}, Σ ={0,1,...,9}, q 0 = λ, A ={481}. To define δ, weuse a for all letters (well,
More informationPushdown Automata. Reading: Chapter 6
Pushdown Automata Reading: Chapter 6 1 Pushdown Automata (PDA) Informally: A PDA is an NFA-ε with a infinite stack. Transitions are modified to accommodate stack operations. Questions: What is a stack?
More informationAn automaton with a finite number of states is called a Finite Automaton (FA) or Finite State Machine (FSM).
Automata The term "Automata" is derived from the Greek word "αὐτόματα" which means "self-acting". An automaton (Automata in plural) is an abstract self-propelled computing device which follows a predetermined
More informationTAFL 1 (ECS-403) Unit- II. 2.1 Regular Expression: The Operators of Regular Expressions: Building Regular Expressions
TAFL 1 (ECS-403) Unit- II 2.1 Regular Expression: 2.1.1 The Operators of Regular Expressions: 2.1.2 Building Regular Expressions 2.1.3 Precedence of Regular-Expression Operators 2.1.4 Algebraic laws for
More 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 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 informationStream Codes. 6.1 The guessing game
About Chapter 6 Before reading Chapter 6, you should have read the previous chapter and worked on most of the exercises in it. We ll also make use of some Bayesian modelling ideas that arrived in the vicinity
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 informationHW 3 Solutions. Tommy November 27, 2012
HW 3 Solutions Tommy November 27, 2012 5.1.1 (a) Online solution: S 0S1 ɛ. (b) Similar to online solution: S AY XC A aa ɛ b ɛ C cc ɛ X axb aa b Y by c b cc (c) S X A A A V AV a V V b V a b X V V X V (d)
More informationFinite Automata. Warren McCulloch ( ) and Walter Pitts ( )
2 C H A P T E R Finite Automata Warren McCulloch (898 968) and Walter Pitts (923 969) Warren S. McCulloch was an American psychiatrist and neurophysiologist who co-founded Cybernetics. His greatest contributions
More informationFLAC Context-Free Grammars
FLAC Context-Free Grammars Klaus Sutner Carnegie Mellon Universality Fall 2017 1 Generating Languages Properties of CFLs Generation vs. Recognition 3 Turing machines can be used to check membership in
More informationSupplementary Examples for
Supplementary Examples for Infinite Interval Exchange Transformations from Shifts ([LN15]) Luis-Miguel Lopez Philippe Narbel Version 1.0, April, 2016 Contents A The Shifted Intervals Preservation (Lemma
More informationClosure Properties of Regular Languages
Closure Properties of Regular Languages Lecture 13 Section 4.1 Robb T. Koether Hampden-Sydney College Wed, Sep 21, 2016 Robb T. Koether (Hampden-Sydney College) Closure Properties of Regular Languages
More informationCS 133 : Automata Theory and Computability
CS 133 : Automata Theory and Computability Lecture Slides 1 Regular Languages and Finite Automata Nestine Hope S. Hernandez Algorithms and Complexity Laboratory Department of Computer Science University
More informationChapter-6 Regular Expressions
Regular Expression (RE) ATC-Module-2- Dr.Girijamma H A Chapter-6 Regular Expressions A RE is a string that can be formed according to the following rules: 1. ø is a RE. 2. ε is a RE. 3. Every element in
More informationAutomata Theory for Presburger Arithmetic Logic
Automata Theory for Presburger Arithmetic Logic References from Introduction to Automata Theory, Languages & Computation and Constraints in Computational Logic Theory & Application Presented by Masood
More informationacs-04: Regular Languages Regular Languages Andreas Karwath & Malte Helmert Informatik Theorie II (A) WS2009/10
Regular Languages Andreas Karwath & Malte Helmert 1 Overview Deterministic finite automata Regular languages Nondeterministic finite automata Closure operations Regular expressions Nonregular languages
More informationAutomata, Computability and Complexity with Applications Exercises in the Book Solutions Elaine Rich
Automata, Computability and Complexity with Applications Exercises in the Book Solutions Elaine Rich Part I: Introduction 1 Why Study Automata Theory? 2 Languages and Strings 1) Consider the language L
More information1.[3] Give an unambiguous grammar that generates the set of all regular expressions on Ó = {a,b}. Justify your construction.
CAS 705. Sample solutions to the assignment 2 (many questions have more than one solutions). Total of this assignment is 135 pts. Each assignment is worth 25%. 1.[3] Give an unambiguous grammar that generates
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 informationContext 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 informationNondeterministic Finite Automata and Regular Expressions
Nondeterministic Finite Automata and Regular Expressions CS 2800: Discrete Structures, Spring 2015 Sid Chaudhuri Recap: Deterministic Finite Automaton A DFA is a 5-tuple M = (Q, Σ, δ, q 0, F) Q is a finite
More informationFinite State Machines. Languages g and Machines
Finite State Machines Chapter 5 Languages g and Machines Regular Languages g L Regular Language Regular Expression Accepts Finite State Machine Finite State Machines An FSM to accept $.50 in change: Definition
More informationF G J F M K P C H D V P T H Z M T U C F M X Q P G Z C Q P O F M Y I F W I N T E R C O M E S C A N S P R I N G B E F A R B E H I N D
Timed question: WHAT GOOD IS THE WARTH OF SUER, WITHOUT THE COLD OF WINTER TO GIVE IT SWEETNESS. KTHX JCCB PG XTD KHUVXT CR GVVDU, KPXTCX XTD ZCIB WHAT GOOD IS THE WARTH OF SUER, WITHOUT THE COLD CR KPOXDU
More informationSFWR ENG 2FA3. Solution to the Assignment #4
SFWR ENG 2FA3. Solution to the Assignment #4 Total = 131, 100%= 115 The solutions below are often very detailed on purpose. Such level of details is not required from students solutions. Some questions
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 informationFinite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018
Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Lecture 14 Ana Bove May 14th 2018 Recap: Context-free Grammars Simplification of grammars: Elimination of ǫ-productions; Elimination of
More informationFormal Languages and Automata
Formal Languages and Automata 5 lectures for 2016-17 Computer Science Tripos Part IA Discrete Mathematics by Ian Leslie c 2014,2015 AM Pitts; 2016,2017 IM Leslie (minor tweaks) What is this course about?
More informationChapter 1. Formal Definition and View. Lecture Formal Pushdown Automata on the 28th April 2009
Chapter 1 Formal and View Lecture on the 28th April 2009 Formal of PA Faculty of Information Technology Brno University of Technology 1.1 Aim of the Lecture 1 Define pushdown automaton in a formal way
More informationFORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
15-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY REVIEW for MIDTERM 1 THURSDAY Feb 6 Midterm 1 will cover everything we have seen so far The PROBLEMS will be from Sipser, Chapters 1, 2, 3 It will be
More informationFinite-State Machines (Automata) lecture 12
Finite-State Machines (Automata) lecture 12 cl a simple form of computation used widely one way to find patterns 1 A current D B A B C D B C D A C next 2 Application Fields Industry real-time control,
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 informationAutomata Theory Final Exam Solution 08:10-10:00 am Friday, June 13, 2008
Automata Theory Final Exam Solution 08:10-10:00 am Friday, June 13, 2008 Name: ID #: This is a Close Book examination. Only an A4 cheating sheet belonging to you is acceptable. You can write your answers
More informationBefore 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 informationSection 1 (closed-book) Total points 30
CS 454 Theory of Computation Fall 2011 Section 1 (closed-book) Total points 30 1. Which of the following are true? (a) a PDA can always be converted to an equivalent PDA that at each step pops or pushes
More informationFormal Languages, Automata and Models of Computation
CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2011 1 Content - More Properties of Regular Languages (RL)
More information60-354, Theory of Computation Fall Asish Mukhopadhyay School of Computer Science University of Windsor
60-354, Theory of Computation Fall 2013 Asish Mukhopadhyay School of Computer Science University of Windsor Pushdown Automata (PDA) PDA = ε-nfa + stack Acceptance ε-nfa enters a final state or Stack is
More informationCS 410/610, MTH 410/610 Theoretical Foundations of Computing
CS 410/610, MTH 410/610 Theoretical Foundations of Computing Fall Quarter 2010 Slides 2 Pascal Hitzler Kno.e.sis Center Wright State University, Dayton, OH http://www.knoesis.org/pascal/ CS410/610 MTH410/610
More informationCS311 Computational Structures Regular Languages and Regular Expressions. Lecture 4. Andrew P. Black Andrew Tolmach
CS311 Computational Structures Regular Languages and Regular Expressions Lecture 4 Andrew P. Black Andrew Tolmach 1 Expressions Weʼre used to using expressions to describe mathematical objects Example:
More informationAutomata Theory and Formal Grammars: Lecture 1
Automata Theory and Formal Grammars: Lecture 1 Sets, Languages, Logic Automata Theory and Formal Grammars: Lecture 1 p.1/72 Sets, Languages, Logic Today Course Overview Administrivia Sets Theory (Review?)
More informationCS A Term 2009: Foundations of Computer Science. Homework 2. By Li Feng, Shweta Srivastava, and Carolina Ruiz.
CS3133 - A Term 2009: Foundations of Computer Science Prof. Carolina Ruiz Homework 2 WPI By Li Feng, Shweta Srivastava, and Carolina Ruiz Chapter 4 Problem 1: (10 Points) Exercise 4.3 Solution 1: S is
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 informationTheory of Computation
Theory of Computation Lecture #2 Sarmad Abbasi Virtual University Sarmad Abbasi (Virtual University) Theory of Computation 1 / 1 Lecture 2: Overview Recall some basic definitions from Automata Theory.
More informationPushdown automata. Twan van Laarhoven. Institute for Computing and Information Sciences Intelligent Systems Radboud University Nijmegen
Pushdown automata Twan van Laarhoven Institute for Computing and Information Sciences Intelligent Systems Version: fall 2014 T. van Laarhoven Version: fall 2014 Formal Languages, Grammars and Automata
More informationSection 1.3 Ordered Structures
Section 1.3 Ordered Structures Tuples Have order and can have repetitions. (6,7,6) is a 3-tuple () is the empty tuple A 2-tuple is called a pair and a 3-tuple is called a triple. We write (x 1,, x n )
More informationLecture 11 Context-Free Languages
Lecture 11 Context-Free Languages COT 4420 Theory of Computation Chapter 5 Context-Free Languages n { a b : n n { ww } 0} R Regular Languages a *b* ( a + b) * Example 1 G = ({S}, {a, b}, S, P) Derivations:
More informationMore 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 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 informationComputational Learning Theory Regular Expression vs. Monomilas
Computational Learning Theory Regular Expression vs. Monomilas Akihiro Yamamoto 山本章博 http://www.iip.ist.i.kyoto-u.ac.jp/member/akihiro/ akihiro@i.kyoto-u.ac.jp 1 Contents What about a regular expressions?
More information6.4 Binomial Coefficients
64 Bioial Coefficiets Pascal s Forula Pascal s forula, aed after the seveteeth-cetury Frech atheaticia ad philosopher Blaise Pascal, is oe of the ost faous ad useful i cobiatorics (which is the foral ter
More informationConcordia University Department of Computer Science & Software Engineering
Concordia University Department of Computer Science & Software Engineering COMP 335/4 Theoretical Computer Science Winter 2015 Assignment 3 1. In each case, what language is generated by CFG s below. Justify
More informationUNIT-I. Strings, Alphabets, Language and Operations
UNIT-I Strings, Alphabets, Language and Operations Strings of characters are fundamental building blocks in computer science. Alphabet is defined as a non empty finite set or nonempty set of symbols. The
More informationOutline. Nondetermistic Finite Automata. Transition diagrams. A finite automaton is a 5-tuple (Q, Σ,δ,q 0,F)
Outline Nondeterminism Regular expressions Elementary reductions http://www.cs.caltech.edu/~cs20/a October 8, 2002 1 Determistic Finite Automata A finite automaton is a 5-tuple (Q, Σ,δ,q 0,F) Q is a finite
More informationTAFL 1 (ECS-403) Unit- III. 3.1 Definition of CFG (Context Free Grammar) and problems. 3.2 Derivation. 3.3 Ambiguity in Grammar
TAFL 1 (ECS-403) Unit- III 3.1 Definition of CFG (Context Free Grammar) and problems 3.2 Derivation 3.3 Ambiguity in Grammar 3.3.1 Inherent Ambiguity 3.3.2 Ambiguous to Unambiguous CFG 3.4 Simplification
More informationFinite Automata. BİL405 - Automata Theory and Formal Languages 1
Finite Automata BİL405 - Automata Theory and Formal Languages 1 Deterministic Finite Automata (DFA) A Deterministic Finite Automata (DFA) is a quintuple A = (Q,,, q 0, F) 1. Q is a finite set of states
More informationCompiler Design 1. LR Parsing. Goutam Biswas. Lect 7
Compiler Design 1 LR Parsing Compiler Design 2 LR(0) Parsing An LR(0) parser can take shift-reduce decisions entirely on the basis of the states of LR(0) automaton a of the grammar. Consider the following
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 informationLecture 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 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 informationSturmian Words, Sturmian Trees and Sturmian Graphs
Sturmian Words, Sturmian Trees and Sturmian Graphs A Survey of Some Recent Results Jean Berstel Institut Gaspard-Monge, Université Paris-Est CAI 2007, Thessaloniki Jean Berstel (IGM) Survey on Sturm CAI
More informationPS2 - 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