Chapter 19

Regular Languages and Finite Automata

[23/100%]
Show
LaTeX
Problem 456

Determine the concatenation for the following pairs of languages L1L_{1} and L2L_{2}:

?
(a)

L1={a,ab,abb}L_{1}=\left\{ a, a b, a b b\right\} and L2={ε,a,b,ab,ba}L_{2}=\left\{ \varepsilon , a, b, a b, b a\right\};

(b)

L1={ε,a,ab,abb}L_{1}=\left\{ \varepsilon , a, a b, a b b\right\} and L2={a,b,abb,ba}L_{2}=\left\{ a, b, a b b, b a\right\};

(c)

L1={ε,a,b,ab,aba}L_{1}=\left\{ \varepsilon , a, b, a b, a b a\right\} and L2={ε,a,b,ab,ba}L_{2}=\left\{ \varepsilon , a, b, a b, b a\right\}.

Problem 457

Let L={baa,bab,bba,bbb}L=\left\{ b a a, b a b, b b a, b b b\right\}. Which of the following languages is the iteration L∗L^{*} of this language?

?
(a)

{w:w=bw′ and ∣w∣ is divisible by 3}∪{ε}\left\{ w: w=b w^{\prime } \text{ and } \left|w\right| \text{ is divisible by } 3\right\} \cup \left\{ \varepsilon \right\};

(b)

{w:w=bw′ and ∣w∣⩾3}∪{ε}\left\{ w: w=b w^{\prime } \text{ and } \left|w\right| \geqslant 3\right\} \cup \left\{ \varepsilon \right\};

(c)

{w:w=x1x2x3…x3n,xi∈{a,b} and x3i+1=b for all i<n}∪{ε}\left\{ w: w=x_{1} x_{2} x_{3} \ldots x_{3 n}, x_{i} \in \left\{ a, b\right\} \text{ and } x_{3 i+1}=b \text{ for all }i<n\right\} \cup \left\{ \varepsilon \right\};

(d)

{w:w=bw′ and ∣w∣⩾12}\left\{ w: w=b w^{\prime } \text{ and } \left|w\right| \geqslant 12\right\}.

Problem 458

Which of the following regular expressions define all words made of zeros and ones that contain no two consecutive 0's?

?
(a)

(1+01)∗(ε+0)(1+01)^{*}(\varepsilon +0);

(b)

(1∗01∗)∗\left(1^{*} 01^{*}\right)^{*};

(c)

(01)∗1∗01∗(01)^{*} 1^{*} 01^{*};

(d)

1∗01(1+01)∗(ε+0)1^{*} 01(1+01)^{*}(\varepsilon +0);

(e)

(1+01)∗(0+1)(1+01)^{*}(0+1);

(f)

1∗(011∗)∗(ε+0)1^{*}\left(011^{*}\right)^{*}(\varepsilon +0).

Problem 459

Let the regular expression b(ab)∗b(a b)^{*} define some language over the alphabet Σ={a,b}\Sigma =\left\{ a, b\right\}. Which of the following regular expressions define the same language?

Fig. 29: Automaton programs from Problem 460.Fig. 29: Automaton programs from Problem 460.

Fig. 30: Automaton programs from Problem 461.Fig. 30: Automaton programs from Problem 461.

?
(a)

a(ba)∗a(b a)^{*};

(b)

(ba)∗b(b a)^{*} b;

(c)

b∗ab∗b^{*} a b^{*};

(d)

b(ab+abab)∗b(a b+a b a b)^{*};

(e)

(ba)∗b(ab)∗(b a)^{*} b(a b)^{*};

(f)

(ab+ba)∗(a b+b a)^{*}.

Problem 460

Determine which of the following three automata N1,N2,N3\mathfrak {N}_{1}, \mathfrak {N}_{2}, \mathfrak {N}_{3} recognize the language represented by the regular expression (00+1)∗1(00+1)^{*} 1:

?
(a)

N1=({q,p,r,s,t},{0,1},P1,q,{t})\mathfrak {N}_{1}=\left(\left\{ q, p, r, s, t\right\} ,\left\{ 0,1\right\} , P_{1}, q,\left\{ t\right\} \right);

(b)

N2=({q,p,r,s},{0,1},P2,q,{s})\mathfrak {N}_{2}=\left(\left\{ q, p, r, s\right\} ,\left\{ 0,1\right\} , P_{2}, q,\left\{ s\right\} \right);

(c)

N3=({q,p,r,s,t},{0,1},P3,q,{s})\mathfrak {N}_{3}=\left(\left\{ q, p, r, s, t\right\} ,\left\{ 0,1\right\} , P_{3}, q,\left\{ s\right\} \right).

The programs of the automata are given in the table in Fig. 29 (a dash means the absence of the corresponding transitions).

Problem 461

Determine which of the following three automata N4,N5,N6\mathfrak {N}_{4}, \mathfrak {N}_{5}, \mathfrak {N}_{6} recognize the language represented by the regular expression 0(10+1)∗0(10+1)^{*}:

?
(a)

N4=({q,p,r,s,t},{0,1},P4,q,{t})\mathfrak {N}_{4}=\left(\left\{ q, p, r, s, t\right\} ,\left\{ 0,1\right\} , P_{4}, q,\left\{ t\right\} \right);

(b)

N5=({q,p,r,s},{0,1},P5,q,{p,r})\mathfrak {N}_{5}=\left(\left\{ q, p, r, s\right\} ,\left\{ 0,1\right\} , P_{5}, q,\left\{ p, r\right\} \right);

(c)

N6=({q,p,r,s,t},{0,1},P6,q,{p,r,s})\mathfrak {N}_{6}=\left(\left\{ q, p, r, s, t\right\} ,\left\{ 0,1\right\} , P_{6}, q,\left\{ p, r, s\right\} \right).

The programs of the automata are given in the table in Fig. 30 on the facing page (a dash means the absence of the corresponding transitions).

Problem 462

Prove that the regular expression (1+01+001)∗(ε+0+00)(1+01+001)^{*}(\varepsilon +0+00) represents the language consisting of all words in the alphabet {0,1}\left\{ 0,1\right\} that do not contain the substring 000.

?
Problem 463

Determine which language is represented by the following regular expressions:

?
(a)

0∗1∗00^{*} 1^{*} 0;

(b)

01∗001^{*} 0;

(c)

(01∗)∗0\left(01^{*}\right)^{*} 0;

(d)

(00+11+(01+10)(00+11)∗(01+10))∗\left(00+11+(01+10)(00+11)^{*}(01+10)\right)^{*}.

Problem 464

Prove the equivalences

?
(a)

r+p≡p+rr+p \equiv p+r (commutativity of union);

(b)

(r+p)+q≡r+(p+q)(r+p)+q \equiv r+(p+q) (associativity of union);

(c)

(rp)q≡r(pq)(r p) q \equiv r(p q) (associativity of concatenation);

(d)

(r∗)∗≡r∗\left(r^{*}\right)^{*} \equiv r^{*} (idempotence of iteration);

(e)

(r+p)q≡rq+pq(r+p) q \equiv r q+p q (distributivity).

Problem 465

Prove the following equivalences for regular expressions:

?
(a)

p∗(p+q)∗≡p∗(qp∗)∗≡(p+qp∗)∗≡(p+q)∗;p^{*}(p+q)^{*} \equiv p^{*}\left(q p^{*}\right)^{*} \equiv \left(p+q p^{*}\right)^{*} \equiv (p+q)^{*} ;

(b)

p(qp)∗≡(pq)∗pp(q p)^{*} \equiv (p q)^{*} p;

(c)

(p∗q∗)∗≡(q∗p∗)∗\left(p^{*} q^{*}\right)^{*} \equiv \left(q^{*} p^{*}\right)^{*};

(d)

(pq)+(q∗p∗+q∗)≡(pq)∗pq+p∗(p q)^{+}\left(q^{*} p^{*}+q^{*}\right) \equiv (p q)^{*} p q^{+} p^{*}.

Problem 466

Simplify the following regular expressions:

?
(a)

00∗0+(00)∗00^{*} 0+(00)^{*};

(b)

(0+1)(ε+00)++(0+1)(0+1)(\varepsilon +00)^{+}+(0+1);

(c)

(0+ε)0∗1(0+\varepsilon ) 0^{*} 1;

(d)

(0∗+0)∗(01∗+0)\left(0^{*}+0\right)^{*}\left(01^{*}+0\right).

Problem 467

Using equivalent transformations of regular expressions, simplify the regular expression r=(aa)∗+a(aa)∗(ba(aa)∗)∗b(aa)∗+a(aa)∗+a(aa)∗(ba(aa)∗)∗ba(aa)∗r=(a a)^{*}+a(a a)^{*}\left(b a(a a)^{*}\right)^{*} b(a a)^{*}+a(a a)^{*}+a(a a)^{*}\left(b a(a a)^{*}\right)^{*} b a(a a)^{*}.

?
Problem 468

Prove that every regular expression rr is equivalent to a regular expression ss of the form s1+⋯+sns_{1}+\cdots +s_{n}, where the regular expressions s1,…,sns_{1}, \ldots , s_{n} do not contain ++.

?
Problem 469

Construct a regular expression defining the language LL over the alphabet Σ={0,1}:\Sigma =\left\{ 0,1\right\} :

?
(a)

L={w:w contains an odd number of digits 0 and an even number of digits 1}L=\left\{ w: w\text{ contains an odd number of digits 0 and an even number of digits 1}\right\};

(b)

L={w:w contains the substring 001 or the substring 110}L=\left\{ w: w\text{ contains the substring 001 or the substring 110}\right\};

(c)

