It represents any string consisting of a substring with no aa followed by one b followed by a substring with no bb. ( a + ab ) * represents strings which do not contain any substring bb. Solution: ( b + ab ) * represents strings which do not contain any substring aa and which end in b, and 12: Describe as simply as possible in English the language corresponding to the regular expression Is a natural number, the given regular expression represents the strings of length 3n and 3n + 1, where nĮx. Since (( a + b ) 3) *( a + b ) represents the strings of length 3n + 1, where n Hence (( a + b ) 3) * represents the strings of length a multiple of 3. Solution: (( a + b ) 3) represents the strings of length 3. 11: Describe as simply as possible in English the language corresponding to the regular expression Over the alphabet that contain an odd number of b'sĮx. 4: Find a regular expression corresponding to the language L Thus anything that comes after the first r 1 inĪlso represents the strings of (r 1(r 1 + r 2) *) +,Īnd conversely (r 1(r 1 + r 2) *) + represents the stringsĮx. However, the strings of (r 1(r 1 + r 2) *)Ī string of r 1 followed by any number of strings taken arbitrarily from r 1 and/or Represented by it must consist of one or more strings of (b) (r 1(r 1 + r 2) *) + means that all the strings Is redundant, that is, they do not produce any strings that are not represented R 1 and/or r 2, r 1r 2 + r 2r 1 in the given regular expression (a) Since (r 1 + r 2) * represents all strings consisting of strings of Solution: One general strategy to approach this type of question is to try to see whether or not they areĮqual to simple regular expressions that are familiar to us such as a, a *, Which is equal to each of the following regular expressions. Find a simple (the shortest and with the smallest nesting of * and +) regular expression 3: Let r 1 and r 2 be arbitrary regular expressions over R 2 which consist of only a's or b's are a, b and the strings consiting of only b's (fromĮx. (b) A string corresponding to r 1 consists of only a's or only b's or Strings of r 2 which contain at least one a and at least one b. Solution: (a) Any string consisting of only a's or only b's and the empty string are (b) find a string corresponding to both r 1 and r 2. (a) find a string corresponding to r 2 but not to r 1 and 2: For the two regular expressions given below, Of the strings wiht length 2 aa,Īnd ab are in the language.
1: Find the shortest string that is not in the language representedĪre strings in the language with length 1 or less. Exercise Questions on Regular Language and Regular ExpressionĮx.