• Home
  • Queen's University
  • Software Specifications
  • Language Operations and State-Transition Diagrams

Language Operations and State-Transition Diagrams

CISC/CMPE 223 - Assignment 1 (Winter 2022) Due: Thursday January 27, 2:00 PM (Kingston time) Regulations on assignments · The assignments are graded according to the correctness, preciseness and legibility of the solutions. All handwritten parts, including figures, should be clear and legible. This assignment is marked out of 20 possible marks. . Please submit your solution in onQ before the due time. The submission must be in one of formats: . PDF, .JPG, .PNG, .DOCX. . The assignment must be based on individual work. Copying solutions from other students is a violation of academic integrity. See the course onQ site for more information. 1. (2 marks) Let ? = {0, 1} and consider languages A = {01, 00, 1}, B = {10, 11, 0}. (a) Write down all strings in the set A . B. How many strings there are in A . B? (b) Write down all strings in the set B . A. How many string there are in B . A? 2. (3 marks) In this question the alphabet is > = {0,1}. Let R = (00 + 10*1)* and S = (10*1 + 0*10*) *. (a) Give two examples of a string z that is both in R and in S (that is, z E Rn S). (b) If possible, give two examples of a string x that is in R and is not in S (that is, x E Rn S where S is the complement of S). If no such strings exist, write "Rn S does not have two strings". (c) If possible, give two examples of a string y that is in S and is not in R (that is, y E Rn S). If no such strings exist, write "Rn S does not have two strings". In each case briefly explain (using natural language) why your example strings have the required property. 3. (5 marks) Show how to define the following languages over ? = {0, 1} using only E, the alphabet symbols 0 and 1, and the operations of union, concatenation, and closure. Note: Your answer cannot use the intersection or complementation operation. Below "or" always means "inclusive or". (a) All strings that have both 000 and 111 as a substring. (b) All strings that have 0000 or 1111 as a substring. (c) All strings that both begin and end with 0110. (Note that the prefix 0110 and the suffix 0110 may overlap.) (d) All strings that do not have 111 as a substring. (e) All strings that have even length and, at the same time, have 010 as a substring. 4. (2 marks) Let 2 = {a, b} and consider the state-transition diagram given in Figure 1. a b A a B b a b C Figure 1: State-transition diagram for Question 4. (a) Give examples of three strings that are accepted by the state diagram and examples of three strings that are not accepted by the state diagram. (b) Write out explicitly the transition table (or transition function)