Lean, informalized

Nielsen & Chuang · Chapter 10, Quantum error-correction · p. 449

Exercise 10.22 - The binary code checked by every nonzero string of rr bits, with its length, dimension and distance

Hamming codes have distance three and correct one error.

Hover over a blue or green term in the text, or a node in the graph, to find it in the other. Select it to read its declaration both in Lean and in words.

The Exercise

A string of bits sent through a noisy channel may arrive with some of its bits flipped. A binary linear code guards against this by admitting only the strings that pass a fixed set of parity checks, each check a sum of chosen bits modulo 22 that must vanish. The Hamming code with rr checks labels each bit position by a nonzero string of rr bits, using every such string once, and its iith check adds the bits whose label has a 11 in place ii. The exercise asks for the length nn of this code, the number of bits in a codeword, for its dimension kk over ℤ2\mathbb{Z}_2 and its minimum distance, and whether it corrects a flip of any single bit.

Linear Codes

A linear code CC over a field KK is a subspace of the strings with one entry from KK at each of its positions. The Hamming weight wt(c)\mathrm{wt}(c) of a string cc is the number of its nonzero entries. The minimum distance d(C)d(C) of a linear code CC is the least Hamming weight of a nonzero codeword, d(C)=min⁡{wt(c):c∈C,c≠0},d(C) = \min \{\, \mathrm{wt}(c) : c \in C,\ c \neq 0 \,\},(1)✦ and is infinite for the zero code, which has no nonzero codeword. A linear code CC corrects tt errors when d(C)≥2t+1d(C) \ge 2t + 1.✦

The Hamming Code

Fix a natural number rr and let PrP_r be the set of nonzero strings s=(s1,…,sr)s = (s_1, \dots, s_r) in ℤ2r\mathbb{Z}_2^r; these label the positions of the code. The Hamming parity check matrix HrH_r is the r×|Pr|r \times |P_r| matrix over ℤ2\mathbb{Z}_2 whose column at position ss is the string ss itself: (Hr)is=si,i=1,…,r,s∈Pr.(H_r)_{i s} = s_i, \qquad i = 1, \dots, r, \quad s \in P_r.(2)✦ The Hamming code CrC_r is the binary linear code with parity check matrix HrH_r.✦ Its codewords are the strings xx with one bit xsx_s at each position s∈Prs \in P_r that pass all rr checks: Cr={x∈ℤ2Pr:Hrx=0}.C_r = \{\, x \in \mathbb{Z}_2^{P_r} : H_r x = 0 \,\}.(3)✦

The Claim

Theorem 1. For every natural number rr, the Hamming code CrC_r has length n=|Pr|=2r−1n = |P_r| = 2^r - 1(4)✦ and dimension over ℤ2\mathbb{Z}_2 k=dim⁡Cr=2r−r−1.k = \dim C_r = 2^r - r - 1.(5)✦ Let moreover r≥2r \ge 2. Then the minimum distance of CrC_r is d(Cr)=3,d(C_r) = 3,(6)✦ and CrC_r corrects one error: d(Cr)≥2t+1for t=1.d(C_r) \ge 2t + 1 \quad \text{for } t = 1.(7)✦

What Is Checked

The claim is stated over the Hamming code CrC_r of (3), built on the parity check matrix HrH_r of (2), and over the minimum distance (1) of a linear code with the correction of tt errors defined from it. What the library proves about these constructions is the theorem above, all four of its parts.