Chapter 15

Finite Automata

[12/100%]
Show
LaTeX
Problem 235

A coffee vending machine has a slot for receiving coins, a button whose press, after a sufficient amount has been paid, dispenses coffee, and a receptacle through which it gives the customer change. The machine accepts coins of denominations 1, 2, and 5 rubles. A cup of coffee costs 8 rubles. While the amount received is insufficient, a red light is on. If the amount received by the machine becomes greater than or equal to 8 rubles, a green light turns on, and after the button is pressed the machine pours the coffee and, if necessary, dispenses change using the smallest number of coins. If the machine receives a coin while the green light is on, it immediately returns it.

Construct a finite transducer that models the operation of this machine. Determine the input and output alphabets and construct its program.

?
Problem 236

An electronic clock has a display showing hours, minutes, and seconds, as well as two control buttons. The first button switches the clock from normal mode to time-setting mode — first to setting the hours, then the minutes, then the seconds, and then returns it to normal mode. The second button does nothing in normal mode, while in setting mode pressing it increases by one the number of the hours, minutes, or seconds being set, respectively.

Construct a finite transducer that models the operation of the clock. On input it receives press signals from the two buttons, and on output it produces signals for changing the mode and for incrementing the corresponding number. Draw the diagram of the transducer.

?
Problem 237

Construct a finite transducer that multiplies a number written in binary by 3. The digits in the binary representation of numbers go from least significant to most significant, that is, the number ten looks like this: 0101.

?
Problem 238

Construct a finite transducer that computes the integer division by 3 of a number written in decimal. The digits are written in decreasing order of place value (in the "usual" order).

?
Problem 239

Prove Proposition 93 on p. 286.

Proposition 93: For a finite transducer M\mathfrak {M}, its configuration σ\sigma, and a natural number kk, there exists at most one configuration τ\tau such that σ⊢Mkτ\sigma \vdash_{\mathfrak {M}}^{k} \tau.

?
Problem 240

Prove that the automaton M\mathfrak {M} shown in Fig. 83 on p. 307 recognizes the language consisting of all words ending in "aba".

?
Remark.
?

Fig. 83. Diagram of the automaton M\mathfrak {M} from Example 73; the initial state is q0q_{0}, and the sole accepting state is {q0,q1,q3}\left\{ q_{0}, q_{1}, q_{3}\right\}.

Problem 241

By induction on the length of the word ww, prove the following statement: (q,wx)⊢M∗(p,x)(q, w x) \vdash_{\mathfrak {M}}^{*}(p, x) if and only if in DM\mathfrak {D}_{\mathfrak {M}} there is a path from qq to pp carrying ww. Derive from it Lemma 96 on p. 293.

Lemma 96: The automaton M\mathfrak {M} accepts the word ww if and only if in the diagram DM\mathfrak {D}_{\mathfrak {M}} there is a path carrying ww from the initial state q0q_{0} to some accepting state q∈Fq \in F, that is, ww takes q0q_{0} to an accepting state qq.

?
Problem 242

Construct deterministic finite automata that recognize the following languages over the alphabet Σ={a,b}\Sigma =\left\{ a, b\right\}:

?
(a)

L={w: the length of w is divisible by 5}L=\left\{ w:\text{ the length of }w\text{ is divisible by 5}\right\};

(b)

L={w:w does not contain the substrings "aab" and "bba"}L=\left\{ w: w\text{ does not contain the substrings "aab" and "bba"}\right\};

(c)

L={w:w contains an even number of letters a and an odd number of letters b}L=\left\{ w: w\text{ contains an even number of letters }a\text{ and an odd number of letters }b\right\};

(d)

L={w: the number of letters a in the word w is divisible by 3, and the number of letters b — by 2}L=\left\{ w:\text{ the number of letters }a\text{ in the word }w\text{ is divisible by 3, and the number of letters }b\text{ — by 2}\right\}.

Problem 243

Above, in Example 68 on p. 288, a transducer performing the addition of two binary numbers was constructed. Construct a deterministic finite automaton that checks the correctness of the addition. The input consists of "three-level" symbols, in which the top level contains a digit of the first addend, the middle level a digit of the second addend, and the bottom level a digit of the presumed sum. The automaton should accept the word if the result of the addition written on the bottom level is correct. The digits of all numbers are written in order of increasing place value.

?
Problem 244

Prove Lemma 97 on p. 297.

