Exercises
[30/60%]ᴬ The following are the state diagrams of two DFAs, and . Answer the following questions about each of these machines.
What is the start state?
What is the set of accept states?
What sequence of states does the machine go through on input aabb?
Does the machine accept the string aabb?
Does the machine accept the string ?
ᴬ Give the formal description of the machines and pictured in Exercise 1.1.
The formal description of a DFA is , where is given by the following table. Give the state diagram of this machine.
| u | d | |
|---|---|---|
Each of the following languages is the intersection of two simpler languages. In each part, construct DFAs for the simpler languages, then combine them using the construction discussed in footnote 3 (page 46) to give the state diagram of a DFA for the language given. In all parts, .
ᴬ
ᴬ
Each of the following languages is the complement of a simpler language. In each part, construct a DFA for the simpler language, then use it to give the state diagram of a DFA for the language given. In all parts, .
ᴬ
ᴬ
Give state diagrams of DFAs recognizing the following languages. In all parts, the alphabet is .
The empty set
All strings except the empty string
Give state diagrams of NFAs with the specified number of states recognizing each of the following languages. In all parts, the alphabet is .
ᴬ The language with three states
The language of Exercise 1.6c with five states
The language of Exercise 1.6l with six states
The language with two states
The language with three states
ᴬ The language with three states
The language with one state
The language 0* with one state
Use the construction in the proof of Theorem 1.45 to give the state diagrams of NFAs recognizing the union of the languages described in
Exercises 1.6a and 1.6b.
Exercises 1.6c and 1.6f.
Use the construction in the proof of Theorem 1.47 to give the state diagrams of NFAs recognizing the concatenation of the languages described in
Exercises 1.6g and 1.6i.
Exercises 1.6b and 1.6m.
Use the construction in the proof of Theorem 1.49 to give the state diagrams of NFAs recognizing the star of the languages described in
Exercise 1.6b.
Exercise 1.6j.
Exercise 1.6m.
ᴬ Prove that every NFA can be converted to an equivalent one that has a single accept state.
Let . Give a DFA with five states that recognizes and a regular expression that generates . (Suggestion: Describe more simply.)
Let be the language of all strings over 0,1 that do not contain a pair of 1s that are separated by an odd number of symbols. Give the state diagram of a DFA with five states that recognizes . (You may find it helpful first to find a 4-state NFA for the complement of .)
Show that if is a DFA that recognizes language , swapping the accept and nonaccept states in yields a new DFA recognizing the complement of . Conclude that the class of regular languages is closed under complement.
Show by giving an example that if is an NFA that recognizes language , swapping the accept and nonaccept states in doesn't necessarily yield a new NFA that recognizes the complement of . Is the class of languages recognized by NFAs closed under complement? Explain your answer.
Give a counterexample to show that the following construction fails to prove Theorem 1.49, the closure of the class of regular languages under the star operation. 1 Let recognize . Construct as follows. is supposed to recognize .
Footnotes
-
In other words, you must present a finite automaton, , for which the constructed automaton does not recognize the star of ’s language. ↩
The states of are the states of .
The start state of is the same as the start state of .
. The accept states are the old accept states plus its start state.
Define so that for any and any ,
(Suggestion: Show this construction graphically, as in Figure 1.50.)
Use the construction given in Theorem 1.39 to convert the following two nondeterministic finite automata to equivalent deterministic finite automata.
Give an NFA recognizing the language .
Convert this NFA to an equivalent DFA. Give only the portion of the DFA that is reachable from the start state.
Give regular expressions generating the following languages (cf. Exercise 1.6). In all parts, the alphabet is .
The empty set
All strings except the empty string
(((00)*(11))
a(ba)*b
Use the procedure described in Lemma 1.60 to convert the following finite automata to regular expressions.
In certain programming languages, comments appear between delimiters such as / and /. Let be the language of all valid delimited comment strings. A member of must begin with / and end with / but have no intervening /. For simplicity, assume that the alphabet for is .
Give a DFA that recognizes .
Give a regular expression that generates .
ᴬ Let be any language over the alphabet . Prove that iff .
A finite state transducer (FST) is a type of deterministic finite automaton whose output is a string and not just accept or reject. The following are state diagrams of finite state transducers and .
Each transition of an FST is labeled with two symbols, one designating the input symbol for that transition and the other designating the output symbol. The two symbols are written with a slash, /, separating them. In , the transition from to has input symbol 2 and output symbol 1. Some transitions may have multiple input-output pairs, such as the transition in from to itself. When an FST computes on an input string , it takes the input symbols one by one and, starting at the start state, follows the transitions by matching the input labels with the sequence of symbols . Every time it goes along a transition, it outputs the corresponding output symbol. For example, on input 2212011, machine enters the sequence of states and produces output 1111000. On input abbb, outputs 1011. Give the sequence of states entered and the output produced in each of the following parts.
on input 011
on input 211
on input 121
on input 0202
on input b
on input bbab
on input bbbbbb
on input
Read the informal definition of the finite state transducer given in Exercise 1.24. Give a formal definition of this model, following the pattern in Definition 1.5 (page 35). Assume that an FST has an input alphabet and an output alphabet but not a set of accept states. Include a formal definition of the computation of an FST. (Hint: An FST is a 5-tuple. Its transition function is of the form .)
Exercise 1.24: A finite state transducer (FST) is a type of deterministic finite automaton whose output is a string and not just accept or reject. Each transition of an FST is labeled with two symbols, one designating the input symbol for that transition and the other designating the output symbol, with the two symbols written with a slash, /, separating them. Some transitions may have multiple input-output pairs. When an FST computes on an input string , it takes the input symbols one by one and, starting at the start state, follows the transitions by matching the input labels with the sequence of symbols . Every time it goes along a transition, it outputs the corresponding output symbol.
Using the solution you gave to Exercise 1.25, give a formal description of the machines and depicted in Exercise 1.24.
Read the informal definition of the finite state transducer given in Exercise 1.24. Give the state diagram of an FST with the following behavior. Its input and output alphabets are . Its output string is identical to the input string on the even positions but inverted on the odd positions. For example, on input 0000111 it should output 1010010.
Exercise 1.24: A finite state transducer (FST) is a type of deterministic finite automaton whose output is a string and not just accept or reject. Each transition of an FST is labeled with two symbols, one designating the input symbol for that transition and the other designating the output symbol, with the two symbols written with a slash, /, separating them. Some transitions may have multiple input-output pairs. When an FST computes on an input string , it takes the input symbols one by one and, starting at the start state, follows the transitions by matching the input labels with the sequence of symbols . Every time it goes along a transition, it outputs the corresponding output symbol.
Convert the following regular expressions to NFAs using the procedure given in Theorem 1.54. In all parts, .
Use the pumping lemma to show that the following languages are not regular.
ᴬ
ᴬ (Here, means a string of a's.)
Describe the error in the following "proof" that is not a regular language. (An error must exist because is regular.) The proof is by contradiction. Assume that is regular. Let be the pumping length for given by the pumping lemma. Choose to be the string . You know that is a member of , but Example 1.73 shows that cannot be pumped. Thus you have a contradiction. So is not regular.