binary error correcting codes

22
Binary Error Correcting Codes 1 Basic concepts of Error correcting Codes In communication system, we represent an information as a sequence of 0 an 1 (binary form). For a convenience, let B = {0, 1}. Then we define B 2 ,B 3 ,...,B n as follows : B 2 = {00, 01, 10, 11}, B 3 = {000, 001, 010, 100, 011, 101, 110, 11}, . . . B n = {b 1 b 2 ...b n |b i B} A symbol b 1 b 2 ...b n B n is called a word. We always denote 0 and 1 for 00 ... 0 and 11 ... 1, respectively. We define binary operations +, · : B × B B as follows : + 0 1 0 0 1 1 1 0 · 0 1 0 0 0 1 0 1 Clearly, (B, +) is an abelian group. Exercise 1.1. Let b 1 b 2 ...b n ,c 1 c 2 ...c n B n and for each i =1, 2,...,n, let d i = b i + c i as above table. Define a binary operation +: B n × B n B n by (b 1 b 2 ...b n ,c 1 c 2 ...c n ) d 1 d 2 ...d n . 1

Upload: lydang

Post on 10-Feb-2017

243 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Binary Error Correcting Codes

Binary Error Correcting Codes

1 Basic concepts of Error correcting Codes

In communication system, we represent an information as a sequence of 0

an 1 (binary form). For a convenience, let B = {0, 1}. Then we define

B2, B3, . . . , Bn as follows :

B2 = {00, 01, 10, 11},

B3 = {000, 001, 010, 100, 011, 101, 110, 11},...

Bn = {b1b2 . . . bn|bi ∈ B}

A symbol b1b2 . . . bn ∈ Bn is called a word. We always denote 0 and 1 for

00 . . . 0 and 11 . . . 1, respectively.

We define binary operations +, · : B ×B → B as follows :

+ 0 1

0 0 1

1 1 0

· 0 1

0 0 0

1 0 1

Clearly, (B, +) is an abelian group.

Exercise 1.1. Let b1b2 . . . bn, c1c2 . . . cn ∈ Bn and for each i = 1, 2, . . . , n, let

di = bi + ci as above table. Define a binary operation + : Bn ×Bn → Bn by

(b1b2 . . . bn, c1c2 . . . cn) 7→ d1d2 . . . dn.

1

Page 2: Binary Error Correcting Codes

i) verify that (Bn, +) is an abelian group,

ii) for each b1b2 . . . bn ∈ Bn, determine its inverse.

The following diagram provides a rough idea of general information trans-

mitted system.

Noise

e

Message word Code word Recieved word Message word-Encoding

-Transmission

-Decoding

w E(w) r D(r)

Fig.1 : The communication channel

From above figure, we give concepts of a binary (n, m) code as follows:

Definition 1.1. Let k, n ∈ N be such that m < n. A binary (n,m) code (or

code) compose of :

1. an injective function E : Bm → Bn, called an encoding function,

2. a function D : Bn → Bm such that D(E(w)) = w for all w ∈ Bm,

called a decoding function.

We call a set M ⊆ Bm a set of massage, w ∈ M a message word, C := E(M)

a code, c ∈ C a code word, r ∈ Dom(D) a received word .

2

Page 3: Binary Error Correcting Codes

In general, M 6= Bm. WLOG, we assume for a convenience that M = Bm.

Then a code C := E(M) = E(Bm) and |C| = 2m.

Definition 1.2. Let C ⊆ Bn be a code and c ∈ C. If a word r is received

(from c) and e ∈ Bn is such that r = c + e, we call e an error (or error

pattern).

Example 1.1 ( Even parity-check code). We define

E : Bm → Bm+1 by b1b2 . . . bm 7→ b1b2 . . . bmbm+1

where

bm+1 =

0 if the number of 1s′ in b1b2 . . . bm is even

1 if the number of 1s′ in b1b2 . . . bm is odd

and

D : Bm+1 → Bm

by

b1b2 . . . bmbm+1 7→

b1b2 . . . bm if the number of 1s′ in b1b2 . . . bm is even

00 . . . 0 if the number of 1s′ in b1b2 . . . bm is odd

Then even parity-check code is an (m + 1, m) code.