Definition 126 (Product of automata): Let M1=(Q1,Σ,P1,q01,F1)\mathfrak {M}_{1}=(Q_{1}, \Sigma , P_{1}, q_{0}^{1}, F_{1}) and M2=(Q2,Σ,P2,q02,F2)\mathfrak {M}_{2}=(Q_{2}, \Sigma , P_{2}, q_{0}^{2}, F_{2}) be two finite automata with a common input alphabet Σ\Sigma. A product of the automata M1\mathfrak {M}_{1} and M2\mathfrak {M}_{2} is any automaton N\mathfrak {N} of the form N=(Q1×Q2,Σ,P,(q01,q02),F)\mathfrak {N}=(Q_{1} \times Q_{2}, \Sigma , P, (q_{0}^{1}, q_{0}^{2}), F), whose program PP contains the command (q1,q2),a→(p1,p2)(q_{1}, q_{2}), a \rightarrow (p_{1}, p_{2}) whenever q1,a→p1∈P1q_{1}, a \rightarrow p_{1} \in P_{1} and q2,a→p2∈P2q_{2}, a \rightarrow p_{2} \in P_{2}. (No condition is imposed on the set of accepting states FF of N\mathfrak {N}, so a product is not a uniquely determined operation — different choices of FF give different automata.)

Lemma 97: If N\mathfrak {N} is a product of M1\mathfrak {M}_{1} and M2\mathfrak {M}_{2}, then for any two states (q1,q2)(q_{1}, q_{2}) and (p1,p2)(p_{1}, p_{2}) of N\mathfrak {N} and any input word ww, the following holds: ww takes (q1,q2)(q_{1}, q_{2}) to (p1,p2)(p_{1}, p_{2}) in the automaton N\mathfrak {N} if and only if ww simultaneously takes q1q_{1} to p1p_{1} in M1\mathfrak {M}_{1} and q2q_{2} to p2p_{2} in M2\mathfrak {M}_{2}.

?
Problem 245

Using the determinization procedure, construct deterministic automata equivalent to the following nondeterministic finite automata N\mathfrak {N} with alphabet Σ={a,b}\Sigma =\left\{ a, b\right\}:

?
(a)

N=({q0,q1,q2},Σ,P,q0,{q2})\mathfrak {N}=\left(\left\{ q_{0}, q_{1}, q_{2}\right\} , \Sigma , P, q_{0},\left\{ q_{2}\right\} \right) with program P={q0,a→q1;q0,ε→q1;q1,b→q2;q1,ε→q2;q2,b→q2}P=\left\{ q_{0}, a \rightarrow q_{1} ; q_{0}, \varepsilon \rightarrow q_{1} ; q_{1}, b \rightarrow q_{2} ; q_{1}, \varepsilon \rightarrow q_{2} ; q_{2}, b \rightarrow q_{2}\right\};

(b)

N=({q0,q1,q2},Σ,P,q0,{q2})\mathfrak {N}=\left(\left\{ q_{0}, q_{1}, q_{2}\right\} , \Sigma , P, q_{0},\left\{ q_{2}\right\} \right) with program P={q0,a→q1;q0,a→q2;q1,b→q2;q1,ε→q2;q2,b→q0}P=\left\{ q_{0}, a \rightarrow q_{1} ; q_{0}, a \rightarrow q_{2} ; q_{1}, b \rightarrow q_{2} ; q_{1}, \varepsilon \rightarrow q_{2} ; q_{2}, b \rightarrow q_{0}\right\}.

Problem 246

A nondeterministic finite automaton N=(Q,Σ,P,q0,F)\mathfrak {N}=\left(Q, \Sigma , P, q_{0}, F\right) over the alphabet Σ={a,b,c}\Sigma =\left\{ a, b, c\right\} with nn states Q={q0,q1,…,qn−1}Q=\left\{ q_{0}, q_{1}, \ldots , q_{n-1}\right\} and set of accepting states F={q0}F=\left\{ q_{0}\right\} is shown in Fig. 85 on the next page. Let M=(P(Q),Σ,P′,{q0},F′)\mathfrak {M}=\left(\mathrm{P}(Q), \Sigma , P^{\prime },\left\{ q_{0}\right\} , F^{\prime }\right) be the automaton obtained from N\mathfrak {N} by applying the determinization procedure. Prove that

Fig. 85. Automaton from Problem 246.Fig. 85. Automaton from Problem 246.

?
(a)

for any state R∈P(Q)R \in \mathrm{P}(Q) of the automaton M\mathfrak {M} there exists a word wRw_{R} that takes the initial state {q0}\left\{ q_{0}\right\} to RR;

(b)

for any states R,S∈P(Q),R≠SR, S \in \mathrm{P}(Q), R \neq S, of the automaton M\mathfrak {M} there exists a word wR,Sw_{R, S} that takes one of the states RR or SS to some accepting state, and the other to a non-accepting one;

(c)

there is no deterministic finite automaton equivalent to N\mathfrak {N} with fewer than 2n2^{n} states.