L={w:w contains at least two consecutive 0’s}L=\left\{ w: w\text{ contains at least two consecutive 0's}\right\};

(d)

L={w:w does not contain the substrings 011 and 010}L=\left\{ w: w\text{ does not contain the substrings 011 and 010}\right\}.

Problem 470

Let ww be an arbitrary word of length kk, and let m1,…,mnm_{1}, \ldots , m_{n} be pairwise distinct natural numbers arranged in increasing order. Prove that the language {wm1,…,wmn}\left\{ w^{m_{1}}, \ldots , w^{m_{n}}\right\} can be described by a regular expression of length at most 4kmn+4n−74 k m_{n}+4 n-7 (taking into account all symbols required by the definition).

?
Problem 471

Above, in Problem 445 on p. 132, it was proposed to construct an automaton that verifies the correctness of addition. Construct a regular expression defining the language SS recognized by this automaton, that is, the following set of words over the alphabet {0,1}3\left\{ 0,1\right\}^{3}:

S={[a1b1c1]…[anbncn]:cn…c1 is the sum of the binary numbers an…a1 and bn…b1}. S=\left\{ \left[\begin{smallmatrix} a_{1} \\ b_{1} \\ c_{1} \end{smallmatrix}\right] \ldots \left[\begin{smallmatrix} a_{n} \\ b_{n} \\ c_{n} \end{smallmatrix}\right] : c_{n} \ldots c_{1} \text{ is the sum of the binary numbers } a_{n} \ldots a_{1} \text{ and } b_{n} \ldots b_{1}\right\} .
?
Problem 472

Construct a regular expression for the language from Problem 447 on p. 133.

?
Problem 473

Construct deterministic finite automata recognizing the languages defined by the following regular expressions:

?
(a)

r1=aa(bb+aa)∗bbr_{1}=a a(b b+a a)^{*} b b;

(b)

r2=(a+bb)(a+b)∗(aa+bb)r_{2}=(a+b b)(a+b)^{*}(a a+b b);

(c)

r3=(a++b+)(ab+ba)∗r_{3}=\left(a^{+}+b^{+}\right)(a b+b a)^{*};

(d)

r4=(abb)∗(aab∗+bba∗)r_{4}=(a b b)^{*}\left(a a b^{*}+b b a^{*}\right);

(e)

r5=b∗(ab∗a)∗b∗r_{5}=b^{*}\left(a b^{*} a\right)^{*} b^{*};

(f)

r6=(ab+ba)∗(aa+bb)∗r_{6}=(a b+b a)^{*}(a a+b b)^{*}.

Problem 474

For the following pairs of regular expressions r1r_{1} and r2r_{2}, construct a regular expression rr representing the intersection of the languages L(r1)L\left(r_{1}\right) and L(r2)L\left(r_{2}\right):

?
(a)

r1=aa(bab)∗bb,r2=a∗(bba)∗b+r_{1}=a a(b a b)^{*} b b, r_{2}=a^{*}(b b a)^{*} b^{+};

(b)

r1=(ba)∗(abb+ba)∗,r2=(abb)∗(a+bb)∗r_{1}=(b a)^{*}(a b b+b a)^{*}, r_{2}=(a b b)^{*}(a+b b)^{*};

(c)

r1=(b+ab)∗(aa+b)∗,r2=(ab+bb)∗(a∗+b∗)r_{1}=(b+a b)^{*}(a a+b)^{*}, r_{2}=(a b+b b)^{*}\left(a^{*}+b^{*}\right);

(d)

r1=b∗(ab+abb)∗(a∗+bb∗),r2=(b∗+(ab)∗)(b+aa)∗r_{1}=b^{*}(a b+a b b)^{*}\left(a^{*}+b b^{*}\right), r_{2}=\left(b^{*}+(a b)^{*}\right)(b+a a)^{*}.

Problem 475

For the following regular expressions r1r_{1}, construct a regular expression rr representing the complement of the language L(r1)L\left(r_{1}\right):

?
(a)

r1=(ba)∗(b+aa)∗r_{1}=(b a)^{*}(b+a a)^{*};

(b)

r1=(ab)∗+(ba+bba)∗r_{1}=(a b)^{*}+(b a+b b a)^{*};

(c)

r1=(aa+ab)∗(b+a)∗r_{1}=(a a+a b)^{*}(b+a)^{*};

(d)

r1=(a+b)∗b(ba)∗b(bb)∗r_{1}=(a+b)^{*} b(b a)^{*} b(b b)^{*}.

Problem 476

For the following regular expressions r1r_{1}, construct a regular expression rr with the fewest symbols such that the equality (L(r))∗=(L(r1))∗(L(r))^{*}=\left(L\left(r_{1}\right)\right)^{*} holds:

?
(a)

r1=(b+a)(a+bb)∗r_{1}=(b+a)(a+b b)^{*};

(b)

r1=(a+ab+abb)∗b∗r_{1}=(a+a b+a b b)^{*} b^{*};

(c)

r1=b∗(bba+ba)∗r_{1}=b^{*}(b b a+b a)^{*};

(d)

r1=(baab+b(aa)∗)∗b∗r_{1}=\left(b a a b+b(a a)^{*}\right)^{*} b^{*}.

Problem 477

Fig. 31 on the next page shows the diagrams of four nondeterministic finite automata. Construct regular expressions representing the languages recognized by these automata.

Fig. 31: Finite automata from Problem 477.Fig. 31: Finite automata from Problem 477.

?
(a)

???

(b)

???

(c)

???

(d)

???

Problem 478

Write a regular expression for the language recognized by the automaton in Fig. 28 on p. 136.

?