For example, B3 is encoded as follow :

message word 000 001 010 100 011 101 110 111

code word 0000 0011 0110

3

Page 4: Binary Error Correcting Codes

The following received words are decoded as in the table :

received word 1110 0101 0110 0001 1010 1101

message word 000 101

Example 1.2 ( Triple-repetition code). Triple-repetition code is (3m,m)

code such that an encoding function

E : Bm → B3m

is defined by

b1b2 . . . bm 7→ b1b2 . . . bmb1b2 . . . bmb1b2 . . . bm

and a decoding function

D : B3m → Bm

is defined by

x1x2 . . . xmy1y2 . . . ymz1z2 . . . zm 7→ b1b2 . . . bm

where

bi 7→

0 if 0 occurs in xiyizi at least twice

1 if 1 occurs in xiyizi at least twice

4

Page 5: Binary Error Correcting Codes

For example, B3 is encoded as follow :

message 000 001 010 100 011 101 110 111

code word 000 000 000 010 010 010

The following received words are decoded as in the table :

received word 101 101 101 010 111 110 011 101 110 001 101 001 111 000, 101

message word 101

Moreover, n−repetition code is defined similarly.

Nearest Neighbor Decoding : For a code C, if a word r is received, it is

decoded as the code word in C closest to it.

Complete Nearest Neighbor Decoding : If more than one candidate appears,

choose arbitrarily.

Incomplete Nearest Neighbor Decoding : If more than one candidate appears,

request a retransmission.

To measure a distance between any two code words, we introduce the

Hamming distance as follow :

Definition 1.3. Let u = u1u2 . . . un, v = v1v2 . . . vn ∈ Bn. The distance

d(u, v) of u and v is defined by

d(u, v) = |{i ∈ {1, 2, . . . , n}|ui 6= ui}|.

The weight w(u) of u is defined by

w(u) = |{i ∈ {1, 2, . . . , n}|ui 6= 0}|

5

Page 6: Binary Error Correcting Codes

The distance and weight defined above are called the Hamming-distance

and Hamming-weight , respectively.

Lemma 1.1. Let u, v ∈ Bn. Then w(u) = d(u,0) and d(u, v) = w(u + v).

Lemma 1.2. Let u, v, w ∈ Bn. Then

i) d(u, v) ≥ 0,

ii) d(u, v) = 0 iff u = v,

iii) d(u, v) = d(v, u),

iv) d(u, v) ≤ d(u, w) + d(w, v),

and hence (Bn, d) is a metric space.

Example 1.3. Let C = {0000000, 1001100, 1101101, 0110011} be a (7, 2)

code.

The following table displays Hamming weight of each code word in C :

code word v Hamming weight w(v)

0000000

1001100 3

1101101

0110011

6

Page 7: Binary Error Correcting Codes

The following table displays H-distance between any two code words in C :

d 0000000 1001100 1101101 0110011

0000000 0 3

1001100

1101101

0110011 5

Assume that complete nearest neighbor decoding is used. We introduce two

methods to decode received words. Let r be a received word.

1. Find the closest code word v ∈ C such that d(r, v) ≤ d(r, u) for all

u ∈ C:

2. Since d(r, b) = w(r + b) for all b ∈ Bn, r is decoded to v ∈ C such that

w(r + v) ≤ w(r + u) for all u ∈ C

Assume that 0001001, 1010100, 1001001, 0100101, 1110100, 1111111 are received

words. We decode them as follows :

By 1st method,

d 0000000 1001100 1101101 0110011 decode to

0001001 2

1010100 3 2 4 5 1001100

1001001

0100101

1110100

1111111

7

Page 8: Binary Error Correcting Codes

By 2nd method,

+ 0000000 1001100 1101101 0110011 decode to

0001001 0001001 1000101 1100100 0111010 0000000

1010100 1010100 0011000 0111001 1100111 1001100

1001001 0101101 1110011

0100101

1110100

1111111

Example 1.4. Let

C = {0111000, 0010010, 1101101, 1001000, 1100010, 0011101, 0110111, 1000111}be a (7, 4) code. Assume that 0001001, 1010100, 1001001, 0100101, 1110100, 1111111

are received words. We decode them by 2nd method,

+ 0111000 0010010 1101101 1001000 1100010 0011101 0110111 1000111 decode to

0001001

1010100

1001001

0100101

1110100

1111111

Definition 1.4. Let C be a code such that |C| 6= 1. The minimum distance

d(C) of C is

d(C) = min{d(u, v)|u, v ∈ C, u 6= v}.

8

Page 9: Binary Error Correcting Codes

The minimum weight w(C) of C is

w(C) = min{w(u)|u ∈ C\{0}}.

The minimum distance of a code tell me about the correction (and de-

tection) capability of its.

Theorem 1.3. Let C ∈ Bn be a code. Assume that nearest neighbor decoding

is used. Then

1) If t + 1 ≤ d, then C can detect t−errors.

2) If 2l + 1 ≤ d, then C can correct l−errors.

Example 1.5. Refer to codes in above examples.

1. Even parity check code in Example 1.1 has the minimum distance 2

and hence it can detect at most 1−error but cannot correct any error.

(Verify !)

2. Triple-repetition code in Example 1.2 has the minimum distance 3

and hence it can detect at most -error(s) and can correct at most

-error(s). (Verify !)

3. A code C in Example 1.3 has the minimum distance and hence it

can detect at most -error(s) and can correct at most -error(s).

4. A code C in Example 1.4 has the minimum distance and hence it

can detect at most -error(s) and can correct at most -error(s).

9

Page 10: Binary Error Correcting Codes

Example 1.6. Let C = {00000000, 11101011, 01011110, 10110101} be a (8, 2)

code. Distance between any two code words display on the table :

d 00000000 11101011 01011110 10110101

00000000 0 6 5 5

11101011 6 0 5 5

01011110 5 5 0 6

10110101 5 5 6 0

Then C has the minimum distance 5. This means that can correct at most

2−errors.

Assume complete nearest neighbor decoding is used. If words 11111111, 00001011

and 11110000 are received, we can decode as follow :

+ 00000000 11101011 01011110 10110101 decode to describtion

11111111 11111111 00010100 10100001 01001010 11101011 can correct 2−errors

00001011 00001011 11100000 01010101 10111110 choose arbitrarily cannot correct some 3−errors

11110000 11110000 00011011 10101110 01000101 10110101 can correct some 3−errors

When size of code is large, the minimum distance of code is hard to com-

pute. Next, we introduce you a more efficiency code which is called a linear

code (or group code).

10

Page 11: Binary Error Correcting Codes

2 Linear Codes (group codes)

Recall that (Bn, +) is an abelian group.

Definition 2.1. A (n, k) code C ⊆ Bn is called a linear code (or group code)

if for all u, v ∈ C, u + v ∈ C.

Exercise 2.1. Let C ⊆ Bn be a code. Verify that “C is a linear code if and

only if C is a subgroup of Bn ”.

Since C is a subgroup of Bn, by Lagrange’s Theorem |C|||Bn| = 2n and

hence |C| = 2k for some k ∈ {0, 1, 2, . . . , n}. This means that C contain 2k

words of length n.

Definition 2.2. We call a linear code C ⊆ Bn with |C| = 2k an [n, k] code .

If an [n, k] code C has the minimum distance C, we call C an [n, k, d] code.

Example 2.1. Refer to codes in above examples.

1. Even parity check code in Example 1.1 is a linear code with the mini-

mum distance 2. Hence it is a [m + 1, m, 1] code. (Verify !)

2. Triple-repetition code in Example 1.2 is a linear code with the minimum

distance 3. Hence it is a [3m, m, 3] code. (Verify !)

3. A code C in Example 1.6 is a [8, 2, 5] code.(Verify !)

Theorem 2.1. Let C ⊆ Bn be a linear code. Then d(C) = w(C).

Example 2.2. Consider the code

C = {000000, 001110, 010101, 011011, 100011, 101101, 110110, 111000}. Then

C is a linear code (verify!) and hence C has the minimum distance

d(C) = w(C) = 3, i.e., C is a [6, 3, 3] code.

11

Page 12: Binary Error Correcting Codes

Example 2.3. Consider the code C = {111111, 100110, 010001, 011010}.

Then C has the minimum distance d(C) = 3 is not equal to w(C) = 2. Why?

For any code, we can decode by methods which described in Example 1.3.

Now, If C is a linear code, we have more efficiency methods.

2.1 Cosets and Coset Decoding

Since an [n, k] code C is a subgroup of Bn, for u ∈ Bn, u+C = {u+ v|v ∈ C}

is called a coset of C generated by u. Clearly, the number of all (distinct)

coset of C is [Bn : C] =2n

2k= 2n−k.

Definition 2.3. For a coset u + C, we call v ∈ u + C a coset leader if

w(v) ≤ w(u + C).

Note that a coset leader may not unique.

Example 2.4. Consider a code C = {0000, 0110, 1011, 1101}. Then C is

a linear [4, 2, 2] code. Then we obtain cosets and coset leaders (underline

words) :

C + 0000 C + 0100 C + 1000 C + 0001

0000 0100 1000 0001

0110 0010 1110 0111

1011 1111 0011 1010

1101 1001 0101 1100

The above table is called the standard decoding array (or standard array).

Coset Decoding: Let C be an [n, k] code. If a word r ∈ Bn is received

and v is the coset leader for r + C, then decode r as r + v.

12

Page 13: Binary Error Correcting Codes

Theorem 2.2. Coset decoding is nearest neighbor decoding.

Proof. Let C be an [n, k] code , u ∈ Bn and v be a coset leader for u + C.

Since v ∈ u + C, u + C = v + C and hence v := u + v ∈ C. Let x ∈ C. Then

u + x ∈ u + C = v + C, i.e., w(v) ≤ w(u + x). Thus

d(v, u) = w(u + v) = w(v) ≤ w(u + x) = d(u, v).

Example 2.5. Consider the standard array

C + 0000 C + 0100 C + 1000 C + 0001

0000 0100 1000 0001

0110 0010 1110 0111

1011 1111 0011 1010

1101 1001 0101 1100

.

Assume that coset decoding is used. If words 0101, 1010, 1111, 1011, 0111 are

received, then we decode them as r + v where r is a received word and v is a

coset leader :

received word (r) decode to (r + e)

0101 0101 + 1000 = 1101

1010

1111

1011

0111

.

13

Page 14: Binary Error Correcting Codes

Example 2.6. Construct the standard array for the linear [6, 3, 3] code

C = {000000, 001110, 010101, 011011, 100011, 101101, 110110, 111000}.

C + 000000 C+ C+ C+ C+ C+ C+ C+

000000

001110

010101

011011

100011

101101

110110

111000

.

Assume that coset decoding is used. Decode followings received words :

received word (r) decode to (r + v)

010101

101011

111111

101100

011110

000111

111110

.

Describe about correction capability ?

14

Page 15: Binary Error Correcting Codes

2.2 Generator Matrix, Parity-check Matrix and De-

coding

For a convenience, we consider a word w = w1w2 . . . wk ∈ Bk as a matrix

w = [ w1 w2 · · · wk ]. Let G be a binary k × n matrix such that k < n.

Then wG = [ w1 w2 · · · wk ] ∈ Bn for all w ∈ Bk.

Definition 2.4. Let G be a binary k × n matrix such that k < n and the

first k columns is an identity matrix Ik. Define E : Bk → Bn by E(w) = wG.

Then C := {wG|w ∈ Bk} is called a code generated by G and G is called the

(standard) generator matrix for C.

From the above definition, we write G = [Ik A] for some (k × (n − k)

matrix A. Then for each message word u ∈ Bk, uG = [uIk uA] = [u uA]

which is easy to retrieve.

Exercise 2.2. Verify the followings :

i) E is an encoding function (i.e., E is injective).

ii) C is a linear code.

Definition 2.5. A binary (n − k) × n matrix H with k < n is called the

(standard) parity-check matrix for a linear [n, k] code C if the last n − k

columns is an identity matrix In−k and Hvt = [0] for all v ∈ C.

Lemma 2.3. If G and H are generator matrix and parity-check matrix for

a linear code C,respectively, then HGt = [0]

15

Page 16: Binary Error Correcting Codes

Theorem 2.4. If G = [Ik A] is a generator matrix for a linear [n, k] code

C, then H = [At In−k] is a parity check matrix for C.

Conversely, if H = [B In−k] is a parity check for a linear [n, k] code C, then

G = [Ik Bt] is a generator matrix for C.

Example 2.7. Even parity check code in Example 1.1 is a linear code with

the generator matrix

G =

1

Im...

1

.

Determine the parity-check matrix for even parity check code?

Triple-repetition code in Example 1.2 is a linear code with the generator ma-

trix

G =[

Im Im Im

].

Determine the parity-check matrix for triple-repetition code code?

Example 2.8. Let

G =

1 0 0 0 1 1

0 1 0 1 0 1

0 0 1 1 1 0

.

Then

1. The linear code

C : = {wG|w ∈ B3}

= { }.

16

Page 17: Binary Error Correcting Codes

2. The parity-check matrix

H =

3. All cosets and coset leaders

C + 000000 C+ C+ C+ C+ C+ C+ C+

.

17

Page 18: Binary Error Correcting Codes

Example 2.9. Let

G =

1 0 0 0 1 1 1

0 1 0 0 1 1 0

0 0 1 0 1 0 1

0 0 0 1 0 1 1

.

Then

1. The linear code

C : = {wG|w ∈ B4}

= {

}.

2. The parity-check matrix

H =

18

Page 19: Binary Error Correcting Codes

3. All cosets and coset leaders

C + 000000 C+ C+ C+ C+ C+ C+ C+

.

Definition 2.6. Let H be the parity-check matrix for a linear [n, k] code C.

For each v ∈ Bn, the syndrome S(v) of v is defined by S(v) = Hvt

Theorem 2.5. Let H be the parity-check matrix for a linear [n, k] code C

and u, v ∈ Bn.Then

19

Page 20: Binary Error Correcting Codes

i) S(u + v) = S(u) + S(v),

ii) S(v) = [0] if and only if v ∈ C,

iii) S(u) = S(v) if and only if u and v are in the same coset.

Definition 2.7. A table which matches each coset leader e with its syndrome

is called a syndrome look-up table.

Syndrome Decoding Let H be the parity-check matrix for a linear [n, k]

code C. If r ∈ Bn is received, compute S(r) and find v (in a syndrome

look-up table) such that S(r) = S(v). Decode r as r + v.

Example 2.10. Construct a syndrome look-up table for a [6, 3] code in Ex-

ample 2.8.

coset leader v syndrome S(v)

20

Page 21: Binary Error Correcting Codes

Assume that syndrome decoding is used. Decode following received words :

received word (r) S(r) decode to (r + v) s.t. S(r) = S(v)

010101

101011

111111

101100

011110

000111

111110

.

Exercise 2.3. Construct a syndrome look-up table for a [7, 4] code in Ex-

ample 2.9. Assume that syndrome decoding is used. Then decode following

received words : 0001001, 1010100, 1001001, 0100101, 1110100, 1111111.

Parity-heck Matrix Decoding Let H be the parity-check matrix for a

linear [n, k] code C. If r ∈ Bn is received, compute S(r) = Hrt.

1. If S(r) = [0], then r ∈ C and hence decode r as r.

2. If S(r) 6= [0] and S(r) is column i of H, decode by changing its ith bit.

3. If S(r) 6= [0] and S(r) is not a column of H, request a retransmission.

Exercise 2.4. For a [7, 4] code in Example 2.9. Assume that parity-check

matrix decoding is used. Then decode followings received words :

0001001, 1010100, 1001001, 0100101, 1110100, 1111111

.

21

Page 22: Binary Error Correcting Codes

References

[1] F.J. MacWilliams and N.J.A. Sloan, The Theory of Error-Correcting

Codes. New York:Elsevier/North Halland, 1977.

[2] San Ling and Chaoping Xing, Coding Theory : A First Course. Cam-

bridge University Press, 2004.

[3] Vera Pless, Introduction to the Theory of Error-Correcting Codes., John

Wiley and Son, 1990.

[4] J.H. Van Lint, Graduate Texts in Matematics : Introduction to Coding

Theory. Spriger-Verlag,1982.

[5] D.G. Hoffman et al, Algebraic Coding Theory.Winnipeg/Canada, 1987.

[6] W.K.Nicholson, Introduction to Abstract Algebra Algebra.John Wiley

& Sons, 1999.

22