# Justesen code

In coding theory, Justesen codes form a class of error-correcting codes that have a constant rate, constant relative distance, and a constant alphabet size.
Before the Justesen error correction code was discovered, no error correction code was known that had all of these three parameters as a constant.
Subsequently, other ECC codes with this property have been discovered, for example expander codes. These codes have important applications in computer science such as in the construction of small-bias sample spaces.
Justesen codes are derived as the code concatenation of a Reed–Solomon code and the Wozencraft ensemble.
The Reed–Solomon codes used achieve constant rate and constant relative distance at the expense of an alphabet size that is linear in the message length.
The Wozencraft ensemble is a family of codes that achieve constant rate and constant alphabet size, but the relative distance is only constant for most of the codes in the family.
The concatenation of the two codes first encodes the message using the Reed–Solomon code, and then encodes each symbol of the codeword further using a code from the Wozencraft ensemble – using a different code of the ensemble at each position of the codeword.
This is different from usual code concatenation where the inner codes are the same for each position. The Justesen code can be constructed very efficiently using only logarithmic space.

## Definition

The Justesen code is the concatenation of an $(N,K,D)_{q^{k}}$ outer code $C_{out}$ and different $(n,k,d)_{q}$ inner codes $C_{in}^{i}$, for$1\leq i\leq N$.
More precisely, the concatenation of these codes, denoted by $C_{out}\circ (C_{in}^{1},...,C_{in}^{N})$, is defined as follows. Given a message $m\in [q^{k}]^{K}$, we compute the codeword produced by an outer code $C_{out}$: $C_{out}(m)=(c_{1},c_{2},..,c_{N})$.
Then we apply each code of N linear inner codes to each coordinate of that codeword to produce the final codeword; that is, $C_{out}\circ (C_{in}^{1},..,C_{in}^{N})(m)=(C_{in}^{1}(c_{1}),C_{in}^{2}(c_{2}),..,C_{in}^{N}(c_{N}))$.
Look back to the definition of the outer code and linear inner codes, this definition of the Justesen code makes sense because the codeword of the outer code is a vector with $N$ elements, and we have $N$ linear inner codes to apply for those $N$ elements.
Here for the Justesen code, the outer code $C_{out}$ is chosen to be Reed Solomon code over a field $\mathbb {F} _{q^{k}}$ evaluated over $\mathbb {F} _{q^{k}}-\{0\}$ of rate $R$, $0$ < $R$ < $1$.
The outer code $C_{out}$ have the relative distance $\delta _{out}=1-R$ and block length of $N=q^{k}-1$. The set of inner codes is the Wozencraft ensemble $\{C_{in}^{\alpha }\}_{\alpha \in \mathbb {F} _{q^{k}}^{*}}$.

## Property of Justesen code

As the linear codes in the Wonzencraft ensemble have the rate ${\frac {1}{2}}$, Justesen code is the concatenated code $C^{*}=C_{out}\circ (C_{in}^{1},C_{in}^{2},..,C_{in}^{N})$ with the rate ${\frac {R}{2}}$. We have the following theorem that estimates the distance of the concatenated code $C^{*}$.

## Theorem

Let $\varepsilon >0.$ Then $C^{*}$ has relative distance of at least $(1-R-\varepsilon )H_{q}^{-1}\left({\tfrac {1}{2}}-\varepsilon \right).$

### Proof

In order to prove a lower bound for the distance of a code $C^{*}$ we prove that the Hamming distance of an arbitrary but distinct pair of codewords has a lower bound. So let $\Delta (c^{1},c^{2})$ be the Hamming distance of two codewords $c^{1}$ and $c^{2}$. For any given
    $m_{1}\neq m_{2}\in \left(\mathbb {F} _{q^{k}}\right)^{K},$
we want a lower bound for $\Delta (C^{*}(m_{1}),C^{*}(m_{2})).$
Notice that if $C_{out}(m)=(c_{1},\cdots ,c_{N})$, then $C^{*}(m)=(C_{in}^{1}(c_{1}),\cdots ,C_{in}^{N}(c_{N}))$. So for the lower bound $\Delta (C^{*}(m_{1}),C^{*}(m_{2}))$, we need to take into account the distance of $C_{in}^{1},\cdots ,C_{in}^{N}.$
Suppose
    ${\begin{aligned}C_{out}(m_{1})&=\left(c_{1}^{1},\cdots ,c_{N}^{1}\right)\\C_{out}(m_{2})&=\left(c_{1}^{2},\cdots ,c_{N}^{2}\right)\end{aligned}}$
