Chapter 20

Codings

[32/100%]
Show
LaTeX
Problem 479

A coding scheme from the alphabet Σ={a,b,c}\Sigma =\left\{ a, b, c\right\} into the alphabet Ω={0,1,2}\Omega =\left\{ 0,1,2\right\} is given by: C={(aa,0),(abc,11),(ba,21),(c,ε),(bb,2),(ab,22),(b,1)}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 480

A coding scheme from the alphabet {0}\left\{ 0\right\} into the alphabet {a,b}\left\{ a, b\right\} is given by: C={(0,a),(00,b)}C=\left\{ (0, a),(00, b)\right\}. Prove that the word 0n0^{n} can be encoded in Fn+1F_{n+1} ways, where FiF_{i} is the corresponding Fibonacci number.

?
Problem 481

Let the language LL over the alphabet {a,b}\left\{ a, b\right\} consist of all words that begin with aaa a and contain a number of symbols aa that is a multiple of three. The homomorphism h:{0,1,2}∗→{a,b}∗h:\left\{ 0,1,2\right\}^{*} \rightarrow \left\{ a, b\right\}^{*} is given by the equalities h(0)=aaah(0)=a a a, h(1)=ba,h(2)=εh(1)=b a, h(2)=\varepsilon. Determine which of the following three words belong to the preimage h−1(L)h^{-1}(L) of the language LL under the homomorphism hh:

?
(a)

w1=21112w_{1}=21112;

(b)

w2=20101012w_{2}=20101012;

(c)

w3=00211011w_{3}=00211011.

Problem 482

Let the language LL over the alphabet {a,b,c}\left\{ a, b, c\right\} consist of all words that begin with aaa a and contain the substring bbb b. Which of the following phrases defines the language h(L)h(L), the image of LL under the following homomorphism h:{a,b,c}∗→{0,1}∗:h(a)=01,h(b)=11,h(c)=εh:\left\{ a, b, c\right\}^{*} \rightarrow \left\{ 0,1\right\}^{*}: h(a)=01, h(b)=11, h(c)=\varepsilon?

?
(a)

All words over the alphabet {0,1}\left\{ 0,1\right\} beginning with 0101, with length divisible by 4.

(b)

All words of even length over the alphabet {0,1}\left\{ 0,1\right\} beginning with 0101.

(c)

All words of even length over the alphabet {0,1}\left\{ 0,1\right\} beginning with 0101, in which every second symbol is a one and which contain the substring 1111.

(d)

All words over the alphabet {0,1}\left\{ 0,1\right\} beginning with 0101, in which the symbols at even positions are ones and which contain the substring 1111.

Problem 483

Let the language LL over the alphabet {a,b,c}\left\{ a, b, c\right\} consist of all words that end with bccb c c and contain the substring acaa c a. Which of the following phrases defines the language h(L)h(L), the image of LL under the following homomorphism h:{a,b,c}∗→{0,1}∗:h(a)=0,h(b)=10,h(c)=εh:\left\{ a, b, c\right\}^{*} \rightarrow \left\{ 0,1\right\}^{*}: h(a)=0, h(b)=10, h(c)=\varepsilon?

?
(a)

All words over the alphabet {0,1}\left\{ 0,1\right\} ending with 10, with length 12 or more.

(b)

All words of even length over the alphabet {0,1}\left\{ 0,1\right\} containing the substring 0000.

(c)

All words of even length over the alphabet {0,1}\left\{ 0,1\right\} ending with 10, in which every second symbol is a zero.

(d)

All words over the alphabet {0,1}\left\{ 0,1\right\} ending with 10, in which every second symbol is a zero and which contain the substring 0000.

(e)

All words of even length over the alphabet {0,1}\left\{ 0,1\right\} ending with 10, in which every sixth symbol is a zero and which contain the substring 0000.

Problem 484

A coding scheme from the alphabet Σ={0,1}\Sigma =\left\{ 0,1\right\} into the alphabet Ω={a,b}\Omega =\left\{ a, b\right\} is given by: C={(00,aa),(01,b),(1,a)}C=\left\{ (00, a a),(01, b),(1, a)\right\}. Find the results of encoding the following languages, represented by regular expressions:

?
(a)

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

(b)

(01+10)∗(01+10)^{*};

(c)

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

(d)

(101∗+00)∗\left(101^{*}+00\right)^{*}.

Problem 485

A coding scheme from the alphabet Σ={0,1}\Sigma =\left\{ 0,1\right\} into the alphabet Ω={a,b}\Omega =\left\{ a, b\right\} is given by: C={(000,ab),(10,a),(11,bb)}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 486

