Week 4 Decoding linear codes

Version 2023-10-07. To PDF of this week only Open the whole set of notes in PDF

Synopsis. We explicitly describe a decoder DECODE:FqnC based on coset leaders and a standard array for C. For binary C sent via a binary symmetric channel, we find the probability Pundetect(C) of an undetected transmission error. It is related to the weight enumerator of C. We also find the probability Pcorr(C) that a codeword is decoded correctly.

Cosets and coset leaders

It turns out that the following notion is of direct relevance to decoding:

Definition: coset

Given a linear code CFqn and a vector yFqn, the coset of y is the set

y+C={y+ccC}.

We recall basic facts about cosets (see for example Algebraic Structures 1):

  • C=0+C is itself a coset. (C is called the trivial coset.) Moreover, C is the coset of any codeword cC.

  • • If y,zFqn, then either y+C=z+C (if yzC) or (y+C)(z+C)=.

  • #(y+C)=#C=qk.

  • • There are #Fqn#C=qnk distinct cosets.

Thus, the whole space Fqn is split (partitioned) into qnk cosets:

Fqn=C(a1+C)(aqnk1+C).

The above is true for any abelian group; but the following is specific to Coding Theory:

Definition: coset leader

A coset leader of a coset y+C is a vector of minimum weight in y+C.

Remark: warning — a coset leader may not be unique

There may be more than one coset leader in a coset. However, all coset leaders of a given coset are of the same weight.

Proposition 4.1: the formula for a decoder for a linear code

For a linear code CFqn, any decoder DECODE:FqnC satisfies:

yFqnDECODE(y)=ye where e is a coset leader of the coset y+C of y.

  • Proof. Let v=DECODE(y). Then vC. Put e=yv. Since C is a linear code, vC, so e=y+(v)y+C. We have proved that e must lie in the coset y+C.

    Vector y must be decoded to its nearest neighbour in C, i.e., d(y,v) must be minimised. Yet by Lemma 3.1 d(y,v)=w(yv)=w(e). Hence the decoder must choose e so that w(e) is minimal in the coset y+C. By definition, e must be a coset leader of y+C.

Standard array: construction

We now give a method to construct all cosets and to find one coset leader in each coset.

Definition: standard array

A standard array for a linear code CFqn is a table with the following properties:

  • • the table has |C|=qk columns and qnk rows;

  • • each row is a coset;

  • • the leftmost entry in each row is a coset leader of that row;

  • • the top row is the trivial coset (i.e., C itself);

  • • each entry is the sum of the leftmost entry in its row and the top of its column;

  • • the table contains every vector from Fqn exactly once.

We explain how to construct a standard array, using the linear code C={0000, 0111, 1011,1100}F24 as an example.

Row 0 of the standard array: lists all codevectors (elements of C=0+C). They must start from 0, but otherwise the order is arbitrary.

0000011110111100

Row 1: out of vectors not yet listed, choose a1 of smallest weight — this guarantees that a1 will be a coset leader. Fill in Row 1 by adding a1 to each codevector in Row 0.
Say, a1=0001. To list its coset, add it to row 0: e.g., 0001+0111=0110, etc.

0001011010101101

Row 2: choose a2 of smallest weight not yet listed, and do the same as for Row 1.
Say, a2=0010, add it to row 0:

0010010110011110

Row 3: same with, say, a3=0100:

0100001111111000

Since we have filled 4 rows, and qnk=242=4, our standard array is complete:

Example: a standard array for the code C={0000, 0111, 1011,1100}

0000011110111100000101101010110100100101100111100100001111111000

Standard array: decoding

Let CFqn be a linear code. By Proposition 4.1, any decoder is given by

DECODE(y)=yCOSET LEADER(y+C).

This suggests the following decoding algorithm for C.

Algorithm 4.2: the standard array decoder

Preparation: construct a standard array for C.

Decoding:

  • • Receive a vector yFqn.

  • • Look up y in the standard array.

  • • Return the topmost vector of the column of y as DECODE(y).

