ECC edits
All checks were successful
CI / Typos (pull_request) Successful in 7s
CI / Typst formatting (pull_request) Successful in 5s
CI / Build (pull_request) Successful in 4m32s

This commit is contained in:
Mark 2025-02-26 08:46:48 -08:00
parent 871a02bb1d
commit c29f0d25c7
Signed by: Mark
GPG Key ID: C6D63995FE72FD80
6 changed files with 41 additions and 24 deletions

View File

@ -16,6 +16,11 @@
\title{Error-Correcting Codes} \title{Error-Correcting Codes}
\subtitle{Prepared by Mark on \today} \subtitle{Prepared by Mark on \today}
% TODO:
% ISBN section is tedious, could use some work.
% Check problem 5
\begin{document} \begin{document}
\maketitle \maketitle

View File

@ -1,6 +1,8 @@
\section{Error Detection} \section{Error Detection}
An ISBN\footnote{International Standard Book Number} is a unique numeric book identifier. It comes in two forms: ISBN-10 and ISBN-13. Naturally, ISBN-10s have ten digits, and ISBN-13s have thirteen. The final digit in both versions is a \textit{check digit}. An ISBN\footnote{International Standard Book Number} is a unique identifier publishers assign to their books. \par
It comes in two forms: ISBN-10 and ISBN-13. Naturally, ISBN-10s have ten digits, and ISBN-13s have thirteen.
The final digit in both versions is a \textit{check digit}.
\vspace{3mm} \vspace{3mm}
@ -15,7 +17,8 @@ If $n_{10}$ is equal to 10, it is written as \texttt{X}.
\problem{} \problem{}
Only one of the following ISBNs is valid. Which one is it? Only one of the following ISBNs is valid. Which one is it? \par
\note[Note]{Dashes are meaningless.}
\begin{itemize} \begin{itemize}
\item \texttt{0-134-54896-2} \item \texttt{0-134-54896-2}
@ -23,15 +26,16 @@ Only one of the following ISBNs is valid. Which one is it?
\end{itemize} \end{itemize}
\begin{solution} \begin{solution}
The first has an inconsistent check digit. The second is valid.
\end{solution} \end{solution}
\vfill \vfill
\pagebreak \pagebreak
\problem{} \problem{}
Take a valid ISBN-10 and change one digit. Is it possible that you get another valid ISBN-10? \par Take a valid ISBN-10 and change one digit. \par
Provide a proof. Is it possible that you get another valid ISBN-10? \par
Provide an example or a proof.
\begin{solution} \begin{solution}
Let $S$ be the sum $10n_1 + 9n_2 + ... + 2n_9 + n_{10}$, before any digits are changed. Let $S$ be the sum $10n_1 + 9n_2 + ... + 2n_9 + n_{10}$, before any digits are changed.
@ -50,9 +54,8 @@ Provide a proof.
\vfill \vfill
\problem{} \problem{}
Take a valid ISBN-10 and swap two adjacent digits. When will the result be a valid ISBN-10? \par Take a valid ISBN-10 and swap two adjacent digits. This is called a \textit{transposition error}. \par
This is called a \textit{transposition error}. When will the result be a valid ISBN-10?
\begin{solution} \begin{solution}
Let $n_1n_2...n_{10}$ be a valid ISBN-10. \par Let $n_1n_2...n_{10}$ be a valid ISBN-10. \par
@ -68,7 +71,8 @@ This is called a \textit{transposition error}.
\pagebreak \pagebreak
\definition{} \definition{}
ISBN-13 error checking is slightly different. Given a partial ISBN-13 $n_1 n_2 n_3 ... n_{12}$, the final digit is given by ISBN-13 error checking is slightly different. \par
Given a partial ISBN-13 with digits $n_1 n_2 n_3 ... n_{12}$, the final digit is given by
$$ $$
n_{13} = \Biggr[ \sum_{i=1}^{12} n_i \times (2 + (-1)^i) \Biggl] \text{ mod } 10 n_{13} = \Biggr[ \sum_{i=1}^{12} n_i \times (2 + (-1)^i) \Biggl] \text{ mod } 10
@ -127,7 +131,7 @@ Take a valid ISBN-13 and swap two adjacent digits. When will the result be a val
\vfill \vfill
\problem{}<isbn-nocorrect> \problem{}<isbnnocorrect>
\texttt{978-008-2066-466} was a valid ISBN until I changed a single digit. \par \texttt{978-008-2066-466} was a valid ISBN until I changed a single digit. \par
Can you find the digit I changed? Can you recover the original ISBN? Can you find the digit I changed? Can you recover the original ISBN?

View File