Let a deterministic finite automaton M=({q0,q1,q2,q3},{a,b,c},P,0,{2})\mathfrak {M}=(\left\{ q_{0}, q_{1}, q_{2}, q_{3}\right\} , \left\{ a, b, c\right\} , P, 0, \left\{ 2\right\} ) be given, with program P={q0,a→q1;q0,b→q1;q0,c→q0;q1,a→q1;q1,b→q2;q1,c→q2;q2,a→q3;q2,b→q3;q2,c→q2;q3,a→q3;q3,b→q3;q3,c→q3}P=\left\{ q_{0}, a \rightarrow q_{1} ; q_{0}, b \rightarrow q_{1} ; q_{0}, c \rightarrow q_{0} ; q_{1}, a \rightarrow q_{1} ; q_{1}, b \rightarrow q_{2} ; q_{1}, c \rightarrow q_{2} ; q_{2}, a \rightarrow q_{3} ; q_{2}, b \rightarrow q_{3} ; q_{2}, c \rightarrow q_{2} ; q_{3}, a \rightarrow q_{3} ; q_{3}, b \rightarrow q_{3} ; q_{3}, c \rightarrow q_{3}\right\}, together with a homomorphism h:{a,b,c}∗→{0,1}∗h:\left\{ a, b, c\right\}^{*} \rightarrow \left\{ 0,1\right\}^{*}, for which h(a)=01,h(b)=11h(a)=01, h(b)=11, h(c)=εh(c)=\varepsilon. Which of the following three automata M1,M2,M3\mathfrak {M}_{1}, \mathfrak {M}_{2}, \mathfrak {M}_{3} recognize the homomorphic image h(LA)h\left(L_{A}\right)?

?
(a)

M1=({qi:i=0,…,11},{0,1},P1,q0,F1={q1,q2})\mathfrak {M}_{1}=\left(\left\{ q_{i}: i=0, \ldots , 11\right\} ,\left\{ 0,1\right\} , P_{1}, q_{0}, F_{1}=\left\{ q_{1}, q_{2}\right\} \right);

(b)

M2=({q0,q1,q2,q3,q4,q5,q6},{0,1},P2,q0,F2={q1,q2})\mathfrak {M}_{2}=\left(\left\{ q_{0}, q_{1}, q_{2}, q_{3}, q_{4}, q_{5}, q_{6}\right\} ,\left\{ 0,1\right\} , P_{2}, q_{0}, F_{2}=\left\{ q_{1}, q_{2}\right\} \right);

(c)

M3=({q0,q1,q2,q3,q4,q5,q6},{0,1},P3,q0,F3={q0,q1,q2})\mathfrak {M}_{3}=\left(\left\{ q_{0}, q_{1}, q_{2}, q_{3}, q_{4}, q_{5}, q_{6}\right\} ,\left\{ 0,1\right\} , P_{3}, q_{0}, F_{3}=\left\{ q_{0}, q_{1}, q_{2}\right\} \right).

The programs of the automata are given by the tables in Fig. 32 (a dash means the absence of the corresponding transition).

Problem 487

Given a deterministic finite automaton (Fig. 33) recognizing some language LL. Construct a nondeterministic finite automaton recognizing the language C(L)C(L) for the coding schemes CC from Problems

?
(a)

484

(b)

485

Fig. 33: Automaton from Problem 487.Fig. 33: Automaton from Problem 487.

Problem 488

Let the homomorphism C:{0,1,2}∗→{a,b}∗C:\left\{ 0,1,2\right\}^{*} \rightarrow \left\{ a, b\right\}^{*} be defined by the equalities C(0)=ab,C(1)=b,C(2)=aaC(0)=a b, C(1)=b, C(2)=a a.

Construct a deterministic finite automaton that recognizes the image C(L)C(L) of the language

L={w:w does not begin with 1 and does not contain 00}. L=\left\{ w: w \text{ does not begin with } 1 \text{ and does not contain } 00\right\} .
?
Problem 489

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

Construct a deterministic finite automaton that recognizes the image C(L)C(L) of the language

L={w:w begins with 0 and contains 11}. L=\left\{ w: w \text{ begins with } 0 \text{ and contains } 11\right\} .
?
Problem 490

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

Construct a deterministic finite automaton that recognizes the language C(L)C(L) for the language L={w: the digits 2 occur in w in blocks of even length, and at least one such block is present}L=\left\{ w:\text{ the digits 2 occur in }w\text{ in blocks of even length, and at least one such block is present}\right\}

?
Problem 491

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=\left\{ w: w \text{ ends in } 01

and contains an even number of ones.

?
Problem 492

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)=01,C(b)=11,C(c)=εC(a)=01, C(b)=11, C(c)=\varepsilon.

Construct a deterministic finite automaton that recognizes the preimage C−1(L)C^{-1}(L) of the language

L={w:w begins with 11 and does not contain 010}. L=\left\{ w: w \text{ begins with } 11 \text{ and does not contain } 010\right\} .
?
Problem 493

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)=00,C(b)=011,C(c)=01C(a)=00, C(b)=011, C(c)=01.

Construct a deterministic finite automaton that recognizes the language C−1(L)C^{-1}(L) for the language

L={w:w contains the substring 001 or the substring 10}. L=\left\{ w: w \text{ contains the substring } 001 \text{ or the substring } 10\right\} .
?
Problem 494

Prove that any encoding operation CC for a language can be represented as a superposition of the preimage of a homomorphism ψ\psi and a homomorphism φ:C(L)=φ(ψ−1(L))\varphi : C(L)=\varphi \left(\psi^{-1}(L)\right) for some ψ\psi and φ\varphi.

