diff --git a/notes_reed-solomon.bib b/notes_reed-solomon.bib new file mode 100644 index 0000000..471480c --- /dev/null +++ b/notes_reed-solomon.bib @@ -0,0 +1,28 @@ +@misc{reedsolomon, + title = {{Reed-Solomon Codes paper}}, + author = {I. S. Reed, G. Solomon}, + howpublished = "\url{https://faculty.math.illinois.edu/~duursma/CT/RS-1960.pdf}", +} + +@misc{reedsolomon-bruce, + title = {Reed-Solomon}, + author = {Bruce Maggs}, + howpublished = "\url{https://courses.cs.duke.edu/spring10/cps296.3/rs_scribe.pdf}", +} + +@misc{vanddetproof, + title = {Vandermonde determinant proof}, + author = {Pedro Tamaroff}, + howpublished = "\url{https://math.stackexchange.com/questions/525334/vandermonde-determinant-by-induction}", +} + +@misc{vanddetproof2, + title = {Abstract Algebra, Theory and Applications. \emph{sec.22.2}}, + author = {Thomas W. Judson}, +} + +@misc{cyclotomicpolyroots, + title = {Lagrange bases in subgroups of Fp*: a hands-on introduction}, + author = {Alex Kampa}, + howpublished = "\url{https://github.com/aragon/research/blob/main/blog/001_Lagrange/lagrange.pdf}", +} diff --git a/notes_reed-solomon.pdf b/notes_reed-solomon.pdf new file mode 100644 index 0000000..ca4f84e Binary files /dev/null and b/notes_reed-solomon.pdf differ diff --git a/notes_reed-solomon.tex b/notes_reed-solomon.tex new file mode 100644 index 0000000..3e29e34 --- /dev/null +++ b/notes_reed-solomon.tex @@ -0,0 +1,339 @@ +\documentclass[a4paper]{article} +\setlength{\parindent}{0em} +\setlength{\parskip}{0.4em} +\usepackage{amsmath} +\usepackage{amsfonts} +\usepackage{amsthm} +\usepackage{enumerate} +\usepackage[bookmarksopen=true,bookmarks=true]{hyperref} +\usepackage{bookmark} +\hypersetup{ + pdfborder = {0.1 0.1 0.1}, +% colorlinks, +% citecolor=black, +% filecolor=black, +% linkcolor=black, +% urlcolor=blue +} + +\usepackage{multicol} +\usepackage{graphicx} +\usepackage{float} +\graphicspath{ {./imgs} } +\usepackage{pgf-umlsd} % diagrams +\usepackage[UKenglish]{datetime} +\newdateformat{DATEMonthYear}{\monthname[\THEMONTH] \THEYEAR} +\newdateformat{DATEYearMonthDay}{\THEYEAR-\THEMONTH-\THEDAY} + +\usepackage{booktabs} % \toprule \midrule ... + +\theoremstyle{definition} +\newtheorem{definition}{Def}[section] +\newtheorem{theorem}[definition]{Thm} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +\title{Notes on Reed-Solomon codes} +\author{arnaucube} +\date{January 2023} + +\begin{document} + +\maketitle + +\begin{abstract} + Notes taken while reading about Reed-Solomon codes. Usually while reading papers I take handwritten notes, this document contains some of them re-written to $LaTeX$. + + The notes are not complete, don't include all the steps neither all the proofs. +\end{abstract} + +\tableofcontents + +\section{Reed-Solomon Codes overview} +In this section we overview the main ideas presented in the Reed-Solomon paper \cite{reedsolomon} and in Bruce Maggs notes \cite{reedsolomon-bruce}. + +Reed-Solomon codes appeared in parallel to the BCH codes, and can be described as nonbinary BCH codes. In this section we will focus only in the Reed-Solomon codes, particularly in the encoding and error detection (not correction). + +\emph{tmp-note}: I feel like it is worth to check Galois theory \& BCH codes before going to Reed-Solomon codes, but due time constraints and our main goal being FRI, probably we should skip it. + +\subsection{Idea} + +Let $p(x) = m_0 + m_1 x + \ldots + m_{k-1} x^{k-1}$, where $m_i \in K$ and $k < 2^n$. + +We map $k$-tuples of $K$ into $2^n$-tuples of $K$, where $K=GF(p^r)$. +% Code E maps $k$-tuples of $K$ into $2^n$-tuples of $K$, where $K$ is a field of degree $n$ over the field of two elements $\mathbb{Z}_2$. +$$ +k +\begin{cases} + m_0\\ + m_1\\ + \vdots\\ + m_{k-1} +\end{cases} +\in K~~~~ +% \stackrel{E}{ \xrightarrow{\hspace*{1cm}} } +\xrightarrow{\hspace*{1cm}} +2^n +\begin{cases} + p(0)\\ + p(\alpha)\\ + p(\alpha^2)\\ + \vdots\\ + p(1) +\end{cases} +\in K +$$ + +The receiver then, can decode the messages by solving simultaneously any $k$ of the $2^n$ equations + +\begin{align*} + p(0) &= m_0\\ + p(\alpha) &= m_0 + m_1 \alpha + m_2 \alpha^2 + \ldots + m_{k-1} \alpha^{k-1}\\ + p(\alpha^2) &= m_0 + m_1 \alpha^2 + m_2 \alpha^4 + \ldots + m_{k-1} \alpha^{2k-2}\\ + &~~~\vdots\\ + p(1) &= m_0 + m_1 + m_2 + \ldots + m_{k-1}\\ +\end{align*} + +This system of equations can be solved, as we can see that any $k$ of the $p(\alpha^j)$ equations are linearly independent since they form a Vandermonde matrix +$$ +V = +\begin{pmatrix} + 1 & x_1 & x_1^2 & \ldots & x_1^{k-1} \\ + 1 & x_2 & x_2^2 & \ldots & x_2^{k-1} \\ + 1 & x_3 & x_3^2 & \ldots & x_3^{k-1} \\ + \vdots & \vdots & \vdots & & \vdots\\ + 1 & x_n & x_n^2 & \ldots & x_n^{k-1} \\ +\end{pmatrix} +$$ + +and $\det V$ is a Vandermonde determinant and $\det V \neq 0$ as +$$ +\det~V = \prod_{j < i} (x_i - x_j) +$$ + +See Annex \ref{sec:vandermondedet} for a proof of the Vandermonde determinant. + +% The number of combinations of taking $k$ elements from $2^n$ elements (without regard of order) can be expressed by $C_k^{2^n} = \binom{2^n}{k} = \frac{(2^n)!}{k!~(2^n - k)!}$. +% This is the number of determinations of $(m_0, \ldots, m_{m-1})$ in case of no errors. + +% TODO this part needs to be continued & finished. + +\subsection{Real world approach} +In the practical side, instead of transmitting $k+2s$ polynomial evaluations, we send $k$ coefficients + $2s$ evaluations. + +This is because we are interested in efficiency in the \emph{common} case, where in most of cases there are no errors and we care more about having a fast check that there are no errors than of the error recovering phase. + +Furthermore, in our use case in the context of FRI IOP, we are not interested into decoding but only into detecting errors. + +% \subsubsection{The setup} +% We work on $GF(p^r)$. For $\alpha$ being a primitive element of $GF(p^r)$, we set the generator polynomial +% +% $$ +% g(x) = (x-\alpha) (x-\alpha^2) \cdots (x-\alpha^{2s-1}) +% $$ +% +% +% THIS part is not coherent with the 'Encoding' section +% We define +% $$b(x) = x^{2s} \cdot m(x) \pmod{g(x)}$$ +% +% thus, for some $q(x)$, +% $$x^{2s} m(x) = q(x) g(x) + b(x)$$ +% +% Define the codeword $c(x)$ as +% $$c(x) = x^{2s} \cdot m(x) - b(x)$$ +% UNTIL HERE. + +% notice that $c(x)=q(x)g(x)$, thus $c(x)$ is a multiple of $g(x)$. +% +% In order to check if a received codeword $c'(x)$ is correct, we'll check its divisibility by $g(x)$. If the check passes, we extract the first $k$ elements of $c'(x)$. + + +\subsubsection{Encoding} + +Let $g(x)$ be the generator polynomial +$$g(x) = (x-\alpha) (x-\alpha^2) \cdots (x-\alpha^{2s-1})$$ + +whith $\alpha$ being a primitive element of $GF(p^r)$. + +The \emph{encoder} wants to map the message $\{ m_0, m_1, \ldots, m_{k-1} \}$ into a polynomial $p(x)$ of degree $