@ -1,6 +1,6 @@
\section{Error Correction} \section{Error Correction}
As we saw in \ref{isbn-nocorrect}, the ISBN check-digit scheme does not allow us to correct errors. \par As we saw in \ref{isbnnocorrect}, the ISBN check-digit scheme does not allow us to correct errors. \par
QR codes feature a system that does. \par QR codes feature a system that does. \par
\vspace{1mm} \vspace{1mm}
@ -8,7 +8,8 @@ QR codes feature a system that does. \par
Odds are, you've seen a QR code with an image in the center. Such codes aren't \say{special}---they're simply missing their central pixels. The error-correcting algorithm in the QR specification allows us to read the code despite this damage. Odds are, you've seen a QR code with an image in the center. Such codes aren't \say{special}---they're simply missing their central pixels. The error-correcting algorithm in the QR specification allows us to read the code despite this damage.
\begin{figure}[h] \begin{figure}[h]
\centering \centering
\href{https://youtube.com/watch?v=dQw4w9WgXcQ}{\includegraphics[width = 3cm]{qr}} %\href{https://youtube.com/watch?v=dQw4w9WgXcQ}{\includegraphics[width = 3cm]{qr-rick}}
\href{https://betalupi.com}{\includegraphics[width = 3cm]{qr-betalupi}}
\end{figure} \end{figure}
\definition{Repeating codes} \definition{Repeating codes}
@ -47,7 +48,8 @@ What is the efficiency of a $k$-repeat code?
\vfill \vfill
As you just saw, repeat codes are not a good solution. You need many extra bits for even a small amount of redundancy. We need a better system. Repeat codes are not efficient. We need to inflate our message by
\textit{three times} if we want to correct even a single error. We need a better system.
\pagebreak \pagebreak

View File

@ -1,6 +1,6 @@
\section{Hamming Codes} \section{Hamming Codes}
Say we have a 16-bit message, for example \texttt{1011 0101 1101 1001}. \par Say we have an $n$-bit message, for example \texttt{1011 0101 1101 1001}. \par
We will number its bits in binary, from left to right: We will number its bits in binary, from left to right:
@ -62,13 +62,14 @@ We will number its bits in binary, from left to right:
\problem{} \problem{}
In this 16-bit message, how many message bits have an index with a one as the last digit? \par If we number the bits of a 16-bit message as described above, \par
how many message bits have an index with a one as the last digit? \par
(i.e, an index that looks like \texttt{***1}) (i.e, an index that looks like \texttt{***1})
\vspace{2cm} \vspace{2cm}
\problem{} \problem{}
Say we number the bits in a 32-bit message as above. \par Now consider a 32-bit message. \par
How many message bits have an index with a one as the $n^\text{th}$ digit? \par How many message bits have an index with a one as the $n^\text{th}$ digit? \par
\vspace{2cm} \vspace{2cm}
@ -76,7 +77,10 @@ How many message bits have an index with a one as the $n^\text{th}$ digit? \par
We now want a way to detect errors in our 16-bit message. To do this, we'll replace a few data bits with parity bits. This will reduce the amount of information we can send, but will also improve our error-detection capabilities. Now, let's come up with a way to detect errors in our 16-bit message.
To do this, we'll replace a few data bits with parity bits.
This will reduce the amount of information we can send,
but will allow the receiver to detect errors in the received message.
\vspace{1mm} \vspace{1mm}
@ -174,7 +178,8 @@ Can this coding scheme correct a single-bit error?
\vfill \vfill
\pagebreak \pagebreak
We'll now add four more parity bits, in positions \texttt{0001}, \texttt{0010}, \texttt{0100}, and \texttt{1000}: We'll now add four more parity bits, in positions \texttt{0001}, \texttt{0010}, \texttt{0100}, and \texttt{1000}: \par
This error-detection scheme is called the \textit{Hamming code}.
\begin{center} \begin{center}
\begin{tikzpicture}[scale = 1.25] \begin{tikzpicture}[scale = 1.25]
@ -246,7 +251,7 @@ Bits \texttt{0100} and \texttt{1000} work in the same way. \par
When counting bits in binary numbers, go from right to left.} When counting bits in binary numbers, go from right to left.}
\problem{} \problem{}
Which message bits does each parity bit cover? \par Which message bits does each parity bit \say{cover}? \par
In other words, which message bits affect the value of each parity bit? \par In other words, which message bits affect the value of each parity bit? \par
\vspace{1mm} \vspace{1mm}
@ -358,7 +363,7 @@ Analyze this coding scheme.
\vfill \vfill
\problem{} \problem{}
Each of the following messages has either 0, 1, or two errors. \par Each of the following messages has either one, two, or no errors. \par
Find the errors and correct them if possible. \par Find the errors and correct them if possible. \par
\hint{Bit \texttt{0000} should tell you how many errors you have.} \hint{Bit \texttt{0000} should tell you how many errors you have.}
@ -590,7 +595,7 @@ A \textit{message stream} is an infinite string of binary digits.
\problem{} \problem{}
Show that Hamming codes do not reliably detect bit deletions: \par Show that Hamming codes do not reliably detect bit deletions: \par
\hint{ \hint{
Create a 17-bit message whose first 16 bits are a valid Hamming block, \par Create a 17-bit message whose first 16 bits are a valid Hamming-coded message, \par
and which is still valid when a bit (chosen by you; not the $17^\text{th}$) is deleted. and which is still valid when a bit (chosen by you; not the $17^\text{th}$) is deleted.
} }
@ -598,10 +603,11 @@ Show that Hamming codes do not reliably detect bit deletions: \par
\problem{} \problem{}
Convince yourself that Hamming codes cannot correct insertions. \par Convince yourself that Hamming codes cannot correct insertions. \par
Then, create a 16-bit message that... Then, create a 16-bit message that:
\begin{itemize} \begin{itemize}
\item is a valid Hamming block, and \item is itself a valid Hamming code, and
\item incorrectly "corrects" a single bit error when it encounters an insertion error. \item incorrectly "corrects" a single bit error when it encounters an insertion error. \par
You may choose where the insertion occurs.
\end{itemize} \end{itemize}
\vfill \vfill

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 89 KiB

After

Width:  |  Height:  |  Size: 89 KiB