Chapter 17

Codings. Non-Automatic Languages

[19/100%]
Show
LaTeX
Problem 261

Given the following coding scheme from the alphabet Σ={a,b,c}\Sigma =\left\{ a, b, c\right\} to the alphabet Ω={0,1,2}:C={(aa,0),(abc,11),(ba,21),(c,ε),(bb,2),(ab,22),(b,1)}\Omega =\left\{ 0,1,2\right\} : C=\left\{ (a a, 0),(a b c, 11),(b a, 21),(c, \varepsilon ),(b b, 2),(a b, 22),(b, 1)\right\}. Find the sets of codes for the following words:

?
(a)

abaabac;

(b)

bacbbaccab;

(c)

aabcabccaab;

(d)

abcbbaabc.

Problem 262

Given the following coding scheme from the alphabet Σ={0,1}\Sigma =\left\{ 0,1\right\} to the alphabet Ω={a,b}:C={(000,ab),(10,a),(11,bb)}\Omega =\left\{ a, b\right\} : C=\left\{ (000, a b),(10, a),(11, b b)\right\}. Find the results of encoding the following languages, represented by regular expressions:

?
(a)

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

(b)

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

(c)

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

(d)

(001+01+110)∗(001+01+110)^{*}.

Problem 263

Let the homomorphism C:{a,b,c}∗→{0,1}∗C:\left\{ a, b, c\right\}^{*} \rightarrow \left\{ 0,1\right\}^{*} be defined by the equalities C(a)=10,C(b)=01,C(c)=εC(a)=10, C(b)=01, C(c)=\varepsilon.

Construct a deterministic finite automaton that recognizes the language C−1(L)C^{-1}(L) for the language L={w:w ends in 01 and contains an even number of ones }L=\left\{ w: w\text{ ends in 01 and contains an even number of ones }\right\}.

?
Problem 264

Let us define the operation of cylindrification, which is the inverse of the projection operation. Let CC be the projection of the alphabet Σ\Sigma onto the alphabet Ω⊆Σ\Omega \subseteq \Sigma. For any language L⊆Ω∗L \subseteq \Omega^{*}, define its cylindrification to the alphabet Σ\Sigma as the language

ZΣ(L)={w∈Σ∗:C(w)∈L}. Z_{\Sigma }(L)=\left\{ w \in \Sigma ^{*}: C(w) \in L\right\} .

Show that for a regular language LL the language ZΣ(L)Z_{\Sigma }(L) is also regular. Propose a procedure for rebuilding an automaton recognizing LL into an automaton recognizing ZΣ(L)Z_{\Sigma }(L).

?
Problem 265

Construct the coding graph for the first six Morse code words.

?
Problem 266

Using Markov's criterion, determine whether the homomorphism is uniquely decodable: C(a)=01,C(b)=100,C(c)=0110,C(d)=11,C(e)=0100,C(f)=101C(a)=01, C(b)=100, C(c)=0110, C(d)=11, C(e)=0100, C(f)=101. If not, find a word that cannot be uniquely decoded.

?
Problem 267

Prove, using Markov's criterion, that prefix-free homomorphisms are uniquely decodable.

?
Problem 268

Prove that the homomorphism φ′\varphi^{\prime }, constructed in the proof of Lemma 128 on p. 354, is prefix-free.

Lemma 128: Suppose each symbol a∈Σa \in \Sigma occurs nan_{a} times in the word w∈Σ∗w \in \Sigma^{*}, and aa and bb are the two rarest symbols, with the smallest nan_{a} and nbn_{b}. Let φ:Σ∗→{0,1}∗\varphi :\Sigma^{*} \rightarrow \left\{ 0,1\right\}^{*} be an optimal binary homomorphism for the word (w)ba(w)_{b}^{a} (the word ww with all occurrences of aa replaced by bb). Then an optimal binary homomorphism for ww is given by ψa=φb0,ψb=φb1,ψc=φc\psi_{a}=\varphi_{b} 0, \psi_{b}=\varphi_{b} 1, \psi_{c}=\varphi_{c} for c∉{a,b}c \notin \left\{ a, b\right\}.

In the proof (by contradiction), assuming ψ\psi is not optimal produces an optimal homomorphism ψ′\psi^{\prime } with ψa′=u0,ψb′=u1\psi_{a}^{\prime }=u 0, \psi_{b}^{\prime }=u 1 for some u∈{0,1}∗u \in \left\{ 0,1\right\}^{*}, from which the homomorphism φ′\varphi^{\prime } for the word (w)ba(w)_{b}^{a} is constructed by φb′=u,φc′=ψc′\varphi_{b}^{\prime }=u, \varphi_{c}^{\prime }=\psi_{c}^{\prime } for c≠bc \neq b.

?
Problem 269

Using the Huffman method, construct optimal binary encodings for the words

?
(a)

«каракатица»,

(b)

«параллелепипед»,

(c)

«телеаппаратура»,

(d)

«индивидуальность»,

(e)

«перераспределение»

(f)

«обороноспособность»

(g)

«стронгилоцентротус»

(h)

«тартароблатта».

Determine the length of the resulting word codes. Calculate how much shorter a result the optimal encoding gives compared to a uniform binary encoding, that is, when the codes of all symbols have the same length.

Problem 270

Construct finite transducers that perform the decoding from Problem 269.

?
(a)

(a) from problem 269;

(b)

(b) from problem 269.

Problem 271

By induction on construction, prove that for a binary Huffman code the sum in the Kraft-McMillan inequality is exactly equal to one.

?
Problem 272

We need to construct a uniquely decodable binary homomorphism from the alphabet {a,b,c,d,e,f,g,h}\left\{ a, b, c, d, e, f, g, h\right\}. For certain reasons, it has been decided to use code words of lengths 5,1,3,3,4,85,1,3,3,4,8 for the symbols a,b,c,d,e,fa, b, c, d, e, f respectively. It is known that the average frequencies of the symbols gg and hh are 18\frac{1}{8} and 15\frac{1}{5} respectively. Find the optimal lengths of the code words for gg and hh.

?
Problem 273

The reversal of a word w=a1a2…ak,ai∈Σw=a_{1} a_{2} \ldots a_{k}, a_{i} \in \Sigma for i=1,…,ki=1, \ldots , k, is the word w−1=ak…a2a1w^{-1}=a_{k} \ldots a_{2} a_{1}. Show that for a regular language LL its reversal — the language L−1={w−1:w∈L}L^{-1}=\left\{ w^{-1}: w \in L\right\} — is also regular.

?
Problem 274

Let LL be a regular language over the alphabet Σ\Sigma. Prove that the following languages are also regular:

?
(a)

PREF⁡(L)={w: there is a word x∈Σ∗ such that wx∈L}\operatorname {PREF}(L)=\left\{ w:\text{ there is a word }x \in \Sigma^{*}\text{ such that }w x \in L\right\};

(b)

SUFF⁡(L)={w: there is a word x∈Σ∗ such that xw∈L}\operatorname {SUFF}(L)=\left\{ w:\text{ there is a word }x \in \Sigma^{*}\text{ such that }x w \in L\right\};

(c)

INF⁡(L)={w: there are words x,y∈Σ∗ such that xwy∈L}\operatorname {INF}(L)=\left\{ w:\text{ there are words }x, y \in \Sigma^{*}\text{ such that }x w y \in L\right\};

(d)

MAX⁡(L)={w∈L:wx∉L for every nonempty word x}\operatorname {MAX}(L)=\left\{ w \in L: w x \notin L\text{ for every nonempty word }x\right\};

(e)

MIN⁡(L)={w∈L:x∉L for every proper prefix x of the word w}\operatorname {MIN}(L)=\left\{ w \in L: x \notin L\text{ for every proper prefix }x\text{ of the word }w\right\};

(f)

DEL⁡(L)={xz:xyz∈L for some word y}\operatorname {DEL}(L)=\left\{ x z: x y z \in L\text{ for some word }y\right\};

(g)

