Reed-Muller Codes

Reed-Muller and Preparata
Codes
OUTLINE

[1] Reed-Muller codes

[2] Decoding Reed-Muller codes

[3] Extended Preparata Codes

[4] Encoding Extended Preparata Codes

[5] Decoding Extended Preparata Codes
p2.
Chap 3 Perfect and Related Codes

Recall [3.8]. Reed-Muller codes


1. r-th order, length 2m, 0≦r≦m, RM(r, m)

RM(0, m)={00…0, 11…1}, RM(m, m)=

RM(r, m) = {(x , x  y ) | x  R M (r , m  1), y  R M (r  1, m  1)}, 0  r  m
m
K2
2. Eg 3.8.1
R M (0, 0)  {0, 1}
R M (0, 1)  {00, 11}
R M (1, 1)  K 2  {00, 01, 10, 11}
R M (0, 2)  {0000, 1111}
R M (2, 2)  K 4
R M (1, 2)  {(x , x  y ) | x  {00, 01, 10, 11}, y  {00, 11}}
p3.
Perfect and Related Codes

3. Generator matrix G of RM(r, m)
i) 0< r< m
ii) r= 0,
iii)r= m,

G (r , m  1) G (r , m  1) 
G (r , m )  

0
G (r  1, m  1) 


G (0, m )  [11....1]
G (m  1, m )
G (m , m )  

0........01


4. Eg 3.8.4 Find G(1,3)
11 11 


G (1, 2)  01 01 


00 11


G (1, 2)
G (1, 3)  
 0
G (1, 2) 

G (0, 2) 

1111

0101
 G (1, 3)  
0011

0000
1111 

0101 
0011 

1111

p4.
Perfect and Related Codes

5. The properties of RM(r,m)
(1) lengt h n= 2m
(2) dist ance d= 2m-r
r
(3) dimension k=  ( mi )
i= 0
(4) RM(r-1,m) is cont ained in RM(r,m), r> 0
(5) dual code RM(m-1-r, m), r< m
p5.
Reed-Muller Codes

[1] Reed-Muller codes

RM(r,m)  linear (n, k, d) code with




Standard ording of Km


n = 2m
r m
 
Dimension k = i 0  i 
Min. distance d = 2m-r
Label position i with binary representation ui  Km in reverse
order (low order digit first)
Eg. 9.1.1


Standard ordering for K2
= (00, 10, 01, 11)
0 1 2 3
Standard ordering for K3
= (000, 100, 010, 110, 001, 101, 011, 111)
0
1
2
3
4
5
6
7
p6.
Reed-Muller Codes

fv

Any function f : Km  {0, 1} has a unique vector
v = (f(u0), f(u1), …, f(u2m-1))  Kn , n=2m
where ui  Km and follows standard ordering
Consider fI : Km  {0, 1} as follow

Given I  {0, 1, …, m-1}
iI ( xi  1), if I  
f I ( x0 , x1 ,..., xm 1 )  
1, if I  

<def> vI is the corresponding vector form of fI
p7.
Reed-Muller Codes

Eg. 9.1.2
Let m = 3, so n = 23
(a) If I = {1, 2} then fI(x0, x1, x2) = (x1+1) (x2+1)
under standard ordering
f{1,2}(0,0,0) = 1
f{1,2}(0,0,1) = 0
x0x1x2 (a) (b) (c)
f{1,2}(1,0,0) = 1
f{1,2}(1,0,1) = 0
000 1 1 1
f{1,2}(0,1,0) = 0
f{1,2}(0,1,1) = 0
100 1 0 1
f{1,2}(1,1,0) = 0
f{1,2}(1,1,1) = 0
010 0 1 1
so vI = 11000000
110 0 0 1
001 0 1 1
(b) If I = {0} then fI(x0, x1, x2) = (x0+1)
101 0 0 1
so vI = 10101010
011 0 1 1
(c) If I =  then fI(x0, x1, x2) = 1
111 0 0 1
so vI = 11111111
p8.
Reed-Muller Codes

(a)
(b)
(c)
(d)
(e)
Two facts about fI



I={1,2}
I={0}
I=
I={1,2}{0}
I={1,2}
fI(x0, x1,…, xm-1) = 1 iff xi=0 for all iI
wt(vI)=2m-|I|
For each ui  Km
x0x1x2 (a) (b) (c) (d) (e)
fI(ui)fJ(ui) = fIJ(ui) and
000 1 1 1 1 1
100 1 0 1 0 1
2m 1
010 0 1 1 0 0
vI  vJ 
f I (ui ) f J (ui )
110 0 0 1 0 0
i 0
001 0 1 1 0 0
2m 1
101 0 0 1 0 0

f I  J (ui )
011 0 1 1 0 0
i 0
111 0 0 1 0 0


 wt( vI  J )
(mod 2)
iI ( xi  1), if I  
f I ( x0 , x1 ,..., xm 1 )  
1, if I  
p9.
Reed-Muller Codes

The Reed-Muller code RM(r,m)
can be defined as the linear code <{vI | I  Zm, |I| r}>




S = {vI | I  Zm, |I| r} : linearly indep. and thus a basis for
RM(r,m)
Generating matrix Gr,m in canonical form
Eg. 9.1.8
The generating matrix for RM(4,4) in canonical form
(see next page)
Encoding
c

mI v I
I  Zm ,|I|r
p10.

1111111111111111

1111111100000000
1111000011110000
Canonical form

vI comes before vJ
1100110011001100
if (1) |I|<|J| or

(2) |I|=|J|,
1010101010101010
 j such that


fI(uj)<fJ(uj) and fI(ui)=fJ(ui)  i > j
1111000000000000
1100110000000000

1010101000000000

G4, 4  1100000011000000
Eg. 9.1.11
1010000010100000

Encoding the following m using G2,4
1000100010001000
 (a) If m = 1 0000 001000

(so m = m0,3 = 1) then

1100000000000000
c = v + v0,3 = 0101010111111111

 (b) If m = 0 0101 001001
1010000000000000
(so m2 = m0 = m0,3 = m0,1 = 1) then
1000100000000000
c = v2 + v0 + v0,3 + v0,1 = 0111100011010010 
1000000010000000


1000000000000000



v3 
v2 


v1

v0 


v2 , 3 
v1,3 

v0,3 

v1, 2 
v0, 2 

v0,1 


v1, 2,3 

v0, 2,3 
v0,1,3 

v0,1, 2 


v0,1, 2,3 
v
Reed-Muller Codes

[2] Decoding Reed-Muller codes

<Def>


IC = Zm\I : the complement of I in Zm
Eg.
I = {1, 3, 5}  Zm , then IC = {0, 2, 4, 6, 7}
HI = {uKm | fI(u)=1}
fI(x0, x1,…, xm-1) = 1 iff xi=0 for all iI
Eg.
If I = {1, 2} then fI(x0, x1, x2) = (x1+1) (x2+1)
f{1,2}(0,0,0) = 1
f{1,2}(0,0,1) = 0
f{1,2}(1,0,0) = 1
f{1,2}(1,0,1) = 0
HI is a subspace of Km
f{1,2}(0,1,0) = 0
f{1,2}(0,1,1) = 0
pf:
f{1,2}(1,1,0) = 0
f{1,2}(1,1,1) = 0
x, y  HI
so HI = {000, 100}
 xi=yi=0
 xi+yi=0
 x+y  HI
p12.
Reed-Muller Codes

For u = (x0, x1, …, xm-1)  Km , t = (t0, t1, …, tm-1)  Km
Define fI,t(x0, x1, …, xm-1) = fI(x0+t0, x1+t1, …, xm-1+tm-1)
= fI(x+t)
Eg.
If I = {1, 2} then fI(x0, x1, x2) = (x1+1) (x2+1)
Assume t = 010
fI,t(0,0,0) = fI(0+0, 0+1, 0+0) = 0
fI,t(1,0,0) = fI(1+0, 0+1, 0+0) = 0
fI,t(0,1,0) = fI(0+0, 1+1, 0+0) = 1
fI,t(1,1,0) = fI(1+0, 1+1, 0+0) = 1
fI,t(0,0,1) = fI(0+0, 0+1, 1+0) = 0
fI,t(1,0,1) = fI(1+0, 0+1, 1+0) = 0
fI,t(0,1,1) = fI(0+0, 1+1, 1+0) = 0
fI,t(1,1,1) = fI(1+0, 1+1, 1+0) = 0 so vI,t = 00110000
p13.
Reed-Muller Codes

Lemma 9.2.1
Let I, J  Zm and |I||J|, for any sHIC and tHJ
vI,s  vJC,t = 1 iff I = J
pf:
fI,s (u)fJc ,t (u)   (x i  si  1) (x j  t j  1)
iI
jJc
c
so |{u| fI,s (u)fJc ,t (u)  1} | 2m|IJ | is even unless IJc=Zm
I={1} s=010
J={0,1} Jc={2} t=001
x0x1x2 f{1},010 f{2},001
000
0
0
0
100
0
0
0
010
1
0
0
110
1
0
0
001
0
1
0
101
0
1
0
011
1
1
1
111
1
1
1
I={1} s=010
J={1} Jc={0,2} t=101
x0x1x2 f{1},010 f{0,2},101
000
0
0
0
100
0
0
0
010
1
0
0
110
1
0
0
001
0
0
0
101
0
1
0
011
1
0
0
p14.
111
1
1
1
Reed-Muller Codes

c

I  Zm ,|I|r
Corollary 9.2.2
If c is a codeword in RM(r,m) and if |J| = r , then
mJ = c  vJC,t ,  tHJ
pf:
c  v Jc ,t 
mI v I

I  Zm ,|I|r
mI v I  v Jc ,t  mJv J  v Jc ,t  mJ
( In above, we choose s = (0,0,…,0)
since (0,0,…,0) HJC for any J, |J| = r )
p15.
Reed-Muller Codes

Lemma 9.2.3
Let J  Zm, for any word e (of length 2m)
e  vJC,t = 1
for at most wt(e) values of tHJ
pf:
if t1,t2HJ , t1t2
then (HJc + t1)  (HJc + t2)=
so vJc,t1 and vJc,t2 have no position
where both digits are 1
Thus each 1 in e affects at most one
of the values of e  vJC,t
J={0,1}
HJ={00xx} HJc={xx00}
x0x1x2x3 v{2,3},0010 v{2,3},0001
0000
0
0
1000
0
0
0100
0
0
1100
0
0
0010
1
0
1010
1
0
0110
1
0
1110
1
0
0001
0
1
1001
0
1
0101
0
1
1101
0
1
0011
0
0
1011
0
0
0111
0
0
1111
0
0
p16.
Reed-Muller Codes
Idea of decoding algorithm
Let w=c+e where c is a codeword in RM(r,m)
Let |J|=r
by lemma 9.2.3,
e  vJC,t = 0 for at least |HJ|-wt(e) values of tHJ
for such t we have
w  vJC,t = c  vJC,t + e  vJC,t
= c  vJC,t
= mJ (by cor. 9.2.2)
So if 2wt(e) < |HJ|, more than half of the w  vJC,t will be mJ
(i.e. more than |HJ|/2 will be mJ and less than |HJ|/2 will be mJ +1)

Now we can partially decode w by w(r-1) = w + |J|=rmJvJ
and apply similar method to w(r-1)
p17.
Reed-Muller Codes

Lemma 9.2.4
The minimum distance of RM(r,m) is 2m-r
pf:
The decoding algorithm can correct error patterns of
weight < |HJ|/2 where |J|  r
Thus RM(r,m) has min. distance at least 2m-r
( |HJ| = wt(vJ) = 2m-|J| )
We know vI with |I|=r is a codeword in RM(r,m)
and wt(vI) = 2m-r
So min. distance of RM(r,m) is 2m-r
p18.
Reed-Muller Codes

Algorithm 9.2.5 (Majority logic decoding)
Goal : decode a received word w encoded by RM(r,m)



1. i  r, w(r)  w
2.  J  Zm with |J|= i
compute w(i)  vJC,t for each tHJ
determine the majority mJ
3. If i > 0 then
w(i-1)  w(i) +  mJvJ , where |J|=i
if wt(w(i-1))  2m-r-1-1 then
set mJ=0 for all J with |J| r
OUTPUT message m
else i  i-1 goto step 2
If i = 0 then
OUTPUT message m
p19.
Reed-Muller Codes

Eg. 9.2.6
Decode w = 0101011110100000 that was encoded using G2,4



1. i = r = 2 , w(2) = w
m2,3 = 0
m1,3 = 0
m0,3 = 0
m1,2 = 0
m0,2 = 1
m0,1 = 0
Then w(1) = w(2) + v0,2 = 1111011100000000
2. i = 1
m3 = 1
m2 = 0
m1 = 0
m0 = 0
Then w(0) = w(1) + v3 = 0000100000000000
3. Since wt(w(0)) = 1  2m-r-1-1, so m = 0
OUTPUT 0 1000 000010
p20.
x0x1x2x3 v{2,3},0000
0000
1
1000
1
0100
1
1100
1
0010
0
1010
0
0110
0
1110
0
0001
0
1001
0
0101
0
1101
0
0011
0
1011
0
0111
0
1111
0
w(1)=1111011100000000
Preparata Codes

[3] Extended Preparata Codes

U  GF(2r),  is a primitive element of GF(2r)
Define
 (U ) be word of length 2 r which is
1 in position i
if  i  U (for 0  i  2 r  2)

r
1 in position 2  1 if 0  U
0 otherwise
GF(23) using 1+x+x3


Eg. 9.3.1
 is a primitive element of GF(23)
({0})=00000001
({2, 5, 6})=00100110
()=00000000
word
000
100
010
001
110
011
111
101
power of 
0
0
1
2
3
4
5
6
p23.
Preparata Codes
GF(23) using 1+x+x3


U  GF(2r) ,  GF(2r)
(1) U +  = {u+|u  U}
(2) U = {u| u U}
(3) UV = {x| x UV but xUV }
(U) + (V) = (UV)
Eg.9.3.2
U={2, 5, 6} , V={5, 0}
word
000
100
010
001
110
011
111
101
power of 
0
0
1
2
3
4
5
6
Then U+ 2 = {2 + 2 , 5 + 2 , 6 + 2} = {0, 3, 0}
2 U = {22, 25, 2 6}={4, 0, 1}
(U) + (V) = 00100110 + 00000101
= 00100011
= ({2, 6, 0})
= (UV)
p24.
Preparata Codes

Def.9.3.3
The extended Preparata code P(r) is the set of codewords of the
form [(U), (V)], where U and V  GF(2r) satisfy
(i) | U | and |V | are even
(ii) uU u = vV v
(iii) uU u 3  (  uU u)3   vV v 3
(iv) r is odd

Eg.9.3.4
GF(23) using 1+x+x3
word
000
100
010
001
110
011
111
101
Construct GF(23) using 1+x+x3
U = {1, 2, 5, 0} , V = {0, 1, 2, 3, 6, 0}
[(U), (V)] = 01100101 11110011 is a codeword in P(3)
power of 
0
0
1
2
3
4
5
6
p25.
(i) | U | and |V | are even
Preparata Codes (ii)
uU
u = vV v
(iii) uU u 3  (  uU u)3   vV v 3
(iv) r is odd

Pf:
Lemma 9.3.5
Suppose [(U), (V)] and [(A), (B)] are codewords in P(r).
Let   uU u . Then [(UA + ), (VB)] is also a codeword
check (i)(ii)(iii) of Def.9.3.3
(i) |U|, |V|,|A|,|B| are even
|UA + | = |UA| = |U|+|A|-2|UA| is even
|VB| = |V|+|B|-2 |VB| is even
(ii)

xU A
x   yU A ( y   )   yU A y   | U A |
for any I , J , since 2 i  0

xI J
x   xI x   xJ x
=  yU y   yA y
  yV y   yB y   yV B y
p26.
Preparata Codes
(iii)

3
3
3
3
x

(
x
)

(
y


)

(
y
)
(by (ii))



xU A
xU A
yU A
yV B
=  yU ( y   ) 3   yA ( y   ) 3  (  yV y   yB y )3
  yU y 3    yU y 2   2  yU y   3 | U |
+  yA y 3    yA y 2   2  yA y   3 | A |
+(  yV y )3  (  yV y ) 2 (  yB y )  (  yV y )(  yB y ) 2  (  yB y )3
(1) yV y   yU y  
(2)(  yV y ) 2   yV y 2
  yV y 3   yB y 3   yV B y 3
(3) | U | and | V | are even
p27.
Preparata Codes

Def
A code is distance invariant if for any pair of codeword c1
and c2, the number of codewords distance i from c1 equals
the number of codewords distance i from c2 for 1<=i<n.

Coro.9.3.7
Pf:
P(r) is distance invariant
Let [(U), (V)] and [(A), (B)] be codewords that are distance i
apart.
By Lemma 9.3.5
[(UU + ), (VV)] and [(UA + ), (VB)] are both
codewords and also distance i apart.
Since [(UU + ), (VV)] is the zero word
and [(UA + ), (VB)] has weight i
p28.
Preparata Codes

Lemma 9.3.8
Suppose [(U), (V)] is a codeword in P(r)
Then P(r) also contains the following codewords:
(i) [(V), (U)]
(ii) [(U + ), (V + )]
(iii) [(U), (V)] , 0
Pf:
Check (i)(ii)(iii) of Def.9.3.3
similar as the proof of lemma 9.3.5
p29.
Preparata Codes

Lemma 9.3.13
If  is a primitive element of GF(2r) then
3 is a primitive element if r is odd and is not primitive if r is even
Pf:
i is primitive iff gcd(i, 2r-1)=1
and if r is odd then 2r-1 = 1 mod 3
if r is even then 2r-1 = 0 mod 3

Coro.9.3.14
If r is odd then for each nonzero element x of GF(2r),
there is a unique y such that y3=x
p30.
Preparata Codes

Thm.9.3.15
P(r) has min. distance 6
Pf:
Since P(r) is distance invariant, it contains a codeword [(U), (V)]
of weight d
d = wt((U)) + wt((V)) = |U| + |V|
d is even, so we only need to show that d2,4 and there is a
codeword of weight 6
(1) suppose d=2, by lemma 9.3.8(i), assume |U|=2 and |V|=0
By lemma 9.3.8(ii), we can assume U={0, x}, x0
Then Def.9.3.3(ii) does not hold.
(2) suppose d=4, by lemma 9.3.8(i), either |U|=4 and |V|=0 or
|U|=2 and |V|=2
p31.
Preparata Codes
(a) |U|=4 and |V|=0, assume U={0, x, y, z},
x,y,z are distinct and non-zero
Then Def.9.3.3(iii) gives that
03+x3+y3+z3+(0+x+y+z)3=0
(x+y)(x+z)(y+z)=0
( impossible !!)
(b) |U|=2 and |V|=2, assume U={0, x} and V={y,z} y,z are distinct
Then Def.9.3.3(iii) gives that
03+x3+(0+x)3= y3+z3=0
By coro.9.3.14, if y3=z3 then y=z (-><-)
(3) Find a codeword of weight 6
Let x,y,z are distinct nonzero element
w be the unique element such that
w3 = x3+y3+z3
and let u = w+x+y+z
p32.
Preparata Codes
Then w is not equal to x,y or z (since w=x imply y=z)
and u0 (since w3 + (x+y+z)3 = (x+y)(x+z)(y+z)  0, so w  x+y+z)
Now let U={0,u} , V={w, x, y, z}
Then [(U), (V)] is a word of weight 6 and we can check that it is a
codeword.
p33.
Preparata Codes

Thm.9.3.18
P(r) is not a linear code
Pf:
we know that [(U), (V)] + [(A), (B)] = [(UA), (VB)]
from the proof of thm.9.3.15, we can construct them with
U={0, u1} , V={w1, x1, y1, z1}
A={0, u2} , B={w2, x2, y2, z2}
Then by lemma 9.3.5, [(UA + u1), (VB)] is a codeword
Since |UA + u1|  2, so
d ([(UA + u1), (VB)] , [(UA), (VB)])  4
But min. distance is 6.
So [(U), (V)] + [(A), (B)] is not a codeword,
P(r) is not a linear code.
p34.
Preparata Codes

[4] Encoding extended Preparata codes

Parity-check matrix of 2 error-correcting BCH code
 0
 1

H   2


 2m  2
 

0


3


6


3(2m  2) 


Define
A : the submatrix of H formed by the last 2r rows
H’ : the submatrix of H formed by deleting the last 2r rows from H
p35.
Preparata Codes

Eg.9.4.1 Construct GF(23) using 1+x+x3,
we have
010
001

110
A 
011
111

101
1


110
 2


101


 3
001
 4
111 

 5
010 



 6
011 

 3
GF(23) using 1+x+x3
word
000
100
010
001
110
011
111
101
001

111
6 

2 

011
 and A1  
5 
110
1 
101
 

4 
111
 
power of 
0
0
1
2
3
4
5
6
011
010 

101 

100 
110 

001 
p36.
Preparata Codes

Let m = mL,mR be any binary word of length 2r+1 - 2r – 2,
where mLis of length 2r - 1
mRis of length 2r- 2r – 1
then by using polynomial notation for mLand mR
we have [mL(),mL(3)]  mLH
[mR(),mR(3)]  mRH’
Define
vR = [mL() + mR(), mL(3) + (mL())3 + mR(3)]A-1
p37.
Preparata Codes

Thm. 9.4.2
Let r be odd. For any m of length 2r+1 - 2r – 2,
if (U)=[mL, pL] and (V)=[mR, vR, pR] , where pL and pR are parity
check digits.
Then [(U), (V)] is a codeword in P(r)
Pf:
[mR, vR]H = [mR]H’ + [vR]A
= [mR(), mR(3)] + [mL() + mR(), mL(3) + (mL())3 + mR(3)]
= [mL(), mL(3) + (mL())3]
But [mR, vR]H = [vVv, vVv3]
Similarly, mL() = uUu and mL(3) + (mL())3 = uUu3 + (uUu)3
Therefore Def.9.3.3(ii)(iii) hold, and clearly (i)(iv) hold.
p38.
Preparata Codes

Coro.9.4.3
P(r) has 2^(2r+1 - 2r – 2) codewords.

Algo.9.4.4 (Encoding P(r))
Let mL and mR be words of length 2r-1 and 2r-2r-1 resp.
Let vR be as defined in Thm 9.4.2.
Then [mL, pL, mR, vR, pR] is a codeword of m=[mL, mR]
p39.
Preparata Codes

[5] Decoding extended Preparata codes

w = [wL, pL, wR, pR] be a received word
where wL and wR are both of length 2r-1
Then we can compute
[wL(), wL(3)] = wLH
[wR(), wR(3)] = wRH
consider 6 cases
(1) If error only occurred on parity check digits
wL() = wR()
wL(3) +(wL())3 = wR(3)
and is easily checked
p40.
Preparata Codes
(2) If there are no errors in wL, one error in position i of wR and at
most one error in the parity check digits
Then
wL() = wR() + i
wL(3) +(wL())3 = wR(3) + 3i
so
(wL() + wR())3 = wL(3) +(wL())3 + wR(3)
and i = wL() + wR()
(3) If there are no errors in wR, one error in position i of wL and at
most one error in the parity check digits
By lemma 9.3.8(i) , we can check that
(wR() + wL())3 = wR(3) +(wR())3 + wL(3)
and i = wL() + wR()
p41.
(4) If two errors occur in wR, say in the position i and j
wL() = wR() + i + j
wL(3) +(wL())3 = wR(3) + 3i + 3j
so i + j and 3i + 3j are known.
i and j can be found in the same method in BCH decoding
(5) If two errors occur in wL, say in the position i and j
same as (4)
(6) If one error in wL and one in wR, say in position i and j resp.
Then
wL() + i = wR() + j
wL(3) + 3i +(wL() + i )3 = wR(3) + 3j
First, Let j = wL() + i + wR()
wL(3) + 3i +(wL() + i )3 = wR(3) + (wL() + i + wR())3
so (i + wR())3 = (wL(3) + wR(3)) + (wL() + wR())3 + wL()3 + wR()3
=
Therefore i = wR() + 1/3
j = wL() + 1/3