• Home
  • Queen's University
  • Software Specifications
  • State Diagrams and Regular Expressions in Automata Theory

State Diagrams and Regular Expressions in Automata Theory

CISC/CMPE 223 - Assignment 2 Solutions Winter 2022 1. Question 1 solution: The initial steps of the algorithm constucting the state diagram for 01* + 10 are depicted in Figure 1. The last two steps of the algorithm constructing the state diagram for (01* + 10)*1* are depicted in Figure 2. a) 0 0 b) 1 1 c) 10 1 0 from b) and a) ? d) 1* 1 from b) ? 0 ? 1 from a) and d) e) 01* 1 ? 1 0 ? ? from e) and c) 1 0 f) 01* + 10 Figure 1: Steps constructing the state diagram for 01* + 10. 2. Question 2 solution: The state diagram has exactly one accepting state which is not the starting state. Hence no initial modification of the state diagram is needed. The result of eliminating the state 2 (that is not starting state or accepting state) is given in Figure 3. The resulting regular expression obtained from this figure is (bd*c)*bd*a(c+ bd*a + (a + bd*c) (bd*c)*bd*a)* Winter 2022 CISC/CMPE 223 - Assignment 2 Solutions 3. Question 3 solution: (a) The language A is denoted by the regular expression (a2)*b(b3) *~ 3c* + b(b3)*c4(c2)*d(d5)* (b) We prove that the language B is not regular: Assume to the contrary that B is regular and let n be the constant given by the pumping lemma (n is the "pumping length"). Consider the string x = d21 30 13 . 15 a3 € B. (The string x is naturally just d2nc3nb8 a3. The above description is intended to make it clear that x is in B.) The string x has length greater than n and hence x can be split into three parts x = p . q . r where the parts p, q, r satisfy the conditions given in the pumping lemma. According to the pumping lemma, |pq| ? n and q + E. Since pq is a prefix of x, it follows that pq is a prefix of den and this means that q = d2 for some z ? 1. According to the pumping lemma, the string pq2r should be in B. However, pq2r = d2n+2c3nb8 a3. Since z > 1, this means that the ratio of the numbers of occurrences of symbols d and c in p . q2 . r is not 2 : 3. Thus p . q2 . r & B which is a contradiction. The assumption that B is regular leads to a contradiction, and we have proved that B is not regular. 4. Question 4 solution: · Stage 0: At the beginning we mark as distinguishable each pair where one component is a final state and the other component is a non-final state. Altogether four pairs are marked. These are indicated by a 0 in Figure 4. · Stage 1: - Consider (A, B): Symbol b takes A to C and B to E and the pair (C, E) is marked in stage 0. Mark (A, B). (Note: