Reed-Muller Codes - Polynomial View of Encoding
Theory
Monomials and Polynomials over F2
A monomial is an algebraic expression that consists of a single product of variables. For our purposes, we are interested in monomials with m variables, X1,X2,…,Xm, where each variable can only be present or absent. This is because we operate in the binary field F2, where any variable Xi squared is just itself (Xi2=Xi). Thus, a monomial can be written as:
M=Xj1Xj2…Xjd
where {j1,j2,…,jd} is a subset of the variable indices {1,2,…,m}. The number of variables that are multiplied together in the monomial (i.e., d, in the above monomial) is the degree of the monomial.
A Boolean polynomial is a sum of such monomials, with coefficients also from F2 (meaning, they are either 0 or 1). An example of a polynomial in four variables is:
f(X1,X2,X3,X4)=1+X1+X3+X1X2+X2X3X4
The degree of a polynomial is the highest degree among all of its monomials. In the example above, the monomial X2X3X4 has degree 3, which is the highest, so the polynomial has degree 3.
The Evaluation of a Polynomial
The core operation for constructing Reed-Muller codes is the evaluation of a polynomial. Given a polynomial f(X1,…,Xm) and a specific binary vector v=(v1,v2,…,vm)∈F2m, we can evaluate the polynomial by substituting the components of v for the variables Xi.
Evalv(f)=f(v1,v2,…,vm)
The result of this evaluation will be either 0 or 1.
The complete evaluation vector of a polynomial, denoted Eval(f), is the ordered list of its evaluations for every single possible input vector in F2m. Since there are 2m such vectors, the evaluation vector will have a length of n=2m. We conventionally list the evaluations by taking the input vectors v∈F2m in lexicographical order (i.e., treating them as binary numbers from 0 to 2m−1).
Example: Evaluation of a Polynomial
Let's consider the polynomial f(X1,X2,X3)=X1+X2X3 over F23. Its degree is 2. To find its evaluation vector, we compute its value for all 23=8 input vectors, from (0,0,0) to (1,1,1).
Input Vector (v1,v2,v3) in lexicographic order |
Calculation of f(v1,v2,v3)=v1+v2v3 |
Output |
(0,0,0) |
0+(0⋅0)=0+0 |
0 |
(0,0,1) |
0+(0⋅1)=0+0 |
0 |
(0,1,0) |
0+(1⋅0)=0+0 |
0 |
(0,1,1) |
0+(1⋅1)=0+1 |
1 |
(1,0,0) |
1+(0⋅0)=1+0 |
1 |
(1,0,1) |
1+(0⋅1)=1+0 |
1 |
(1,1,0) |
1+(1⋅0)=1+0 |
1 |
(1,1,1) |
1+(1⋅1)=1+1 |
0 |
Assembling these output bits in order gives us the evaluation vector:
Eval(X1+X2X3)=(0,0,0,1,1,1,1,0)
Reed-Muller Codes
Reed-Muller (RM) codes are a family of linear block codes specified by two parameters: m and r, denoted as RM(r,m).
- The parameter m determines the number of variables in our polynomials, which in turn sets the codeword length to n=2m.
- The parameter r (where 0≤r≤m) specifies the maximum allowable degree for our polynomials.
The code RM(r,m) is then formally defined as the set of all evaluation vectors of all possible Boolean polynomials in m variables having a degree of at most r.
The number of distinct monomials of degree up to r determines the dimension of the code, k. Specifically, the message bits we wish to encode correspond to the coefficients of these monomials. The dimension is thus k=∑j=0r(jm).
Encoding of RM Codes
Apart from a standard generator matrix multiplication (which shall be discussed in the another experiment), the encoding process for RM(r,m) maps a message to a polynomial, and then generates the codeword by evaluating that polynomial.
- Construct the Polynomial: Use the message bits as the coefficients for the set of allowed monomials (all those with degree ≤r) to form a message polynomial f(X1,…,Xm).
- Generate the Codeword: Compute the evaluation vector Eval(f) by evaluating the polynomial for all 2m input vectors in F2m. This evaluation vector is the final codeword c.
Example 1: Encoding for RM(1,3)
Let's encode a message using the RM(1,3) code.
- Parameters: m=3,r=1.
- Codeword length: n=23=8.
- Allowed monomials: Degree ≤1. These are {1,X1,X2,X3}.
- Dimension: k=(03)+(13)=1+3=4.
Suppose our message is u=(1,1,0,1). We map these bits to the coefficients of the allowed monomials in a fixed order (e.g., constant, then X1, X2, X3):
f(X1,X2,X3)=(1)⋅1+(1)⋅X1+(0)⋅X2+(1)⋅X3=1+X1+X3
Now, we generate the 8-bit codeword by evaluating this polynomial:
Input (v1,v2,v3) |
f(v1,v2,v3)=1+v1+v3 |
Output |
(0,0,0) |
1+0+0 |
1 |
(0,0,1) |
1+0+1 |
0 |
(0,1,0) |
1+0+0 |
1 |
(0,1,1) |
1+0+1 |
0 |
(1,0,0) |
1+1+0 |
0 |
(1,0,1) |
1+1+1 |
1 |
(1,1,0) |
1+1+0 |
0 |
(1,1,1) |
1+1+1 |
1 |
The resulting codeword for the message (1,1,0,1) is c=(1,0,1,0,0,1,0,1).
Example 2: Encoding for RM(2,4)
Let's examine a more complex example. Consider the RM(2,4) code.
- Parameters: m=4,r=2.
- Codeword length: n=24=16.
- Allowed monomials: All monomials with degree 0, 1, or 2. This includes 1, {X1,X2,X3,X4}, and {X1X2,X1X3,X1X4,X2X3,X2X4,X3X4}.
- Dimension: k=(04)+(14)+(24)=1+4+6=11.
Let's say our 11-bit message corresponds to a message polynomial f(X1,X2,X3,X4)=X1X2+X3. This is a valid polynomial because its degree is 2, which is ≤r.
To find the codeword, we must evaluate this polynomial for all 16 input vectors from (0,0,0,0) to (1,1,1,1).
- For input (0,0,0,0): f(0,0,0,0)=(0⋅0)+0=0.
- For input (0,0,0,1): f(0,0,0,1)=(0⋅0)+0=0. This is incorrect. f(0,0,0,1)=(0⋅0)+0=0 is wrong, it should be f(0,0,0,1)=0⋅0+0=0 which is correct. The next one is f(0,0,1,0)=0⋅0+1=1. Let me re-evaluate the calculation in the previous turn.
Let's re-calculate for f(X1,X2,X3,X4)=X1X2+X3.
The evaluation depends on the values of X1,X2 and X3.
The input vectors are (v1,v2,v3,v4).
- If v1=0,v2=0: F=0⋅0+v3=v3. For inputs (0000,0001,0010,0011), v3 is (0,0,1,1). So outputs are (0,0,1,1).
- If v1=0,v2=1: F=0⋅1+v3=v3. For inputs (0100,0101,0110,0111), v3 is (0,0,1,1). So outputs are (0,0,1,1).
- If v1=1,v2=0: F=1⋅0+v3=v3. For inputs (1000,1001,1010,1011), v3 is (0,0,1,1). So outputs are (0,0,1,1).
- If v1=1,v2=1: F=1⋅1+v3=1+v3. For inputs (1100,1101,1110,1111), v3 is (0,0,1,1). So outputs are (1+0,1+0,1+1,1+1)=(1,1,0,0).
Concatenating these blocks gives the full 16-bit codeword:
c=(0,0,1,1,0,0,1,1,0,0,1,1,1,1,0,0)
This vector is one of the valid codewords in the RM(2,4) code space.