?
Problem 495

Let us define the cylindrification operation, which is inverse to 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 an automatic language LL the language ZΣ(L)Z_{\Sigma }(L) is also an automatic language. Propose a procedure for rebuilding an automaton recognizing LL into an automaton recognizing ZΣ(L)Z_{\Sigma }(L).

?
Problem 496

Show that if the homomorphism C:Σ∗→Ω∗C: \Sigma^{*} \rightarrow \Omega^{*} is prefix-free, then the result of the inverse encoding C−1C^{-1} can be computed by a finite transducer. We assume C−1(w)C^{-1}(w) may be anything if w∉rng⁡Cw \notin \operatorname {rng} C.

?
Problem 497

Using the Markov criterion, prove that with the aid of the coding schemes from Problems 484 and 485, every word can be encoded in at most one way.

?
Problem 498

Using the Markov criterion, determine whether, for the coding schemes from Problems 484 and 485, the original word can be uniquely recovered from the code of a word.

?
Problem 499

Construct the coding graph for the first six code words of Morse code: Cm(a)=“⋅−”;Cm(b)=“−⋯”;Cm(c)=“−⋅−⋅”C_{m}(a)=\text{``}\cdot -\text{''}; C_{m}(b)=\text{``}-\cdots \text{''}; C_{m}(c)=\text{``}-\cdot -\cdot \text{''}; Cm(d)=“−⋅⋅”;Cm(e)=“⋅”;Cm(f)=“⋅⋅−⋅”C_{m}(d)=\text{``}-\cdot \cdot \text{''}; C_{m}(e)=\text{``}\cdot \text{''}; C_{m}(f)=\text{``}\cdot \cdot -\cdot \text{''}.

?
Problem 500

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

?
Problem 501

Using the Markov criterion, check whether the following homomorphism is unambiguous: C(a)=0101,C(b)=100,C(c)=1011C(a)=0101, C(b)=100, C(c)=1011, C(d)=0010,C(e)=110011,C(f)=00C(d)=0010, C(e)=110011, C(f)=00. If not, find a word that cannot be uniquely decoded.

?
Problem 502

Prove that prefix-free homomorphisms are unambiguous, using the Markov criterion.

?
Problem 503

Using the Huffman method, construct optimal binary encodings for the (Russian) words

?
(a)

"каракатица" (cuttlefish),

(b)

"параллелепипед" (parallelepiped),

(c)

"телеаппаратура" (television equipment),

(d)

"индивидуальность" (individuality),

(e)

"перераспределение" (redistribution)

(f)

"обороноспособность" (defense capability)

(g)

"стронгилоцентротус" (Strongylocentrotus)

(h)

"тартароблатта" (Tartaroblatta).

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

Problem 504

Construct finite transducers performing the decoding from Problem 503: using the Huffman method, construct optimal binary encodings for the words

?
(a)

"каракатица",

(b)

"параллелепипед",

(c)

"телеаппаратура",

(d)

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

(e)

"перераспределение"

(f)

"обороноспособность"

(g)

"стронгилоцентротус"

(h)

"тартароблатта".

Problem 505

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

?
Problem 506

Prove that for any optimal binary homomorphism, the sum in the Kraft-McMillan inequality is exactly equal to one. Demonstrate that for non-binary homomorphisms this may fail.

?
Problem 507

Let the frequencies of the symbols ai,i∈Ia_{i}, i \in I, be equal. Prove that

?
(a)

in any optimal homomorphism the lengths of the code words C(ai)C\left(a_{i}\right) differ by no more than 2;

(b)

there exists an optimal homomorphism in which the lengths of the code words C(ai)C\left(a_{i}\right) differ by no more than 1;

(c)

in any optimal binary homomorphism the lengths of the code words C(ai)C\left(a_{i}\right) differ by no more than 1.

Problem 508

We need to construct an unambiguous 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, for the symbols a,b,c,d,e,fa, b, c, d, e, f it has been decided to use code words of lengths 5,1,3,3,4,85,1,3,3,4,8 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 509

We need to construct an optimal binary homomorphism from the alphabet {a,b,c,d,e,f,g,h}\left\{ a, b, c, d, e, f, g, h\right\}. It is known that the first three symbols occur equally often, while the rest occur much more rarely, but also with equal frequency.

?
Problem 510

Let CC be a coding scheme from the alphabet Σ\Sigma into itself, and let LL be an automatic language over the alphabet Σ\Sigma. Prove that the language C∗(L)C^{*}(L) is also automatic:

C∗(L)=⋃{C[x]:x∈L,C[x]≠∅}∪{x:x∈L,C[x]=∅}. C^{*}(L)=\bigcup \left\{ C[x]: x \in L, C[x] \neq \varnothing \right\} \cup \left\{ x: x \in L, C[x]=\varnothing \right\} .

Thus C∗(L)C^{*}(L) contains the codes of words from LL that can be encoded, together with all words from LL that cannot be encoded.

?