Recall that $\left\{C_{in}^{1},\cdots ,C_{in}^{N}\right\}$ is a Wozencraft ensemble. Due to "Wonzencraft ensemble theorem", there are at least $(1-\varepsilon )N$ linear codes $C_{in}^{i}$ that have distance $H_{q}^{-1}\left({\tfrac {1}{2}}-\varepsilon \right)\cdot 2k.$ So if for some $1\leqslant i\leqslant N,c_{i}^{1}\neq c_{i}^{2}$ and the code $C_{in}^{i}$ has distance $\geqslant H_{q}^{-1}\left({\tfrac {1}{2}}-\varepsilon \right)\cdot 2k,$ then
    $\Delta \left(C_{in}^{i}\left(c_{i}^{1}\right),C_{in}^{i}\left(c_{i}^{2}\right)\right)\geqslant H_{q}^{-1}\left({\tfrac {1}{2}}-\varepsilon \right)\cdot 2k.$
Further, if we have $T$ numbers $1\leqslant i\leqslant N$ such that $c_{i}^{1}\neq c_{i}^{2}$ and the code $C_{in}^{i}$ has distance $\geqslant H_{q}^{-1}({\tfrac {1}{2}}-\varepsilon )\cdot 2k,$ then
    $\Delta \left(C^{*}(m_{1}),C^{*}(m_{2})\right)\geqslant H_{q}^{-1}\left({\tfrac {1}{2}}-\varepsilon \right)\cdot 2k\cdot T.$
So now the final task is to find a lower bound for $T$. Define:
    $S=\left\{i\ :\ 1\leqslant i\leqslant N,c_{i}^{1}\neq c_{i}^{2}\right\}.$
Then $T$ is the number of linear codes $C_{in}^{i},i\in S$ having the distance $H_{q}^{-1}\left({\tfrac {1}{2}}-\varepsilon \right)\cdot 2k.$
Now we want to estimate $|S|.$ Obviously $|S|=\Delta (C_{out}(m_{1}),C_{out}(m_{2}))\geqslant (1-R)N$.
Due to the Wozencraft Ensemble Theorem, there are at most $\varepsilon N$ linear codes having distance less than $H_{q}^{-1}({\tfrac {1}{2}}-\varepsilon )\cdot 2k,$ so
    $T\geqslant |S|-\varepsilon N\geqslant (1-R)N-\varepsilon N=(1-R-\varepsilon )N.$
Finally, we have
    $\Delta (C^{*}(m_{1}),C^{*}(m_{2}))\geqslant H_{q}^{-1}\left({\tfrac {1}{2}}-\varepsilon \right)\cdot 2k\cdot T\geqslant H_{q}^{-1}\left({\tfrac {1}{2}}-\varepsilon \right)\cdot 2k\cdot (1-R-\varepsilon )\cdot N.$
This is true for any arbitrary $m_{1}\neq m_{2}$. So $C^{*}$ has the relative distance at least $(1-R-\varepsilon )H_{q}^{-1}\left({\tfrac {1}{2}}-\varepsilon \right),$ which completes the proof.

## Comments

We want to consider the "strongly explicit code". So the question is what the "strongly explicit code" is. Loosely speaking, for linear code, the "explicit" property is related to the complexity of constructing its generator matrix G.
That in effect means that we can compute the matrix in logarithmic space without using the brute force algorithm to verify that a code has a given satisfied distance.
For the other codes that are not linear, we can consider the complexity of the encoding algorithm.
So by far, we can see that the Wonzencraft ensemble and Reed-Solomon codes are strongly explicit. Therefore, we have the following result:
Corollary: The concatenated code $C^{*}$ is an asymptotically good code(that is, rate $R$ > 0 and relative distance $\delta$ > 0 for small q) and has a strongly explicit construction.

## An example of a Justesen code

The following slightly different code is referred to as the Justesen code in MacWilliams/MacWilliams. It is the particular case of the above-considered Justesen code for a very particular Wonzencraft ensemble:
Let R be a Reed-Solomon code of length N = 2$^m$ − 1, rank K and minimum weight N − K + 1.
The symbols of R are elements of F = GF(2$^m$) and the codewords are obtained by taking every polynomial ƒ over F of degree less than K and listing the values of ƒ on the non-zero elements of F in some predetermined order.
Let α be a primitive element of F. For a codeword a = (a$_1$, ..., a$_N$) from R, let b be the vector of length 2N over F given by
    $\mathbf {b} =\left(a_{1},a_{1},a_{2},\alpha ^{1}a_{2},\ldots ,a_{N},\alpha ^{N-1}a_{N}\right)$
and let c be the vector of length 2N m obtained from b by expressing each element of F as a binary vector of length m. The Justesen code is the linear code containing all such c.
The parameters of this code are length 2m N, dimension m K and minimum distance at least
    $\sum _{i=1}^{\ell }i{\binom {2m}{i}},$
where $\ell$ is the greatest integer satisfying $\sum _{i=1}^{\ell }{\binom {2m}{i}}\leq N-K+1$. (See MacWilliams/MacWilliams for a proof.)