Justification: the algorithm is correct because, by definition of a standard array,

  • (a) Look-up of y will succeed as every vector in Fqn is present in the array;

  • (b) the row of y starts with COSET LEADER(y+C), so

  • (c) the top of y’s column is yCOSET LEADER(y+C) so this is y decoded.

Example: use the standard array decoder

For the code C={0000,0111,1011,1100} and standard array constructed above,

  • • decode the received vectors 0011 and 1100;

  • • give an example of one bit error occurring in a codeword and being corrected;

  • • give an example of one bit error occurring in a codeword and not being corrected.

Solution. We work with the following standard array for C:

0000011110111100000101101010110100100101100111100100001111111000

The received vector 0011 is in the second column, so DECODE(0011)=0111. The received vector 1100 is a codeword (in the fourth column), so DECODE(1100)=1100.

Suppose that the codeword 0000 is sent. If an error occurs in the last bit, the word 0001 is received and decoded correctly as 0000. If an error occurs in the first bit, the word 1000 is received and decoded incorrectly as 1100.

Discussion: is a standard array decoder unique?

Recall that there may be more than one possible standard array for the code C. Indeed, in the above example the coset 0100+C has two coset leaders: 0100 and 1000. Thus, we could construct a different standard array for C:

0000011110111100000101101010110100100101100111101000111100110100

The decoder associated to this standard array is different from the decoder considered above. Both decoders decode the same linear code C. A linear code can have more than one decoder.

However, if C is a perfect linear code, then each coset has only one coset leader, so the decoder is unique. This property of perfect codes appears on the example sheets.

Reminder (the number of errors corrected by a code)

Recall that a code with minimum distance d corrects t=[(d1)/2] errors.

The code C in the above example is linear, hence d(C)=w(C)=2 (it is easy to find the minimum weight of the code by inspection). This means that the code corrects [212]=0 errors. That is, C is not guaranteed to correct even a single bit error occurring in a codevector. And indeed, we saw in an example how one bit error occurred in a codevector and was not corrected.

So, from the point of view of Hamming’s theory, this code C has no error-correcting capability. It still detects up to one error.

But in Shannon’s theory, error-detecting and error-correcting performance of a code are measured probabilistically.

Error-detecting and error-correcting performance of a linear code: Shannon’s theory point of view

Shannon’s Information Theory is interested in how likely is it that a transmission error in a codeword is not detected/corrected by a decoder of C. We will answer these questions for a binary linear code C transmitted via BSC(p).

Recall that this means that one bit (0 or 1), transmitted via the channel, arrives unchanged with probability 1p, and gets flipped with probability p:

(image)

When a codeword v is transmitted, the channel generates a random error vector and adds it to v. By definition of BSC(p), for a given eF2n one has

P(the error vector equals e)=(1p)nipi,where i=w(e).

In determining Pundetect(C), the following notion is very useful:

Definition: the weight enumerator

The weight enumerator of a linear code CFqn is the polynomial

WC(x,y)=vCxnw(v)yw(v)=A0xn+A1xn1y+A2xn2y2++Anyn

in two variables x,y, where Ai=#{vC:w(v)=i}.

Theorem 4.3: Pundetect(C), the probability of an undetected error

Suppose that a codevector of a binary linear code C of length n is transmitted via BSC(p). The probability of an undetected error is

Pundetect(C)=WC(1p,p)(1p)n.

  • Proof. Let vC be the codevector being transmitted. Recall that an undetected error means that the received vector v+e is a codevector not equal to v. Note that, since vC and C is a vector space,

    v+eC, v+eveC, e0.

    Therefore, an undetected error means that the error vector is a non-zero codevector. We can now calculate

    Pundetect(C)=eC,e0P(the error vector is e)=eC,e0(1p)nw(e)pw(e).

    This is WC(1p,p) without exactly one term, excluded by the constraint e0, namely

    (1p)nw(0)pw(0)=(1p)n,

    which gives the expression for Pundetect(C) as stated.