CYCLE⁡(L)={yx:xy∈L}\operatorname {CYCLE}(L)=\left\{ y x: x y \in L\right\}.

Problem 275

Let LL be a regular language over the alphabet Σ={a1,…,am}\Sigma =\left\{ a_{1}, \ldots , a_{m}\right\}, and let L1,…,LmL_{1}, \ldots , L_{m} be regular languages over the alphabet Δ\Delta. Prove that the language SUBST⁡(L)\operatorname {SUBST}(L), obtained from the words of LL by replacing each letter aia_{i} with some word from LiL_{i}, is also regular. Thus,

SUBST⁡(L)={w1w2…wn:w1∈Li1,…,wn∈Lin and there exists ai1ai2…ain∈L}. \operatorname {SUBST}(L)=\left\{ w_{1} w_{2} \ldots w_{n}: w_{1} \in L_{i_{1}}, \ldots , w_{n} \in L_{i_{n}} \text{ and there exists } a_{i_{1}} a_{i_{2}} \ldots a_{i_{n}} \in L\right\} .
?
Problem 276

Prove that the following languages over the alphabet Σ={a,b,c}\Sigma =\left\{ a, b, c\right\} are not regular:

?
(a)

the set of all words in which there are 3 more letters aa than letters bb;

(b)

L={ancbm:m>3n}L=\left\{ a^{n} c b^{m}: m>3 n\right\};

(c)

L={wcw−1:w=a2bna for some n>0}L=\left\{ w c w^{-1}: w=a^{2} b^{n} a \text{ for some } n>0\right\};

(d)

L={w:∣w∣=2n for some natural number n}L=\left\{ w:\left|w\right|=2^{n} \text{ for some natural number } n\right\};

(e)

L={wc∣w∣:w∈{a,b}∗,∣w∣ is the length of the word w}L=\left\{ w c^{\left|w\right|}: w \in \left\{ a, b\right\}^{*}, \left|w\right| \text{ is the length of the word } w\right\}.

Problem 277

Let V\boldsymbol {V} be a finite set of variables, L={ «(», «)», «λ» }\boldsymbol {L}=\left\{ \text{ «(», «)», «λ» }\right\}. Then a λ\lambda-expression is a word over the alphabet V∪L\boldsymbol {V} \cup \boldsymbol {L} defined inductively: it is either a variable x∈Vx \in \boldsymbol {V}, or « λxe1\lambda x e_{1} », or « (e1e2)\left(e_{1} e_{2}\right) », where x∈Vx \in \boldsymbol {V}, and e1,e2e_{1}, e_{2} are λ\lambda-expressions. For example, the words « λxx»\lambda x x », « λx(xx)»\lambda x(x x) », « λxλx(λx(xx)λx(xx))»\lambda x \lambda x(\lambda x(x x) \lambda x(x x)) » are λ\lambda-expressions, while the words « (xλx)»(x \lambda x) », « λx(λx)»\lambda x(\lambda x) » and « λx\lambda x ((xx)»(x x) » are not λ\lambda-expressions. Prove that the set of λ\lambda-expressions over the alphabet V∪L\boldsymbol {V} \cup \boldsymbol {L} is not regular.

?
Problem 278

Above, in Problem 243 on page 310, an automaton was constructed that checks the correctness of binary addition. Prove that no such automaton exists for the operation of binary multiplication. More precisely, the following language over the alphabet of three-tier symbols is not regular:

\begin{array}{r} \left\{ \llbracket \left[\begin{smallmatrix} x_{1} \\ y_{1} \\ z_{1} \end{array}

x_n y_n z_n : x_i, y_i, z_i 0,1 for i=1, , n and z_n z_1 is the product of the binary numbers x_n x_1 and y_n y_1.

?
Problem 279

Prove that the following language over the alphabet Σ={a,b,c}\Sigma =\left\{ a, b, c\right\} is not regular:

L={w∈Σ∗: the numbers of letters a and b in the word w are different}. L=\left\{ w \in \Sigma ^{*}: \text{ the numbers of letters } a \text{ and } b \text{ in the word } w \text{ are different}\right\} .
?