Remark: In general, Pundetect(C) is calculated assuming that the codeword v is picked at random from the code. However, our proof shows that for a linear binary code and for the binary symmetric channel the probability is the same for all codevectors.

Example: calculating the weight enumerator and Pundetect

The binary linear code C={0000,0111,1011,1100} has one codeword of weight 0, zero codewords of weight 1, one codeword of weight 2 and two codewords of weight 3. Hence the weight enumerator of C is

WC(x,y)=x4+x2y2+2xy3.

If a codeword of C is sent via BSC(p), an undetected error occurs with probability

Pundetect(C)=(1p)2p2+2(1p)p3.

Discussion. Knowing Pundetect(C) is useful when a code is used for error detection, e.g., if the receiver can request retransmission if an error is detected. Then Pundetect(C) is on average the proportion of incorrect codevectors, hence incorrect symbols, accepted by the receiver. A code should be designed for a particular channel so as to keep this probability below an agreed threshold.

The probability of correct decoding

We will now find the probability of an error being corrected for C.

Theorem 4.4: Pcorr(C), the probability of correct decoding

Suppose that a codevector of a binary linear code C is transmitted via BSC(p). The probability that the received vector will be decoded correctly is

Pcorr(C)=i=0nαi(1p)nipi,

where αi denotes the number of cosets where the coset leader is of weight i.

  • Proof. Recall that vC is decoded correctly if DECODE(v+e)=v. By Proposition 4.1,

    DECODE(v+e)=v+eCOSET LEADER(v+e)=v+eCOSET LEADER(e). Therefore, correct decoding occurs if the error vector is the chosen coset leader of its coset.

    We therefore have one good outcome per coset: namely, e equals the chosen coset leader of the coset. Recall that that happens with probability (1p)nipi where i is the weight of the coset leader of the given coset. Summing over all cosets and gathering the like terms, we obtain the formula for Pcorr(C) as stated (it does not depend on v).

Discussion. When is it important to know Pcorr(C)? In one-way communication channels without retransmission even if an error is detected, the decoder produces a best guess as to which codevector was sent. An example is computer memory, where information could have been written (“sent”) long time ago, and it is not possible to “resend” it. Thus, 1Pcorr(C) is on average the proportion of incorrect codevectors, hence incorrect symbols, accepted by the receiver. A code should be designed for a particular channel to keep 1Pcorr(C) below an agreed threshold.

Example: calculation of Pcorr

Let C={0000,0111,1011,1100}. From the standard array

0000011110111100000101101010110100100101100111101000111100110100

we can see that α0=1, α1=3, α2=α3=0 (given by the leftmost column), so

Pcorr(C)=(1p)4+3(1p)3p.

Comparing codes using approximate values of Pundetect or Pcorr

Our analysis above gives, for a binary linear code C transmitted via BSC(p), the probabilities Pundetect(C) and Pcorr(C) as polynomials in p.

In practical situations p is typically very small, so it is rarely useful to know all terms of these polynomials in p. The term with the lowest power of p will dominate and can be used as an approximate value of the probability. This makes comparing codes easier.

Example. We compare use of the code C against transmission of undencoded information (“trivial binary code of length 1”).

If C is used for error detection: Pundetect(C)=(1p)2p2+2(1p)p3. This is a polynomial of the form p2+o(p2) where o(p2) contains powers of p higher than 2. For small p, the terms in o(p2) are negligible compared to p2. We conclude:

Pundetect(C)p2 whereas Pundetect(no encoding)=p,

i.e., the use of C improves the proportion of bad bits in the output from p to p2.

If C is used for error correction: 1Pcorr(C)=1(1p)43(1p)3p=p+o(p) (check this by opening the brackets). Thus,

1Pcorr(C)p whereas 1Pcorr(no encoding)=p.

Hence C is useless for error correction: its use does not improve the proportion of bad bits in the output while increasing the volume of information transmitted two-fold (R=0.5).

The above suggests that for error correction, more mathematically sophisticated codes need to be designed. In the rest of the course, we will see how ideas from different areas of mathematics are used in code constructions.